Commit graph

40692 commits

Author SHA1 Message Date
Sir Richard c40a4a58a0 [NTOS]: Always set correct segments; the if/else branch should decide which segments to save, not whether or not to set the sane ones. Fixes boot on VirtualBox and real hardware.
svn path=/trunk/; revision=45357
2010-01-31 15:22:55 +00:00
Cameron Gutman 95b2e7519e - Merge some small changes from aicom-network-branch to fix potential memory corruption and remove unused code in oskittcp
- Add a hack to WSHSetSocketInformation so we don't fail with options that aren't implemented yet
 - Fixes bug #5131

svn path=/trunk/; revision=45356
2010-01-31 02:07:23 +00:00
Sir Richard 5a20627609 [NTOS]: Simplify KiTrapStub and write registers in order.
[PERF]: Change instructions used to save registers on the trap frame to fix some WaW and RaW hazards.

svn path=/trunk/; revision=45354
2010-01-30 19:10:22 +00:00
Sir Richard ed3b520c7b [PERF]: Omit setting certain useless trap frame fields.
[NTOS]: Fix KiEnterInterruptFrame. In the case of a V86 trap, the segments were overriden because this wasn't a kernel trap (missing if/elseif).

svn path=/trunk/; revision=45353
2010-01-30 18:25:30 +00:00
Sylvain Petreolle 607494ed1c Move Reactos logon sound to WindowsLogon sound scheme.
Fixes bug 5002.

svn path=/trunk/; revision=45350
2010-01-30 17:07:33 +00:00
Sir Richard 0eef75a032 [HAL]: Add debugging feature to HalpTrap06 error that sometimes happen. Please post/email/IM your trap frame should you see this error.
svn path=/trunk/; revision=45348
2010-01-30 16:40:57 +00:00
James Tabor 4206bf49f4 [User32]
- More movement to WND support.

svn path=/trunk/; revision=45341
2010-01-30 06:41:39 +00:00
James Tabor 1263c98dae [Win32k|User32]
- Updated paint functions to use one calls.
- Found one leak in engwindow.c and monitor.c, not the big one.

svn path=/trunk/; revision=45339
2010-01-30 04:23:58 +00:00
Sylvain Petreolle 4d1da2ea5c [HAL]
fix HalEndSystemInterrupt prototype.

