- Fix issue were prompt was unresponsive after first command.
- Enable x86_64 disassembly and default to intel syntax
- Print addresses with %p so that their full 64bit glory is shown.
- Fix a warning.
svn path=/branches/ros-amd64-bringup/; revision=45114
- Save extended xmm registers and in the ExceptionFrame
- Restore registeres from the ExceptionFrame
svn path=/branches/ros-amd64-bringup/; revision=45112
- Implement KiInitializeCpuFeatures amd call it early in the boot process
- fix KeProcessorArchitecture
- sumplify KiGetCpuVendor
- fix and enable __lldt
- remove some legacy code
svn path=/branches/ros-amd64-bringup/; revision=45095
Implement InterruptDispatchTable, containing 256 dispatch stubs, that push the Vector on the stack and then jump to KiUnexpectedInterrupt. This way we have the vector as ErrorCode on the stack and we can report it with KeBugCheckWithTf.
svn path=/branches/ros-amd64-bringup/; revision=45082
34969 Some ULONG / SIZE_T fixes, handle amd64 in PspCreateThread
34986 Fix several 64 bit issues
35968 Fix Size parameter of CmpAllpcate (ULONG->SIZE_T).
35970 Fix pointer <-> ULONG cast
35971 Fix pointer <-> ULONG cast fixes
36332 fix 64 bit warnings
37435 Fix several ULONG/ULONG_PTR issues. Add a parameter to DefaultQueryInfoBufferCheck for ULONG_PTR/SIZE_T ResultLength
39522 ExInitializeSystemlookasideList: Use InitializeSListHead instead of directly accessing the members. ExpAllocateLocallyUniqueId: use InterlockedCompareExchange64 instead of non-portable ExfInterlockedCompareExchange64
37433 fix InterlockedExchangePointer usage
38105 Use KeGetCurrentPrcb() instead of KeGetPcr()->Prcb / KeGetPcr()->CurrentPrcb
39160 Use wbinvd instruction for amd64, too.
svn path=/trunk/; revision=45066
[NTOS]: Optimize trap entry/exit by manually copying registers to the trap frame the correct way from the first time. Avoids conversion between PUSHA and KTRAP_FRAMEs and makes trap frames compatible the whole time (other than being slightly faster).
[NTOS]: Provide compiler with hints on likely code paths during trap entry and exit, which makes the code more linear and improves performance. The following assumptions (known to be true) are made: (1) Interrupts happen more often than system calls (per unit of time), so prioritize paths we take during interrupts. (2) The CPU spends most of its time in Ring 3, so prioritize traps from user-mode. (3) V8086 mode, debugging, 16-bit stacks, are uncommon, so de-prioritize them.
[NTOS]: Use KTRAP_FRAME offset names recommended by Timo instead of substraction which was confusing some people (still seems clearer to me).
svn path=/trunk/; revision=45064
KiExitV86Mode is supposed to return a pointer to the protected mode KTRAP_FRAME. Instead it was returning the value of TrapFrame->Edi, which would be identical to PmTrapFrame->Ebp, which doesn't have any particular meaning. Fix it by returning PmTrapFrame directly. Fixes 2nd stage boot.
svn path=/trunk/; revision=45062
[NTOS]: Add VDM debug spew to see why there's now an invalid opcode on Windows builds of VMWare and certain QEmu combinations. (Note: the double fault issue is fixed, this is a new issue).
svn path=/trunk/; revision=45057
__wine_push_frame and __wine_pop_frame are only used in x86 specific code in cppexcept.c. Move them there instead of trying to implement them for other architectures.
svn path=/branches/ros-amd64-bringup/; revision=45053
[NTOS]: A trap can get us into a state where DS/ES are invalid, making any pointer dereference (on DS/ES segmented memory, not SS, the stack) crash (and probably double-fault). Therefore, we have to be careful to switch to a good DS/ES before touching the TrapFrame pointer, which we don't have in ESP like the ASM code, but in a DS/ES-segmented register. For V8086 traps we can switch to the good DS/ES immediately, but for other kinds of traps, we actually need to save the current (bad) segments first. So we save them on the stack now, then switch to the good ones, then store the stack values into the trap frame. This is what happens on a non-optimized (-O0) build. On an optimized build, the segments will end up in registers instead, which is fine too (they'll be direct values). The order of instructions is guaranteed since the segment macros are volatile.
[NTOS]: The GPF and Invalid Opcode handlers are performance critical when talking about V8086 traps, because they control the main flow of execution during that mode (GPFs will be issued for any privileged instruction we need to emulate, and invalid opcode might be generated for BOPs). Because of this, we employ a fast entry/exit macro into V8086 mode since we can make certain assumptions. We detect, and use, such scenarios when the V8086 flag is enabled in EFLAGS. However, because we can land in a GPF handler with an invalid DS/ES, as some V8086 code could trample this during BIOS calls for example, we must make sure that we are on a valid DS/ES before dereferencing any pointer. We fixup DS/ES either in KiEnterTrap (for normal entry/exit) or, for V86, in KiEnterV86Trap. Notice the problem: we need to detect which of these to use early on but we can't touch the EFLAGS in the frame because DS/ES could be invalid. Thankfully SS is always guaranteed valid, so stack dereferences are game! We therefore read the EFLAGS here, in assembly, where we can touch ESP as we please. We save this in EDX, which will be used as the second argument for the FASTCALL C trap entry. When we make the fast V86 check, we use the parameter instead of the trap frame, leading us to using the correct trap entry function, which fixes up DS/ES and lets us go on our merry way...
[NTOS]: Make appropriate changes to GENERATE_TRAP_HANDLERS macro.
[NTOS]: Switch to using well-known NT trap handler names (hex-based, double-zeroed) instead of decimal-based trap handler names which are confusing.
[NTOS]: Clean up some debug spew.
svn path=/trunk/; revision=45052
- Move x86 emulator definitions into their own header
- Fix handling of the real mode IDT in x86BiosCall
- Implement HalpBiosDisplayReset
- Fix a copy paste error
svn path=/branches/ros-amd64-bringup/; revision=45047
[NTOS]: Fix a logic bug in KiExitTrap: Always only restore segments if we came from user-mode (since they might be bogus on a kernel transition as they're not always saved), even if the caller wants segment restore.
[NTOS]: Small perf boot: do a JMP, not a CALL into C handling code.
[NTOS]: Make KiGetTickCount/KiCallbackReturn handled in C (as stubs).
[NTOS]: Implement KeSynchronizeExecution in C. Move Kei386SpinOnSpinLock to C stub.
[NTOS]: Implement overall architecture for handling hardware interrupts in C. Not used yet, since it needs C code in HAL.
svn path=/trunk/; revision=45045
- EhciDefferedRoutine: Fix late night brain fart by filling the members of the WorkItemData before queuing the work item.
svn path=/trunk/; revision=45043
- More movement to WND with updates to related files. Added new scroll and get/post message routines. In the mix we did moved to the MONITOR structure.
svn path=/trunk/; revision=45042
[NTOS]: Implement KiCoprocessorError in C.
[NTOS]: Make NMI handler fully C, now that the other parts are C too.
[NTOS]: Delete more ASM macros and code that are now unused.
svn path=/trunk/; revision=45040
[NTOS]: Implement GPF handler (trap 13) in C. This was by far the most complex one of them, since it also servces two complex purposes: to handle V86 emulation since the real-mode code will generate GPFs during privileged instructions, and it will detect an illegal IRET, check if it's the known V8086 Exit IRET, and then jump to V86 exit code.
[NTOS]: Get rid of even more V8086 assembly since the GPF handler is now C. Deleted the entire V8086 assembly file.
[NTOS]: Get rid of a bunch of helper ASM functions that nobody is using anymore since almost all the trap handlers are in C.
svn path=/trunk/; revision=45038
- When locking and unlocking regions, no need to use probe to check attribute space first before read or write access. The exception handling is a feature.
svn path=/trunk/; revision=45034