mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 23:24:03 +02:00
Ring3: Fixed interrrupts handling.
This commit is contained in:
parent
4322e50e13
commit
f3ce095edb
@ -113,6 +113,7 @@ copy:
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
global ASM_PFX(CoreBootServices)
|
global ASM_PFX(CoreBootServices)
|
||||||
ASM_PFX(CoreBootServices):
|
ASM_PFX(CoreBootServices):
|
||||||
|
cli
|
||||||
; Save User data segment selector temporarily in R11.
|
; Save User data segment selector temporarily in R11.
|
||||||
mov r11, ds
|
mov r11, ds
|
||||||
|
|
||||||
@ -148,8 +149,12 @@ ASM_PFX(CoreBootServices):
|
|||||||
mov rdx, rbp
|
mov rdx, rbp
|
||||||
mov r8, [rbp + 8*6]
|
mov r8, [rbp + 8*6]
|
||||||
|
|
||||||
|
sti
|
||||||
|
|
||||||
call ASM_PFX(CallBootService)
|
call ASM_PFX(CallBootService)
|
||||||
|
|
||||||
|
cli
|
||||||
|
|
||||||
; Step over Arguments [1..3].
|
; Step over Arguments [1..3].
|
||||||
add rsp, 8*3
|
add rsp, 8*3
|
||||||
|
|
||||||
@ -170,6 +175,8 @@ o16 mov gs, r11
|
|||||||
pop rbp
|
pop rbp
|
||||||
pop rsp
|
pop rsp
|
||||||
|
|
||||||
|
sti
|
||||||
|
|
||||||
; SYSCALL saves RFLAGS into R11 and the RIP of the next instruction into RCX.
|
; SYSCALL saves RFLAGS into R11 and the RIP of the next instruction into RCX.
|
||||||
o64 sysret
|
o64 sysret
|
||||||
; SYSRET copies the value in RCX into RIP and loads RFLAGS from R11.
|
; SYSRET copies the value in RCX into RIP and loads RFLAGS from R11.
|
||||||
@ -185,6 +192,7 @@ o64 sysret
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
global ASM_PFX(CallRing3)
|
global ASM_PFX(CallRing3)
|
||||||
ASM_PFX(CallRing3):
|
ASM_PFX(CallRing3):
|
||||||
|
cli
|
||||||
; Save input Arguments.
|
; Save input Arguments.
|
||||||
push r12
|
push r12
|
||||||
mov r12, rcx
|
mov r12, rcx
|
||||||
@ -217,6 +225,8 @@ ASM_PFX(CallRing3):
|
|||||||
mov rsp, [ASM_PFX(gRing3CallStackTop)]
|
mov rsp, [ASM_PFX(gRing3CallStackTop)]
|
||||||
mov rbp, rsp
|
mov rbp, rsp
|
||||||
|
|
||||||
|
sti
|
||||||
|
|
||||||
; Pass control to user image
|
; Pass control to user image
|
||||||
o64 sysret
|
o64 sysret
|
||||||
|
|
||||||
@ -224,6 +234,7 @@ coreReturnAddress:
|
|||||||
mov rsp, [ASM_PFX(CoreRsp)]
|
mov rsp, [ASM_PFX(CoreRsp)]
|
||||||
mov rbp, [ASM_PFX(CoreRbp)]
|
mov rbp, [ASM_PFX(CoreRbp)]
|
||||||
mov rax, rdx
|
mov rax, rdx
|
||||||
|
sti
|
||||||
ret
|
ret
|
||||||
|
|
||||||
SECTION .data
|
SECTION .data
|
||||||
|
@ -207,6 +207,12 @@ HasErrorCode:
|
|||||||
mov rax, gs
|
mov rax, gs
|
||||||
push rax
|
push rax
|
||||||
|
|
||||||
|
mov rax, ss
|
||||||
|
mov ds, rax
|
||||||
|
mov es, rax
|
||||||
|
mov fs, rax
|
||||||
|
mov gs, rax
|
||||||
|
|
||||||
mov [rbp + 8], rcx ; save vector number
|
mov [rbp + 8], rcx ; save vector number
|
||||||
|
|
||||||
;; UINT64 Rip;
|
;; UINT64 Rip;
|
||||||
@ -356,7 +362,6 @@ DrFinish:
|
|||||||
incsspq rax ; SSP should be 0xFC0 now
|
incsspq rax ; SSP should be 0xFC0 now
|
||||||
CetDone:
|
CetDone:
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
cli
|
cli
|
||||||
;; UINT64 ExceptionData;
|
;; UINT64 ExceptionData;
|
||||||
add rsp, 8
|
add rsp, 8
|
||||||
@ -398,10 +403,9 @@ CetDone:
|
|||||||
|
|
||||||
;; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
|
;; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
|
||||||
pop rax
|
pop rax
|
||||||
; mov gs, rax ; not for gs
|
mov gs, rax
|
||||||
pop rax
|
pop rax
|
||||||
; mov fs, rax ; not for fs
|
mov fs, rax
|
||||||
; (X64 will not use fs and gs, so we do not restore it)
|
|
||||||
pop rax
|
pop rax
|
||||||
mov es, rax
|
mov es, rax
|
||||||
pop rax
|
pop rax
|
||||||
@ -428,6 +432,16 @@ CetDone:
|
|||||||
pop r14
|
pop r14
|
||||||
pop r15
|
pop r15
|
||||||
|
|
||||||
|
; Check whether Ring3 process was interrupted.
|
||||||
|
push rax
|
||||||
|
mov rax, ss
|
||||||
|
push rcx
|
||||||
|
mov rcx, ds
|
||||||
|
cmp rax, rcx
|
||||||
|
jne ReturnToRing3
|
||||||
|
pop rcx
|
||||||
|
pop rax
|
||||||
|
|
||||||
mov rsp, rbp
|
mov rsp, rbp
|
||||||
pop rbp
|
pop rbp
|
||||||
add rsp, 16
|
add rsp, 16
|
||||||
@ -454,6 +468,13 @@ DoReturn:
|
|||||||
retfq
|
retfq
|
||||||
DoIret:
|
DoIret:
|
||||||
iretq
|
iretq
|
||||||
|
ReturnToRing3:
|
||||||
|
pop rcx
|
||||||
|
pop rax
|
||||||
|
mov rsp, rbp
|
||||||
|
pop rbp
|
||||||
|
add rsp, 16
|
||||||
|
iretq
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------------
|
||||||
; GetTemplateAddressMap (&AddressMap);
|
; GetTemplateAddressMap (&AddressMap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user