svn path=/trunk/; revision=45324
2010-01-29 22:08:09 +00:00
Sylvain Petreolle 26dab4c37d add missing delimiters
svn path=/trunk/; revision=45323
2010-01-29 22:03:56 +00:00
Sir Richard 4e16ca56ce [HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources.
[HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead.
[NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C.
[PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization.
[PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling.

svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
Aleksey Bragin 1e19f89dbf [CSR]
- DejaVu Sans Mono seems to have a bug which makes Windows and Arwinss report double max char width as compared to a real char width. Since only a monospace font could be used, measure exact char width using GetTextExtentPoint32W and use that value.

svn path=/trunk/; revision=45319
2010-01-29 21:02:00 +00:00
Sir Richard 38668a867a [HAL]: Mark ECX as clobbered in HalpNestedTrap, otherwise if the compiler decides to store IRQL in ECX, it will then be overriden with our ECX parameter. With this clobber, the compiler will use another register, such as EAX, to hold the IRQL.
svn path=/trunk/; revision=45316
2010-01-29 08:14:51 +00:00
Sir Richard 4fa5e49fa3 [NTOS]: Return correct IRQ 0 vector instead of IRQL, when the timer interrupt ends.
svn path=/trunk/; revision=45315
2010-01-29 07:27:55 +00:00
Sir Richard 76e22a7c62 [NTOS]: Another try at the chained interrupt dispatch problem...
svn path=/trunk/; revision=45312
2010-01-29 02:25:30 +00:00
James Tabor 80e31b74bc - Fix recursion when sweeping the DCE list.
svn path=/trunk/; revision=45311
2010-01-29 02:07:31 +00:00
Sir Richard 3d6e5848c1 [NTOS]: Implement chained interrupt dispatch. For level interrupts, the first interrupt handler should process the interrupt and no other handlers are called. Edge interrupts are another matter, but since they aren't yet supported, I haven't implemented that code path (it wasn't implemented previously). I seriously hope we don't have edge/chained interrupts because the HAL/NTOS could never handle this!
svn path=/trunk/; revision=45310
2010-01-29 01:37:25 +00:00
Sir Richard 614734706d [NTOS]: Implement the KiInterruptTemplate in C since we now have a C entrry macro. Add a new KI_HARDWARE_INT flag for the C entry macro to generate the appropriate labels for runtime patching of the KINTERRUPT pointer to work, and issue an absolute instead of relative jmp.
[NTOS]: Remove thousands of lines of assembly that are not needed anymore.
[NTOS]: Put all interrupt code in irqobj.c (platform-specific).
[NTOS]: DPC Interrupt is really the thread scheduler interrupt (DPC work happens in C), which mostly does contexts switching and scheduling decisions, so move it to ctxswitch.S

svn path=/trunk/; revision=45309
2010-01-29 01:12:08 +00:00
James Tabor 3b6e1e135b - Remove WINDOWOBJECT_NEED_INTERNALPAINT from service.
svn path=/trunk/; revision=45308
2010-01-29 00:59:20 +00:00
James Tabor 49439aff5f [User32]
- Make ValidateRect a direct call, update related. Update UpdateWindow and some code sorting. Getting ready for WND switch.

svn path=/trunk/; revision=45307
2010-01-29 00:58:19 +00:00
James Tabor 69ae9c4e57 - Wrong commit msg, removed debug prints and fixed RedrawWindow. This fix one part of the leak.
svn path=/trunk/; revision=45306
2010-01-28 23:45:22 +00:00
James Tabor 21032e02d1 [Win32k]
- Add back removed window dce support routine. Fixed list handling and implemented thread cleanup for dces.

svn path=/trunk/; revision=45305
2010-01-28 23:34:57 +00:00
Sir Richard 5b14ade9f8 [NTOS]: The last big step. Now that the HAL is in C, we can handle interrupts in C. Do so using the proposed model that was #if'ed out, but with some improvements.
[NTOS]: Implement KiUnexpectedInterruptTail and KiUnexpectedInterrupt in C as well.
This is [PERF] too since the C interrupt handling code is a lot more efficient than the ASM one. Numbers look good here.

svn path=/trunk/; revision=45304
2010-01-28 23:18:53 +00:00
Sir Richard ac9c20ac0f [HAL]: Fix HalpFlushTlb. Thanks to Stefan Ginsberg <stefan100@reactos.org>
svn path=/trunk/; revision=45303
2010-01-28 23:08:04 +00:00
Matthias Kupfer b847e553ef this log message left intentionally non-descriptive
svn path=/trunk/; revision=45302
2010-01-28 22:18:31 +00:00
Sir Richard 7509f62a3b [PERF]: Optimize nested interrupt cases (where a pending interrupt exists at the end of a software or system interrupt) just like the old HAL did, by jumping into a second-level handler and completing the outer trap frame instead of the nested trap frame. This saves a lot of cycles in those cases, and they do happen quite often (pending DPC at the end of an interrupt, for example).
[NTOS/HAL]: Rework respective code to handle this by using the VDM Alert field in the KPCR.

svn path=/trunk/; revision=45301
2010-01-28 20:45:45 +00:00
Sir Richard 55c5579b1d [NTOS]: Fix L1/L2 cache detection and write out the size and associativity. Now that KeGetCurrentProcessorNumber doesn't think your L2 cache is the number of CPUs, this can be safely done.
svn path=/trunk/; revision=45300
2010-01-28 20:43:25 +00:00
Sir Richard 8ae0ebe9dd [NDK]: Fix KPCR definition.
[DDK]: KeGetCurrentProcessorNumber should not return a 32-bit DWORD combined of "ProcessorNumer", "VdmAlert" and "SecondLevelCacheAssociativity" because those 3 fields are probably not equal to a processor number. Having an L2 Cache will no longer result in ReactOS believing you have a 32000 core CPU.

svn path=/trunk/; revision=45299
2010-01-28 16:05:54 +00:00
Sir Richard 08d30b3abb [NTOS]: Remove checks for VDM alert during GPF. This is a Windows-specific hack for VDM, which isn't implemented.
svn path=/trunk/; revision=45298
2010-01-28 16:01:43 +00:00
Sir Richard da7d769c43 [PERF]: Not in any way a scientific number you should bet the farm on, but we do now count the number of cycles at the very first instruction of kernel initialization, at the moment SMSS initializes the registry (when we call kernel initialization complete), and at the moment there have been 12 processes created (10 without counting idle/system), which is a bit less than a normal GUI boot. We also display the number if interrupts, system calls, and context switches it took to get us there. A purely comparative number, perhaps worthy for inclusion in testman/regression tests?
svn path=/trunk/; revision=45297
2010-01-28 15:51:18 +00:00
James Tabor 5147b861f3 [Win32k]
- Add back removed window dce support routine. Fixed list handling and implemented thread cleanup for dces.

svn path=/trunk/; revision=45293
2010-01-28 01:00:09 +00:00
Cameron Gutman 6fcc316845 - Merge aicom-network-branch (still without the NDIS stuff)
- Fixes some nasty bugs and hacks in our TCP implementation

svn path=/trunk/; revision=45291
2010-01-28 00:24:00 +00:00
Daniel Reimer b76d8cf17a Update piperead to Version 0.3 (Jan Roeloffzen)
svn path=/trunk/; revision=45288
2010-01-27 22:13:26 +00:00
Daniel Reimer 166fa77176 Update log2lines to Version 1.11 (Jan Roeloffzen) Bug 4342
- Added -P Pipeline option for Powershell support, see below
- Renaming some structs to avoid potential naming conflicts with windows.h
- stdin/out -> stdIn/Out for redirecting
- Fixed potential mem leak
- A little more tracing and cleanup
Updated piperead (Jan Roeloffzen) Bug 5146
- Added Pipe client function, based on msdn example
- Improved option handling (try piperead -h)
- logging, error handling
- Integrated in build (pipetools.mak)

svn path=/trunk/; revision=45287
2010-01-27 19:03:52 +00:00
Sir Richard 532aff4429 [NTOS/PERF]: Enable VME support. VME stands for Virtual 8086 Mode Extensions, and it's an Intel optimization that makes changes to the IF bit in EFLAGS (CLI, STI, INT, IRETD, PUSHF, POPF) completely transprent: instead of changing the real (protected) bit, which requires the OS to trap and emulate the behavior, the CPU sets a "Fake" IF bit instead. When you're dong in V8086 mode, you simply update your real flag with whatever the fake flag says.
[NTOS]: Enable V8086 Fast-V86 Trap mode for Trap 6 (Invalid Opcode). Because we are now taking zero traps during V8086 mode, we can't do the "BOP lookahead", so the only trap we do get is when we hit the BOP/invalid opcode itself.
[NTOS]: Multiple fixes to V8086 opcode emulation code that I noticed while looking through the source. Also multiple fixes to VDM code.
This change will only impact real hardware and VMWare, since QEMU does not support VME. On VMWare, performance increased up to 400% during bootup (80 million cycles instead of 300 million, in one test).

svn path=/trunk/; revision=45282
2010-01-27 05:34:38 +00:00
Sir Richard 0aaa1fd765 [NTOS]: Trunk boots now (interesting that buildbot's QEMU does not support SYSENTER, as newer versions do), so remove the test DPRINTs.
svn path=/trunk/; revision=45281
2010-01-27 03:36:18 +00:00
Sir Richard 90e0457d60 [NTOS]: Rework the trap macros again. This time we needed some added complexity because of the need for runtime patching at boot. We got away with it nicely and basically implement a simple "if" in ASM, which gives us a deterministic set of instructions (vs the compiler). We then patch if if needed (see next bullet).
[NTOS]: Support systems without SYSENTER. Nothing was actually disabling the SYSEXIT mechanism recently enabled. Now IRET is always used unless a SYSENTER machine is discovered, in which case the jmp to the IRET code is patched with a jmp to SYSEXIT code.
[PERF]: Set WP0 bit in CR0 later, thus allowing the existing runtime patches (and this new one) to function without requiring MmSetPageProtect. Saves TLB flushes and page table walking/mapping on boot.
Left in some debug prints to see what buildbot reports...will remove if it survives.

svn path=/trunk/; revision=45280
2010-01-27 03:05:10 +00:00
Dmitry Gorbachev e6111d4302 Output PCH, not dependencies.
svn path=/trunk/; revision=45279
2010-01-27 02:29:36 +00:00
James Tabor 502cd1c9c9 - Turn off debug print outs.
svn path=/trunk/; revision=45278
2010-01-27 00:06:48 +00:00
Sir Richard 49ca1be9f3 [HAL]: Implement the profile and clock interrupt trap/handlers in C instead of ASM. This allows the kernel to remove the ugly hacks based on internal knowledge of how the assembly/stack of the HAL is supposed to look like. Everything is now done through a clean C interface.
[NTOS]: Remove said hacks and have a normal C implementation of KeUpdateSystemTime. It exits the interrupt through a soft interrupt exit.
[NTOS]: Implement 4 lines of support code needed to handle interrupts during V8086 mode, which were lacking since we weren't hitting this case yet.
Note that now the KeUpdateSystemTime interface is not "compatible" with Windows anymore. This does not matter, since the only possible caller of KeUpdateSystemTime is a very specific HAL routine that needs a very specific stack layout to actually work, so the chance of anyone calling this API is absolutely zero (no, not even some experimental driver. It's absolutely impossible).

svn path=/trunk/; revision=45276
2010-01-26 21:41:05 +00:00
Sir Richard 92df9a6434 [HAL]: Rewrite all V8086-related code in C instead of ASM. Delete v86.s. Makes uses of new macros and developments in NTOS, but should now only end up getting called at shutdown and for bugchecks.
svn path=/trunk/; revision=45272
2010-01-26 19:41:31 +00:00
Sir Richard 842d2aa5f9 [PERF]: What to do when your SYSEXIT code has a bug? Set KiFastSystemCallDisable to TRUE so it never gets used. Now, for the first time in 3 years and 3 months (not giving a specific revision # to protect the 'innocent'), ReactOS actually fully uses the SYSENTER/SYSEXIT instructions isntead of IRETD, since my code doesn't exhibit the bug and SYSEXIT is safe to use. This should save a good hundred cycles or more per system call.
svn path=/trunk/; revision=45271
2010-01-26 19:39:21 +00:00
Sir Richard dd14b916ff [PERF]: After spending the better part of the last two days rewriting the HAL V8086 code (used for BIOS Display Reset) in C, it dawned upon me that it shouldn't even be used during bootup in the first place! The boot loader, running in real-mode, already sets video mode 12 when starting ReactOS. We then repeat the operation, but since we're in protected mode, we have to emulate the whole sheebang with V8086 mode. We now initialize bootvid without requesting a mode switch (which was broken up until a commit ago). This gives us a dirty palette and VGA state. We then call VidResetDisplay to clean up the palette and setup the VGA registers correctly, but we only reset the screen if a custom /BOOTLOGO command is used (which isn't supported yet). We therefore don't need to enter V8086 mode at all up until the switch to graphics mode from the video card driver. Note that Windows doesn't do this (Win7 might due to the new Boot Graphics Library), so we're actually booting faster!
svn path=/trunk/; revision=45270
2010-01-26 19:29:37 +00:00
Sir Richard 590b4a4093 [BOOTVID]: Fix completely broken VidInitialize routine. I have no idea what the original code was trying to accomplish.
svn path=/trunk/; revision=45269
2010-01-26 19:21:41 +00:00
Sir Richard 71162a52f5 [NTOS]: Refactor some stub code and add a couple of more possible trap exit mechanisms (needed for HAL). Later we should really combine all the exit macros into one, as we've done for the entry macro.
svn path=/trunk/; revision=45268
2010-01-26 17:54:50 +00:00
Sir Richard 66a3a56604 [HAL]: Move the HalpApcInterrupt and HalpDispatchInterrupt to pic.c now that there is a C-macro to generate such stubs. Remove irq.S from build/sources.
svn path=/trunk/; revision=45267
2010-01-26 16:31:32 +00:00
Sir Richard 12a31f1df7 [NTOS]: Implement a C/Extended ASM macro for generating trap stubs, removing the need to do this in ASM. The macro covers all possible entries, from SYSENTER to a fake sotware interrupt (needed for HAL changes later). By being somewhat in C, it makes the code cleaner to read and uses C expressions to make its decisions, making the code more maintanable as well. It also removes the need for separate assembly files.
[NTOS]: Modify the semantics of how a fast system call (SYSENTER) is processed in the stub, by moving more work in the C handler, such as setting up FS and getting the correct argument stack. Saves us some cycles too (and allows the trap stub macro to be more generic).

svn path=/trunk/; revision=45266
2010-01-26 15:43:13 +00:00
Dmitry Chapyshev 102c63a3b6 - Update Ukrainian translation by Igor Paliychuk (igor-hkr[at]mail[dot]ru)
svn path=/trunk/; revision=45260
2010-01-26 10:23:30 +00:00
Sir Richard 219e108e3c [NTOS]: Split the GENERATE_TRAP_HANDLER in two separate macros. The original builds the name of the function (and makes it global), while the TRAP_HANDLER_PROLOG is actually the code.
[NTOS]: Make TRAP_HANDLER_PROLOG handle software traps, in which the interrupt stack must be faked.
[NTOS]: Optimize TRAP_HANDLER_PROLOG by not pushing an error code and then making space on the stack without the error code -- just make space with the error code in the first place (nobody reads the value, so having it zero or garbage isn't important).
[HAL]:  Implement the APC and DPC software interrupt traps in C instead of ASM. Delete all contents of irq.S except the two GENERATE_TRAP_HANDLER stubs.

svn path=/trunk/; revision=45244
2010-01-25 03:00:01 +00:00
Sir Richard ef75d24bac [HAL]: Implement HalEndSystemInterrupt and HalpEndSoftwareInterrupt. Remove more ASM code/tables that aren't unused anymore.
svn path=/trunk/; revision=45243
2010-01-25 01:51:47 +00:00