Commit graph

175 commits

Author SHA1 Message Date
Timo Kreuzer 620f9ee71a [NTOS] Add MxCsr handling to trap handlers 2022-08-22 11:22:08 +02:00
Timo Kreuzer 92c798c657 [NTOSKRNL] Implement KiXmmExceptionHandler 2022-08-22 11:22:08 +02:00
Timo Kreuzer 39f11249ff [NTOS][RTL] Initialize MxCsr where missing 2022-08-22 11:22:08 +02:00
Timo Kreuzer 786017c5b6 [NTOS] Don't assert, when dispatching an exception to user mode fails
Instead continue with second chance handling.
2022-08-04 16:15:24 +02:00
Timo Kreuzer b3a8f8611d [NTOS] Treat page faults with interrupts disabled as access violation 2022-08-04 16:15:24 +02:00
Timo Kreuzer e45af60560 [NTOS:KE/X64] Enable interrupts when accessing user mode memory 2022-08-04 16:15:24 +02:00
Timo Kreuzer 902c6eee1e [NTOS:KE] Restore interrupts in KiSwitchKernelStack 2022-08-04 16:15:24 +02:00
Timo Kreuzer ae39ad4d10 [NTOS] Add a hack for VBox 2022-08-04 16:15:24 +02:00
Timo Kreuzer 45f75d5d32 [NTOS:KE/x64] Handle user faults in KiGeneralProtectionFaultHandler 2022-07-14 18:35:28 +02:00
George Bișoc 064a35dc67
[NTOS:KE] Fully implement FPU Save/Restore mechanism
This commit fully implements the inner logic of KeSaveFloatingPointState and KeRestoreFloatingPointState routines. On ReactOS we're currently simply doing a FNSAVE operation whereas on Windows it is a lot more than that.

On Windows Server 2003 the logic more or less goes like this. In order to save the FPU state the NPX state of the current thread has to be checked first, that is, if NPX is loaded and currently charged for the current thread then the system will acquire the NPX registers actively present. From that point it performs either a FNSAVE or FXSAVE
if FX is actually supported. Otherwise the control word and MXCsr registers are obtained.

FXSAVE/FNSAVE operation is done solely if the FX save area is held up in a pool allocation. Pool allocation occurs if it's been found out that the NPX IRQL of the thread is not the same as the current thread which from where it determines if the interrupt level is APC then allocate some pool memory and hold the save area there, otherwise
the save area in question is grabbed from the current processor control region. If NPX is not loaded for the current thread then the FPU state is obtained from the NPX frame.

In our case we'll be doing something way simpler. Only do a FXSAVE/FNSAVE directly of the FPU state registers, in this way we are simplifying the code and the actual logic of Save/Restore mechanism.
2022-05-24 18:39:45 +02:00
Marcus Boillat fa52f2fae0
[NTOS:KE] Fix CPU extended family and model detection
Based on documentation from Geoff Chappell:
https://www.geoffchappell.com/studies/windows/km/cpu/cpuid/00000001h/eax.htm

CORE-17974
2022-05-09 21:50:24 +03:00
Marcus Boillat 00b3e4bc68
[NTOS:KE] Use bitfield structure for x86 CPU signature in EAX register
This makes code a lot more readable. CORE-17974
2022-05-09 21:50:24 +03:00
Stanislav Motylkov cc82bc14e2
[NTOS:KE] Move KiGet/SetProcessorType function below KiGetCpuVendor
CORE-17974
2022-05-09 21:50:19 +03:00
Hermès Bélusca-Maïto 9ea2b803c8
[NDK][HAL][NTOS] Add missing PRCB_MINOR_VERSION / PRCB_MAJOR_VERSION and use them. 2022-05-07 18:14:38 +02:00
Victor Perevertkin 99a6667bd9
[NTOS:KE] Remove all checks for x87 not being present 2022-01-25 02:12:33 +03:00
Victor Perevertkin 1aca6937ff
[NTOS:KE] Add a check for unsupported CPU features on i586
Currently, these features are vital for the kernel:
- CPUID instruction
- CMPXCHG8B instruction
- TSC aka Time Stamp Counter

