mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Clean ISR/Syscall handler
This commit is contained in:
parent
fe6299097f
commit
b3d83fac11
@ -58,39 +58,17 @@ isrPreHandler:
|
||||
rdmsr
|
||||
push rax
|
||||
|
||||
; Check if we are switching from user mode to supervisor mode
|
||||
;mov rax, [rsp + 152]
|
||||
;and rax, 0x3000
|
||||
;jz .SEnter
|
||||
|
||||
;swapgs ; XXX need TSS
|
||||
|
||||
.SEnter:
|
||||
; Increment mask count as we configure all interrupts to mask IF
|
||||
; automatically in the IDT
|
||||
inc qword [gs:8]
|
||||
; Call the C routine for dispatching an interrupt
|
||||
; Call the C routine to dispatch interrupts
|
||||
cld ; DF must be cleared by the caller
|
||||
mov rdi, rsp ; First argument points to the processor state
|
||||
mov rbp, 0 ; Terminate stack traces here
|
||||
|
||||
call _KeHandleISR
|
||||
|
||||
; decrement mask count
|
||||
dec qword [gs:8]
|
||||
|
||||
; check if we are switching from supervisor to user mode
|
||||
;mov rax, [rsp + 152]
|
||||
;and rax, 0x3000
|
||||
;jz .SExit
|
||||
|
||||
;swapgs ; XXX need TSS
|
||||
|
||||
.SExit:
|
||||
; pop the control registers
|
||||
add rsp, 48
|
||||
; pop registers
|
||||
popAll
|
||||
|
||||
; pop the error code and interrupt id
|
||||
add rsp, 16
|
||||
|
||||
@ -119,43 +97,20 @@ syscallPreHandler:
|
||||
rdmsr
|
||||
push rax
|
||||
|
||||
.SEnter:
|
||||
; Increment mask count as we configure all interrupts to mask IF
|
||||
; automatically in the IDT
|
||||
inc qword [gs:8]
|
||||
; Call the C routine for dispatching an interrupt
|
||||
; Call the C routine to dispatch interrupts
|
||||
cld ; DF must be cleared by the caller
|
||||
mov rdi, rsp ; First argument points to the processor state
|
||||
mov rbp, 0 ; Terminate stack traces here
|
||||
|
||||
call _KeSyscallHandler
|
||||
|
||||
; decrement mask count
|
||||
dec qword [gs:8]
|
||||
|
||||
.SExit:
|
||||
; pop the control registers
|
||||
add rsp, 48
|
||||
pop rbx ; do not overwrite rax, so double pop on rbx
|
||||
pop rbx
|
||||
pop rcx
|
||||
pop rdx
|
||||
pop rsi
|
||||
pop rdi
|
||||
pop rbp
|
||||
pop r8
|
||||
pop r9
|
||||
pop r10
|
||||
pop r11
|
||||
pop r12
|
||||
pop r13
|
||||
pop r14
|
||||
pop r15
|
||||
|
||||
; pop registers
|
||||
popAll
|
||||
; pop the error code and interrupt id
|
||||
add rsp, 16
|
||||
|
||||
iretq
|
||||
|
||||
Die2:
|
||||
hlt
|
||||
jmp Die
|
||||
|
Loading…
x
Reference in New Issue
Block a user