mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
context: irq
This commit is contained in:
@@ -27,6 +27,7 @@ arch_context_switch:
|
||||
pop r15
|
||||
pop rdi
|
||||
pop rsi
|
||||
add rsp,8 ; remove irq
|
||||
pop rbp
|
||||
add rsp,8 ; remove error code
|
||||
|
||||
@@ -60,6 +61,7 @@ arch_context_saveandcall:
|
||||
push r11 ; return address
|
||||
sub rsp, 8 ; error code
|
||||
push rbp
|
||||
sub rsp, 8 ; irq
|
||||
push rsi
|
||||
push rdi
|
||||
push r15
|
||||
|
||||
@@ -10,6 +10,7 @@ isr_%+ i:
|
||||
|
||||
push rbp ; this push is here to free a register
|
||||
mov rbp, i
|
||||
|
||||
jmp isr_common
|
||||
%assign i i + 1
|
||||
%endrep
|
||||
@@ -21,6 +22,7 @@ isr_common:
|
||||
swapgs
|
||||
.notneeded1:
|
||||
; push context
|
||||
push rbp ; push irq num
|
||||
push rsi
|
||||
push rdi
|
||||
push r15
|
||||
@@ -80,6 +82,7 @@ isr_common:
|
||||
pop r15
|
||||
pop rdi
|
||||
pop rsi
|
||||
add rsp,8 ; remove irq
|
||||
pop rbp
|
||||
add rsp,8 ; remove error code
|
||||
|
||||
|
||||
@@ -221,6 +221,7 @@ arch_syscall_entry:
|
||||
push qword rcx ; save return RIP
|
||||
push qword 0 ; error
|
||||
push rbp
|
||||
push qword 0 ; irq
|
||||
push rsi
|
||||
push rdi
|
||||
push r15
|
||||
@@ -315,6 +316,7 @@ arch_syscall_entry:
|
||||
pop r15
|
||||
pop rdi
|
||||
pop rsi
|
||||
add rsp, 8 ; remove irq
|
||||
pop rbp
|
||||
add rsp, 8 ; remove error code
|
||||
pop rcx
|
||||
|
||||
@@ -28,6 +28,7 @@ typedef struct {
|
||||
uint64_t r15;
|
||||
uint64_t rdi;
|
||||
uint64_t rsi;
|
||||
uint64_t irq;
|
||||
uint64_t rbp;
|
||||
uint64_t error;
|
||||
uint64_t rip;
|
||||
@@ -67,6 +68,7 @@ typedef struct {
|
||||
#define CTX_IP(x) (x)->rip
|
||||
#define CTX_RET(x) (x)->rax
|
||||
#define CTX_ERRNO(x) (x)->rdx
|
||||
#define CTX_TRAP_ADDR(x) (x)->cr2
|
||||
#define CTX_ARG0(x) (x)->rdi
|
||||
#define CTX_ARG1(x) (x)->rsi
|
||||
#define CTX_ARG2(x) (x)->rdx
|
||||
|
||||
Reference in New Issue
Block a user