All of that have to be present on i586
2022-01-25 02:12:33 +03:00
Victor Perevertkin 705e07ce31
[NTOS:KE] Move CPU features detection to a separate function on i586 2022-01-25 02:12:26 +03:00
Stanislav Motylkov 84cc81ee29
[NTOS:KE/x64] Detect CPU vendor properly and store value in PRCB
Also generate processor identifier properly based on this value
on the Configuration Manager machine-dependent initialization.

Update processor driver INF file accordingly.

CORE-17970 CORE-14922
2022-01-05 18:28:40 +03:00
Thomas Faber a4b2c80853
[NTOS:KE] Fix buffer overflow when displaying x64 bug checks 2022-01-03 13:25:09 -05:00
George Bișoc 3bc2d590a1
[NTOSKRNL] Regroup the pool allocation tags in one dedicated place
We have a special file, tag.h, which serves as a place to store whatever kernel pool allocation tag yet we still have some tags sparse over the kernel code... So just re-group them in one unique place.
2021-12-27 18:57:03 +01:00
Serge Gautherie 94b8095ba2 [NTOS:KE] KiTrap0EHandler(): Use MI_IS_WRITE_ACCESS() 2021-11-04 23:20:21 +03:00
Rafał Mikrut 54d5ad7533
[NTOS:KE] Fix copy paste bug in exception helper routine for ARM (#4005) 2021-10-07 23:04:19 +03:00
Hermès Bélusca-Maïto 6e9ff14e26
[NTOS:KD64,KE] IRQL is automatically adjusted during calls to KdEnterDebugger() and KdExitDebugger(). (#3942)
Addendum to 608032bd and 835c3023.

The IRQL is actually raised by KeFreezeExecution() and lowered by
KeThawExecution(), always to HIGH_IRQL on MP systems, or if necessary
on UP. These functions are called respectively by KdEnterDebugger()
and KdExitDebugger().
2021-09-12 18:20:32 +02:00
Victor Perevertkin 6ef6fabfc5
[FREELDR][NTOS][HALPPC][SDK] Remove PowerPC code
Remove PowerPC-related code from the kernel, HAL, SDK and
Freeloader.
2021-08-15 15:35:51 +03:00
James Tabor a81ad376a1 Check for PAE
Checking for PAE and set some logic later to support it.
2021-08-08 20:37:06 -05:00
Jérôme Gardou 42bec35f65 [NTOS:KE] Also rewrite KeZeroPages in assembly for amd64
Let's stick with "rep movsq" until we are able to have more precise benchmarks
2021-08-04 17:48:39 +02:00
Jérôme Gardou 51258295bd [NTOS:KE] Rewrite KeZeroPages in assembly
We spend a lot of time in this function, let's optimize it.
2021-08-04 17:48:39 +02:00
Timo Kreuzer a3763c61dc [PSDK][NDK] Use hex to define MIN/MAX constants like in native SDK
This fixes use of unary minus operator on unsigned type warning.
2021-07-23 22:03:48 +02:00
Jérôme Gardou 37d0a9c3f4 [NTOS:KE] Unconditionally check IRQL when acquiring & releasing spinlock at DISPATCH_LEVEL 2021-06-29 11:49:20 +02:00
Jérôme Gardou f30136bc79 [NTOS:KE] Test spinlock ownership on both UP & MP build
There is no reason not to, and this avoids introducing bugs stupidly.
2021-06-29 11:49:20 +02:00
Jérôme Gardou e312a40ae2 [NTOS:KE] Implement KeAcquireInStackQueuedSpinLockForDpc & KeReleaseInStackQueuedSpinLockForDpc 2021-06-29 11:49:20 +02:00
Jérôme Gardou c6e9fea844 [NTOSKRNL] Deduplicate some symbols 2021-06-24 18:48:31 +02:00
Jérôme Gardou 41de1bd724 [NTOS:KE] Do not allow waiting at IRQL >= DISPATCH_LEVEL when providing a timeout in KeWaitForMultipleObjects
CORE-6473
2021-06-21 11:42:01 +02:00
Timo Kreuzer f4d47faeb7 [NTOS:KE] Fix usage of KTHREAD::SwapBusy 2021-06-19 12:17:18 +02:00
Timo Kreuzer a011d19ed2 [NTOS:KE] Fix some locking issues 2021-06-19 12:17:18 +02:00
Timo Kreuzer 2ed56fa794 [NTOS] Fix build with CONFIG_SMP 2021-06-19 12:17:18 +02:00
Victor Perevertkin 34593d933b
[FORMATTING][NTOS][HAL][DRIVERS][SDK] Fix trailing spaces 2021-06-11 15:33:08 +03:00
Timo Kreuzer 7f2e0ece5a [NTOS:KE/x64] Handle shared interrupts 2021-06-04 09:19:13 +02:00
Timo Kreuzer f1ed97d6cc [NTOS:KE/x64] Implement KiSetTrapContext
KiSetTrapContext is an asm wrapper around RtlSetUnwindContext, which first stores an exception frame to assure that all non-volatile registers were put on the stack, then calls RtlSetUnwindContext to update their first saving positions on the stack and finally restore the exception frame to potentially load any updated registers, that haven't been saved elsewhere on the stack.
2021-06-02 18:25:36 +02:00
Timo Kreuzer 90a0e426ed [NTOS:KE] Add IRQL checks and fix KiInitiateUserApc 2021-05-28 11:52:42 +02:00
Timo Kreuzer 3d18831c19 [NTOS:KE] Improve KiSystemCallEntry64 2021-05-28 11:52:42 +02:00
Timo Kreuzer 69e8cb635a [NTOS:KE] Fix stack alignment issues 2021-05-28 11:52:42 +02:00
Timo Kreuzer 2a2d0903bf [NTOS:KE] Remove duplicated EFlag definitions 2021-05-28 11:52:42 +02:00
Jérôme Gardou 0395049986 [NTOS:KE] Do not call MmSetPageProtect for the Pentium Lock Errata
CORE-17589
2021-05-21 10:52:55 +02:00
Jérôme Gardou 3adf450867 [REACTOS] Addendum to 5c7ce4475e - Fix MSVC 2015 build
Put data into PAGEDATA or INITDATA sections
Keep section declaration for prototypes

CORE-17540
2021-05-12 11:04:29 +02:00
Jérôme Gardou 3726b992ed [NTOS:KDBG] Begin port for amd64.
Not really functional, but it prints debug output.
Take this as an opportunity to add consistancy between some i386 & amd64 intrinsics
2021-04-28 13:10:23 +02:00
Jérôme Gardou 5e29e98f91 [NTOS:KE] Explicitly use sysretq instruction 2021-04-28 13:10:23 +02:00
Hermès Bélusca-Maïto 3ad573f92f
[NTOS:KE] Both KeFindConfigurationEntry() and KeFindConfigurationNextEntry() functions are exported by NTOSKRNL, so they definitively must NOT be in the discardable INIT section!!
Noticed while reviewing c7d1ff4a.
2021-04-10 00:43:52 +02:00
Jérôme Gardou 0d3825862f [NTOS:KE] Rewrite KiSystemCallTrampoline in assembly
Instead of making assumptions about what the compiler does with forced-inline functions
2021-04-06 17:57:18 +02:00
Jérôme Gardou 187ca32175 [NTOS:KE] Use PNT_TIB as argument in KeSetTebBase 2021-03-24 11:09:20 +01:00
Serge Gautherie e0400e7810 [NTOS:KE] KiIdleLoop(): Propagate DECLSPEC_NORETURN to callers 2021-03-05 00:43:15 +03:00
Serge Gautherie 5f1d79f0c5 [NTOS:KE] KiIdleLoop(): Add DECLSPEC_NORETURN, Remove FASTCALL 2021-03-05 00:43:15 +03:00
Jérôme Gardou 4e4c47cccc [NTOS:KE] Generate proper frame info for trap handler in GCC builds
CORE-8531
2021-03-02 14:37:39 +01:00
Jérôme Gardou 158235bdd5 [NTOS:KE] Fix EIP only when the breakpoint is a break
Fixes ntdll:exception winetest crash
ROSTESTS-80
2021-02-01 16:39:39 +01:00
Hervé Poussineau ae4ce99e00 [ASM x64] Fix usage of macro .allocstack
.allocstack only accepts one 'size' parameter."
2021-01-28 20:31:16 +01:00
Hervé Poussineau ff7035d940 [ASM x64] Change ; by /* */ for comments
Syntax with semi-colon is not supported by gas.
2021-01-07 21:12:11 +01:00
Hervé Poussineau e581123c35 [NTOSKRNL] Correctly use SEH2 macros (fixes GCC x64 compilation) 2021-01-05 19:24:23 +01:00
Hervé Poussineau c2946ced92 [NTOS:KD] Remove some now useless tests on _WINKD_ 2020-11-16 08:55:03 +01:00
Victor Perevertkin 5c7ce4475e
[REACTOS] Cleanup INIT and some PAGE section allocations
- Change INIT_FUNCTION and INIT_SECTION to CODE_SEG("INIT") and DATA_SEG("INIT") respectively
- Remove INIT_FUNCTION from function prototypes
- Remove alloc_text pragma calls as they are not needed anymore
2020-11-02 21:45:31 +03:00
Timo Kreuzer bdd4d5d8d8 [NTOS:KE:X64] Set the exception frame as well in KiInitializeContextThread 2020-10-31 14:23:16 +01:00
Timo Kreuzer f66a7e2e48 [NTOS:KE:X64] Zero out the context in KiDispatchException 2020-10-31 14:23:16 +01:00
Timo Kreuzer 637183a12c [NTOS:KE:X64] Handle pending user APC on syscall exit (should be done on trap exit, too) 2020-10-31 14:23:16 +01:00
Timo Kreuzer 2a8c680dbe [NTOS:KE:X64][NTDLL:X64] Implement KiUserExceptionDispatcher and fix KiDispatchExceptionToUser 2020-10-31 14:23:16 +01:00
Timo Kreuzer 1bfacf06f7 [NTOS:KE:X64] Zero out volatiles when returning from a system call 2020-10-31 14:23:16 +01:00
Timo Kreuzer a016ccd117 [NTOS:KE:X64][ASM:X64] Fix delivery of APCs
- Deliver pending APCs on trap exit
- Pass the trapframe of KiApcInterrupt to KiDeliverApcs, not NULL.
- Fix parameter passing from KiSwapContext to KiSwapContextInternal and KiSwapContextResume, so that the ApcBypass parameter is not uninitialized
- Fix return value of KiSwapContextResume to correctly indicate whether we want to have APCs directly delivered or not (when there are non, or when delivery is suppressed)
2020-10-31 14:23:16 +01:00
Timo Kreuzer fdc1261fb7 [NTOS:KE:X64][NTDLL:X64] Implement x64 version of user callback code 2020-10-31 14:23:16 +01:00
Timo Kreuzer 52d1bb5ec9 [NTOS:KE:X64] Simplify KiInitializeUserApc 2020-10-31 14:23:16 +01:00
Timo Kreuzer aaa86d078e [NTOS:KE:X64] Move KiInitializeUserApc to usercall.c 2020-10-31 14:23:16 +01:00
Timo Kreuzer fbdff437fd [NTOS:KE:X64] Implement flushing the GDI batch 2020-10-31 14:23:16 +01:00
Timo Kreuzer c86c55ace7 [NTOS:KE:X64] Change the logic of KeSwitchKernelStack and friends to be standards conforming
The previous version (like the x86 one) used a combination of C and asm code, called from C code to switch the stack. This is problematic, since there is no guarantee what assumptions C code makes about the stack (i.e. it can place any kind of stack pointers into registers or on the stack itself.) The new algorithm returns back to the systemcall entry point in asm, which then calls KiConvertToGuiThread, which is also asm and calls KeSwitchKernelStack ...
2020-10-31 14:23:16 +01:00
Timo Kreuzer 18b1aafd82 [NTOS:KE:X64] Improve kernel stack switching on GUI system calls
To be 100% correct and not rely on assumptions, stack switching can only be done when all previous code - starting with the syscall entry point - is pure asm code, since we can't rely on the C compiler to not use stack addresses in a way that is not transparent. Therefore the new code uses the same mechanism as for normal system calls, returning the address of the asm function KiConvertToGuiThread, which is then called like an Nt* function would be called normally. KiConvertToGuiThread then allocated a new stack, switches to it (which is now fine, since all the code is asm), frees the old stack, calls PsConvertToGuiThread (which now will not try to allocate another stack, since we already have one) and then jumps into the middle of KiSystemCallEntry64, where the system call is handled again.
Also simplify KiSystemCallEntry64 a bit by copying the first parameters into the trap frame, avoiding to allocate additional stack space for the call to KiSystemCallHandler, which now overlaps with the space that is allocated for the Nt* function.
Finally fix the locations where r10 and r11 are stored, which is TrapFrame->Rcx and TrapFrame->EFlags, based on the situation in user mode.
2020-10-31 14:23:16 +01:00
Timo Kreuzer a6732905b8 [NTOS:KE:X64] Implement KiConvertToGuiThread, KeSwitchKernelStack and support for win32k syscalls in KiSystemCallHandler 2020-10-31 14:23:16 +01:00
Timo Kreuzer fe6752f852 [NTOS:KE:X64] Fix bugs in KeContextToTrapFrame and KeTrapFrameToContext
Set valid EFlags, the non-volatiles need to be taken from the exception frame, because the ones from the trap frame might not be set.
2020-10-31 14:23:16 +01:00
Timo Kreuzer eda01e5be7 [NTOS:KE:X64] Fix KiWriteSystemTime 2020-10-31 14:23:16 +01:00
Timo Kreuzer 8ec888487a [ASM:X64] ASSERT that interrupts are enabled, when returning to user mode 2020-10-31 14:23:16 +01:00
Thomas Faber 6b3f309a08
[NTOS] Consistently use MUTANT_INCREMENT.
Spotted by Hermès.
2020-10-16 16:09:54 +02:00
Timo Kreuzer 04f0c7d0d7 [NTOS:KE] Zero out ExceptionFrame member in Syscall handler 2020-09-20 23:08:17 +02:00
Timo Kreuzer 366e8a840c [NTOS:KE] Disable interrupts before lowering IRQL in KiDpcInterruptHandler to avoid stacking up DPC interrupts 2020-09-20 23:08:17 +02:00
Timo Kreuzer 3aaee35629 [NTOS:KE] Save and restore previous mode in KiZwSystemService and fix restoring the trap frame 2020-09-20 23:08:17 +02:00
Timo Kreuzer b2a483b9ea [NTOS:KE] Don't use FrLdrDbgPrint anymore. It served us well, but now it's time to go away. 2020-09-20 23:08:17 +02:00
Timo Kreuzer 2aca4b2795 [ASM] Fix boot with VS 16.7.3 / MSVC 19.27
See https://developercommunity.visualstudio.com/content/problem/1180800/ml-x86-assume-directive-causes-invalid-code-genera.html
2020-09-12 15:01:04 +02:00
Nguyen Trung Khanh 9d2ecd3a13
[NTOS:KE] Fix stack memory disclosure in KiInitializeUserApc (#2988) 2020-07-27 03:39:48 +03:00
Serge Gautherie 3051eb0e48
[NTOSKRNL] Add 'DECLSPEC_NORETURN' to a few 'KeBugCheck*()' (#2896) 2020-06-06 17:50:14 +02:00
Thomas Faber d40ff3ca98
[NTOS:KE] Split KiCheckForSListFault into its own function. CORE-15723
This avoids SEH in a trap handler.
See the following commit for more details.
2020-06-06 08:42:22 +02:00
Serge Gautherie b20f815126
[NTOSKRNL] Place INIT_FUNCTION before the return type (#2823)
(but after 'static' or SAL 2 annotation.)
Follow-up to 71fefa32, which mentions that it's actually required by the compiler in some circumstances.
2020-05-23 15:56:10 +02:00
Stanislav Motylkov cd91271796
[NTOSKRNL][HAL][BOOTVID] Some more code refactoring
- Add boot video color constants
- Refactor palette initialization
- Move some common stuff in right place
- Get rid of some magic constants and hardcoded values
- Get rid of TopDelta variable (calculated at compile time)
- Update SAL annotations

Addendum to 5f2ca473. CORE-16216 CORE-16219
2020-05-12 15:56:37 +03:00
Serge Gautherie 37d5522dfb [NTOS:KE] KiTrap0DHandler(): Fix a copypasta
Addendum to r45038.
2020-04-26 17:32:40 +02:00
Dmitry Borisov 1610367fe2
[BOOTVID][NTOSKRNL][HALX86] Move hardcoded coordinates of bootvid into one place. (#2504)
Co-Authored-By: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2020-04-09 15:17:48 +02:00
Hervé Poussineau 76a41370d0 [NTOS:KD] Move dump of stack trace on crash to debugger
Release builds now show again the bugcheck screen, instead of freezing.
2020-03-30 15:23:34 +02:00
Hervé Poussineau fd8cacae4c [NTOS:KE] Remove dead code 2020-03-30 15:23:25 +02:00
Thomas Faber 07de9d1da3
[NTOS:KE] In KiExitV86Mode, restore KTSS::Esp0 to its standard value. CORE-16531
The trap frame is in a random location on the stack, and setting Esp0 there
wastes significant amounts of space and may lead to unexpected stack overflows.

Also use a more descriptive expression for the V86 members of the KTRAP_FRAME.
2020-01-03 11:28:09 +01:00
Timo Kreuzer 7523a7b138 [NTOS:KE] Rename some locking functions to reflect the IRQL level changes
* KiAcquireApcLock -> KiAcquireApcLockRaiseToSynch
* KiAcquireApcLockAtDpcLevel -> KiAcquireApcLockAtSynchLevel
* KiReleaseApcLockFromDpcLevel -> KiReleaseApcLockFromSynchLevel
* KiAcquireApcLockAtApcLevel -> KiAcquireApcLockRaiseToDpc
* KiAcquireProcessLock -> KiAcquireProcessLockRaiseToSynch
* KiReleaseProcessLockFromDpcLevel -> KiReleaseProcessLockFromSynchLevel
* KiAcquireDispatcherLockAtDpcLevel -> KiAcquireDispatcherLockAtSynchLevel
* KiReleaseDispatcherLockFromDpcLevel -> KiReleaseDispatcherLockFromSynchLevel
* Add some ASSERTs
2019-12-31 15:30:27 +01:00
Timo Kreuzer f944f3a6cd [NTOS] In KeWaitFor*Object(s) assert that the current IRQL is SYNCH_LEVEL. not DISPATCH_LEVEL, since acquiring the dispatcher lock raises to SYNCH_LEVEL, which is != DISPATCH_LEVEL on x64 and SMP builds. 2019-12-31 09:43:14 +01:00
Hermès Bélusca-Maïto 03a9ccce65
[NTOS:KE] Explicitly use IOPM_SIZE for initializing the IO map, that is indeed also equal to PAGE_SIZE * 2 but is self-documented. 2019-11-25 00:41:54 +01:00
Hermès Bélusca-Maïto b2ca7d3ed9
[NTOS:KE] Minor formatting fixes. 2019-11-25 00:41:54 +01:00
Hermès Bélusca-Maïto a890fc64d1
[NTOS:KD/KD64/KDBG] Share some code between our legacy KD/KDBG and KD64.
Our legacy KD module is slowly being phased out for the more recent KD64
Kernel Debugger that supports WinDbg, but at the same time we must retain
support for GCC debugging and the KDBG interface.

For the time being few #ifdef _WINKD_ have been introduced in KD64 so that
some of its code/data does not completely get shared yet with the legacy KD,
until the latter becomes phased out.

KD Modifications:
=================
- Remove the implementation of NtQueryDebugFilterState() /
  NtSetDebugFilterState() that now comes entirely from KD64.

- Remove KD variables that are now shared with KD64.

- Share common code with KD64: KdpMoveMemory(), KdpZeroMemory(),
  KdpCopyMemoryChunks(), KdpPrint(), KdpPrompt().

- KDBG: Remove the duplicated KdpCopyMemoryChunks() function.

- In KdpServiceDispatcher() and KdpEnterDebuggerException(), call the
  KdpPrint() worker function that correctly probes and captures its arguments.

- Temporarily stub out KdEnterDebugger() and KdExitDebugger() that is used
  by the shared code, until KD is removed and only the KD64 version of these
  functions remain.

- Re-implement the KD/KDBG KdpPrompt() function using a custom KdpPromptString()
  helper compatible with KD64, that is called by the KD64 implementation of
  KdpPrompt(). This KdpPromptString() helper now issues the prompt on all
  the KD loggers: e.g. if you use both at the same time COM-port and SCREEN
  debugging, the prompt will appear on both. Before that the prompt was always
  being displayed on COM port even if e.g. a SCREEN-only debug session was used...

- ppc_irq.c: Fix the prototype of KdpServiceDispatcher().

KD64 Fixes:
===========
- Initialize the MaximumLength member of the counted STRING variables
  before using them elsewhere.

- Get rid of alloca() within SEH block in KdpPrint() (addendum to 7b95fcf9).

- Add the ROS-specific handy dump commands in KdSystemDebugControl().
2019-11-17 23:21:54 +01:00
Serge Gautherie 0339245859 [NTOS:KE] Fix 'Sert' typo, in a comment (#1929) 2019-09-23 01:13:07 +02:00
Serge Gautherie 66bf74d228 [NTOSKRNL] Move DPRINT1("Thread wants too much stack\n") around
To KiUserModeCallout() from MmGrowKernelStackEx().

As suggested by Thomas Faber:
"MmGrowKernelStackEx really shouldn't be DPRINT'ing."

CORE-14494
2019-08-15 18:18:59 +02:00
Timo Kreuzer adcae016c5 [NTOS:KE:I386] Fix parameter description for KiSwapContext 2019-08-15 18:04:57 +02:00
Hermès Bélusca-Maïto f694d12f0c
[NTOS:KE/MM] Some bug-fixes in the bugcheck code.
- Introduce the MmMakeKernelResourceSectionWritable() helper for
  making the kernel resource memory section writable, and use it
  in KeGetBugMessageText(). Indeed, this latter function patches
  in place the bugcheck resource message to trim any trailing
  newlines before displaying the message on screen.

  See also https://github.com/osresearch/uxen/blob/83bad53/dm/introspection-win7.c#L286
  that mentions it too.

  This fixes bugcheck text display (e.g. the MANUALLY_INITIATED_CRASH one)
  when using (at least) MSVC-built ReactOS, avoiding a Page-Fault
  exception during the bugcheck.

- Cover KeGetBugMessageText() in SEH since we are accessing kernel
  resources that could also be corrupted in bugcheck scenarii, and we
  don't want to further bugcheck.

- Fix newline trimming loop.

- KiDoBugCheckCallbacks():
  * Wrap the bugcheck CallbackRoutine call in SEH.
  * Add a FIXME concerning the need of further memory validation of CurrentRecord.

- Add a FIXME concerning the need to run the bugcheck-reason callbacks
  with the KbCallbackReserved1 reason, in KeBugCheckWithTf().
  Mentioned in http://blog.ptsecurity.com/2012/06/customizing-blue-screen-of-death.html
2019-06-25 21:01:49 +02:00