Commit graph

22 commits

Author SHA1 Message Date
Oleg Dubinskiy f72d6dd4c5
[NTOS:KE] Set IRQL to SYNCH_LEVEL when exiting from idle after the thread is ready for execution (#6386)
CORE-1697

Raise IRQL to SYNCH_LEVEL when exiting from the idle thread in the
idle loop, in case it is scheduled for execution. Then restore it
back to DISPATCH_LEVEL, after this is done.
This behaviour is a bit similar to the way it's done on x64.

This IRQL raise is necessary only in SMP builds.
Calls are placed in CONFIG_SMP ifdef: this avoids unnecessary IRQL
changes on UP, since SYNCH_LEVEL and DISPATCH_LEVEL are identical
there, unlike in MP, where SYNCH_LEVEL is IPI_LEVEL - 2 actually.

This prevents bugcheck DRIVER_IRQL_NOT_LESS_OR_EQUAL when booting
SMP x86 ReactOS, in KiTimerExpiration when calling it 2nd time.
The BSOD happened due to IRQL levels mismatch.
2024-01-20 15:55:20 +01:00
Timo Kreuzer 6c5b3f203d [NTOS:KE/x64] Add back a stubs.c file 2023-12-08 19:38:59 +02:00
Timo Kreuzer 57c7f06004 [NTOS:KE/x64] Rename stubs.c to traphandler.c 2023-12-08 19:38:59 +02:00
Timo Kreuzer 902c6eee1e [NTOS:KE] Restore interrupts in KiSwitchKernelStack 2022-08-04 16:15:24 +02: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 c6e9fea844 [NTOSKRNL] Deduplicate some symbols 2021-06-24 18:48:31 +02:00
Timo Kreuzer a011d19ed2 [NTOS:KE] Fix some locking issues 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 3d18831c19 [NTOS:KE] Improve KiSystemCallEntry64 2021-05-28 11:52:42 +02:00
Serge Gautherie 5f1d79f0c5 [NTOS:KE] KiIdleLoop(): Add DECLSPEC_NORETURN, Remove FASTCALL 2021-03-05 00:43:15 +03:00
Hervé Poussineau e581123c35 [NTOSKRNL] Correctly use SEH2 macros (fixes GCC x64 compilation) 2021-01-05 19:24:23 +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 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 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
Nguyen Trung Khanh 9d2ecd3a13
[NTOS:KE] Fix stack memory disclosure in KiInitializeUserApc (#2988) 2020-07-27 03:39:48 +03:00
Timo Kreuzer de1b195837 [NDK] Fix the type of KPROCESS::ActiveProcessors
Also fix related logic in KiSwapProcess
2018-07-01 14:45:21 +02:00
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
Renamed from reactos/ntoskrnl/ke/amd64/stubs.c (Browse further)