mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NTOS] Add MxCsr handling to trap handlers
This commit is contained in:
parent
92c798c657
commit
620f9ee71a
3 changed files with 17 additions and 1 deletions
|
@ -822,6 +822,10 @@ PUBLIC KiSystemCallEntry64
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
|
|
||||||
|
/* Save MCXSR and set kernel value */
|
||||||
|
stmxcsr [rsp + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_MxCsr]
|
||||||
|
ldmxcsr gs:[PcMxCsr]
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
/* Check IRQL */
|
/* Check IRQL */
|
||||||
mov rax, cr8
|
mov rax, cr8
|
||||||
|
@ -861,6 +865,9 @@ no_user_apc_pending:
|
||||||
/* Disable interrupts for return */
|
/* Disable interrupts for return */
|
||||||
cli
|
cli
|
||||||
|
|
||||||
|
/* Restore MCXSR */
|
||||||
|
ldmxcsr [rsp + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_MxCsr]
|
||||||
|
|
||||||
/* Restore old trap frame */
|
/* Restore old trap frame */
|
||||||
mov rcx, gs:[PcCurrentThread]
|
mov rcx, gs:[PcCurrentThread]
|
||||||
mov rdx, [rsp + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_TrapFrame]
|
mov rdx, [rsp + MAX_SYSCALL_PARAM_SIZE + KTRAP_FRAME_TrapFrame]
|
||||||
|
|
|
@ -586,7 +586,7 @@ OFFSET(PcIrql, KPCR, Irql),
|
||||||
OFFSET(PcStallScaleFactor, KPCR, StallScaleFactor),
|
OFFSET(PcStallScaleFactor, KPCR, StallScaleFactor),
|
||||||
OFFSET(PcHalReserved, KPCR, HalReserved),
|
OFFSET(PcHalReserved, KPCR, HalReserved),
|
||||||
//OFFSET(PcPrcb, KPCR, Prcb),
|
//OFFSET(PcPrcb, KPCR, Prcb),
|
||||||
//OFFSET(PcMxCsr, KPCR, MxCsr),
|
OFFSET(PcMxCsr, KIPCR, Prcb.MxCsr),
|
||||||
//OFFSET(PcNumber, KPCR, Number),
|
//OFFSET(PcNumber, KPCR, Number),
|
||||||
//OFFSET(PcInterruptRequest, KPCR, InterruptRequest),
|
//OFFSET(PcInterruptRequest, KPCR, InterruptRequest),
|
||||||
//OFFSET(PcIdleHalt, KPCR, IdleHalt),
|
//OFFSET(PcIdleHalt, KPCR, IdleHalt),
|
||||||
|
|
|
@ -97,6 +97,9 @@ MACRO(EnterTrap, Flags)
|
||||||
mov [rbp + KTRAP_FRAME_SegGs], gs
|
mov [rbp + KTRAP_FRAME_SegGs], gs
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
/* Save MCXSR */
|
||||||
|
stmxcsr [rbp + KTRAP_FRAME_MxCsr]
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
mov ecx, MSR_GS_BASE
|
mov ecx, MSR_GS_BASE
|
||||||
rdmsr
|
rdmsr
|
||||||
|
@ -116,6 +119,9 @@ MACRO(EnterTrap, Flags)
|
||||||
mov es, ax
|
mov es, ax
|
||||||
swapgs
|
swapgs
|
||||||
|
|
||||||
|
/* Load kernel MXCSR */
|
||||||
|
ldmxcsr gs:[PcMxCsr]
|
||||||
|
|
||||||
#if DBG
|
#if DBG
|
||||||
/* Check IRQL */
|
/* Check IRQL */
|
||||||
mov rax, cr8
|
mov rax, cr8
|
||||||
|
@ -255,6 +261,9 @@ kernel_mode_return:
|
||||||
movdqa xmm5, [rbp + KTRAP_FRAME_Xmm5]
|
movdqa xmm5, [rbp + KTRAP_FRAME_Xmm5]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
/* Restore MCXSR */
|
||||||
|
ldmxcsr [rbp + KTRAP_FRAME_MxCsr]
|
||||||
|
|
||||||
/* Restore rbp */
|
/* Restore rbp */
|
||||||
mov rbp, [rbp + KTRAP_FRAME_Rbp]
|
mov rbp, [rbp + KTRAP_FRAME_Rbp]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue