mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTOS:KE/x64] Move setting the thread's trap frame to KiSystemCallEntry64
This is needed, because KiSystemCallHandler can be called multiple times for the same syscall entry, which would mess up the linkage. This replaces a previous hack and makes things cleaner.
This commit is contained in:
parent
fc6bf61e4c
commit
1538712c0b
2 changed files with 9 additions and 10 deletions
|
@ -817,6 +817,15 @@ PUBLIC KiSystemCallEntry64
|
|||
stmxcsr [rsp + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_MxCsr]
|
||||
ldmxcsr gs:[PcMxCsr]
|
||||
|
||||
/* Get the current thread and the trap frame */
|
||||
mov rax, gs:[PcCurrentThread]
|
||||
mov rcx, [rax + ThTrapFrame]
|
||||
|
||||
/* Save the old trap frame */
|
||||
lea rdx, [rsp + MAX_SYSCALL_PARAM_SIZE]
|
||||
mov [rsp + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_TrapFrame], rcx
|
||||
mov [rax + ThTrapFrame], rdx
|
||||
|
||||
#if DBG
|
||||
/* Check IRQL */
|
||||
mov rax, cr8
|
||||
|
@ -1077,12 +1086,6 @@ AlreadyLargeStack:
|
|||
/* Disable interrupts for return */
|
||||
cli
|
||||
|
||||
// FIXME: should just do the trap frame switch in KiSystemCallHandler64
|
||||
/* Restore old trap frame */
|
||||
mov rcx, gs:[PcCurrentThread]
|
||||
mov rdx, [rsp + 48 + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_TrapFrame]
|
||||
mov [rcx + KTHREAD_TrapFrame], rdx
|
||||
|
||||
// Restore register parameters
|
||||
mov rcx, [rsp + 48 + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_Rip]
|
||||
mov rdx, [rsp + 48 + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_Rdx]
|
||||
|
|
|
@ -116,10 +116,6 @@ KiSystemCallHandler(
|
|||
/* Set previous mode */
|
||||
Thread->PreviousMode = TrapFrame->PreviousMode = UserMode;
|
||||
|
||||
/* Save the old trap frame and set the new */
|
||||
TrapFrame->TrapFrame = (ULONG64)Thread->TrapFrame;
|
||||
Thread->TrapFrame = TrapFrame;
|
||||
|
||||
/* We don't have an exception frame yet */
|
||||
TrapFrame->ExceptionFrame = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue