Syscall parameters (1)
This commit is contained in:
parent
59318483f9
commit
999f41f3c2
|
@ -27,10 +27,9 @@
|
||||||
%include "kaleid/kernel/ke/cpuf.inc"
|
%include "kaleid/kernel/ke/cpuf.inc"
|
||||||
|
|
||||||
global KeLoadIDT
|
global KeLoadIDT
|
||||||
|
|
||||||
extern _KeIdtPtr
|
extern _KeIdtPtr
|
||||||
extern _KeHandleISR
|
extern _KeHandleISR
|
||||||
extern _KeSyscallHandler
|
extern syscallPreHandler
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Loads the IDT
|
;; Loads the IDT
|
||||||
|
@ -78,73 +77,6 @@ Die:
|
||||||
hlt
|
hlt
|
||||||
jmp Die
|
jmp Die
|
||||||
|
|
||||||
;;
|
|
||||||
;; System call pre-handler
|
|
||||||
;;
|
|
||||||
syscallPreHandler:
|
|
||||||
push r15
|
|
||||||
push r14
|
|
||||||
push r13
|
|
||||||
push r12
|
|
||||||
push r11
|
|
||||||
push r10
|
|
||||||
push r9
|
|
||||||
push r8
|
|
||||||
push rbp
|
|
||||||
push 0
|
|
||||||
push rsi
|
|
||||||
push rdx
|
|
||||||
push rcx
|
|
||||||
push rbx
|
|
||||||
push rax
|
|
||||||
mov rax, cr8
|
|
||||||
push rax
|
|
||||||
mov rax, cr4
|
|
||||||
push rax
|
|
||||||
mov rax, cr3
|
|
||||||
push rax
|
|
||||||
mov rax, cr2
|
|
||||||
push rax
|
|
||||||
mov rax, cr0
|
|
||||||
push rax
|
|
||||||
mov rcx, 0xC0000080
|
|
||||||
rdmsr
|
|
||||||
push rax
|
|
||||||
|
|
||||||
; Call the C routine to dispatch interrupts
|
|
||||||
cld ; DF must be cleared by the caller
|
|
||||||
mov rsi, rsp ; First argument points to the processor state
|
|
||||||
mov rbp, 0 ; Terminate stack traces here
|
|
||||||
|
|
||||||
call _KeSyscallHandler
|
|
||||||
|
|
||||||
; pop the control registers
|
|
||||||
add rsp, 48
|
|
||||||
; pop registers except return value
|
|
||||||
pop rbx
|
|
||||||
pop rbx ; 2x rbx to discard rax
|
|
||||||
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 the error code and interrupt id
|
|
||||||
add rsp, 16
|
|
||||||
|
|
||||||
iretq
|
|
||||||
|
|
||||||
Die2:
|
|
||||||
hlt
|
|
||||||
jmp Die
|
|
||||||
|
|
||||||
;; Divide Error Fault
|
;; Divide Error Fault
|
||||||
IsrWithoutErrCode 0
|
IsrWithoutErrCode 0
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,72 @@
|
||||||
|
|
||||||
global KeJumpToUserspace
|
global KeJumpToUserspace
|
||||||
global KeSyscall
|
global KeSyscall
|
||||||
extern KernLog
|
global syscallPreHandler
|
||||||
|
extern _KeSyscallHandler
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; System call pre-handler
|
||||||
|
;;
|
||||||
|
syscallPreHandler:
|
||||||
|
push r15
|
||||||
|
push r14
|
||||||
|
push r13
|
||||||
|
push r12
|
||||||
|
push r11
|
||||||
|
push 0
|
||||||
|
push r9
|
||||||
|
push r8
|
||||||
|
push rbp
|
||||||
|
push 0
|
||||||
|
push 0
|
||||||
|
push 0
|
||||||
|
push rcx
|
||||||
|
push rbx
|
||||||
|
push rax
|
||||||
|
mov rax, cr8
|
||||||
|
push rax
|
||||||
|
mov rax, cr4
|
||||||
|
push rax
|
||||||
|
mov rax, cr3
|
||||||
|
push rax
|
||||||
|
mov rax, cr2
|
||||||
|
push rax
|
||||||
|
mov rax, cr0
|
||||||
|
push rax
|
||||||
|
mov rcx, 0xC0000080
|
||||||
|
rdmsr
|
||||||
|
push rax
|
||||||
|
|
||||||
|
; Call the C routine to dispatch interrupts
|
||||||
|
cld ; DF must be cleared by the caller
|
||||||
|
mov rsi, rsp ; First argument points to the processor state
|
||||||
|
mov rbp, 0 ; Terminate stack traces here
|
||||||
|
|
||||||
|
call _KeSyscallHandler
|
||||||
|
|
||||||
|
; pop the control registers
|
||||||
|
add rsp, 48
|
||||||
|
; pop registers except return value
|
||||||
|
pop rbx
|
||||||
|
pop rbx ; 2x rbx to discard rax
|
||||||
|
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 the error code and interrupt id
|
||||||
|
add rsp, 16
|
||||||
|
|
||||||
|
iretq
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; To get ring3 code running
|
;; To get ring3 code running
|
||||||
|
|
Loading…
Reference in New Issue