mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
Switch push/pop_all macros from push/pop to mov
This commit is contained in:
@@ -63,6 +63,6 @@ _start:
|
|||||||
syscall ; int 0xee
|
syscall ; int 0xee
|
||||||
jmp .preloop
|
jmp .preloop
|
||||||
|
|
||||||
.doexit
|
.doexit:
|
||||||
mov rax, 9 ; EXIT syscall
|
mov rax, 9 ; EXIT syscall
|
||||||
syscall
|
syscall
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
extern isr_handler
|
extern isr_handler
|
||||||
global isr_handler_prelude
|
global isr_handler_prelude
|
||||||
isr_handler_prelude:
|
isr_handler_prelude:
|
||||||
push_all_and_segments
|
push_all
|
||||||
check_swap_gs
|
check_swap_gs
|
||||||
|
|
||||||
mov rdi, rsp
|
mov rdi, rsp
|
||||||
@@ -15,7 +15,7 @@ isr_handler_prelude:
|
|||||||
extern irq_handler
|
extern irq_handler
|
||||||
global irq_handler_prelude
|
global irq_handler_prelude
|
||||||
irq_handler_prelude:
|
irq_handler_prelude:
|
||||||
push_all_and_segments
|
push_all
|
||||||
check_swap_gs
|
check_swap_gs
|
||||||
|
|
||||||
mov rdi, rsp
|
mov rdi, rsp
|
||||||
@@ -27,7 +27,7 @@ irq_handler_prelude:
|
|||||||
global isr_handler_return
|
global isr_handler_return
|
||||||
isr_handler_return:
|
isr_handler_return:
|
||||||
check_swap_gs
|
check_swap_gs
|
||||||
pop_all_and_segments
|
pop_all
|
||||||
|
|
||||||
add rsp, 16 ; because the ISRs added err/num
|
add rsp, 16 ; because the ISRs added err/num
|
||||||
iretq
|
iretq
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ ramdisk_process_loader:
|
|||||||
mov fs, ax
|
mov fs, ax
|
||||||
mov gs, ax
|
mov gs, ax
|
||||||
|
|
||||||
pop_all_and_segments
|
pop_all
|
||||||
add rsp, 16 ; because the ISRs add err/num
|
add rsp, 16 ; because the ISRs add err/num
|
||||||
iretq
|
iretq
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,43 @@
|
|||||||
%macro push_all_and_segments 0
|
%macro push_all 0
|
||||||
; ss ; rsp + a8
|
sub rsp, 0x78
|
||||||
; rsp ; rsp + a0
|
|
||||||
; rflags ; rsp + 98
|
|
||||||
; cs ; rsp + 90
|
|
||||||
; rip ; rsp + 88
|
|
||||||
; error ; rsp + 80
|
|
||||||
; vector ; rsp + 78
|
|
||||||
|
|
||||||
push rax ; rsp + 70
|
mov [rsp + 0x70], rax
|
||||||
push rcx ; rsp + 68
|
mov [rsp + 0x68], rcx
|
||||||
push rdx ; rsp + 60
|
mov [rsp + 0x60], rdx
|
||||||
push rbx ; rsp + 58
|
mov [rsp + 0x58], rbx
|
||||||
push rbp ; rsp + 50
|
mov [rsp + 0x50], rbp
|
||||||
push rsi ; rsp + 48
|
mov [rsp + 0x48], rsi
|
||||||
push rdi ; rsp + 40
|
mov [rsp + 0x40], rdi
|
||||||
|
|
||||||
push r8 ; rsp + 38
|
mov [rsp + 0x38], r8
|
||||||
push r9 ; rsp + 30
|
mov [rsp + 0x30], r9
|
||||||
push r10 ; rsp + 28
|
mov [rsp + 0x28], r10
|
||||||
push r11 ; rsp + 20
|
mov [rsp + 0x20], r11
|
||||||
push r12 ; rsp + 18
|
mov [rsp + 0x18], r12
|
||||||
push r13 ; rsp + 10
|
mov [rsp + 0x10], r13
|
||||||
push r14 ; rsp + 08
|
mov [rsp + 0x08], r14
|
||||||
push r15 ; rsp + 00
|
mov [rsp + 0x00], r15
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro pop_all_and_segments 0
|
%macro pop_all 0
|
||||||
pop r15
|
mov rax, [rsp + 0x70]
|
||||||
pop r14
|
mov rcx, [rsp + 0x68]
|
||||||
pop r13
|
mov rdx, [rsp + 0x60]
|
||||||
pop r12
|
mov rbx, [rsp + 0x58]
|
||||||
pop r11
|
mov rbp, [rsp + 0x50]
|
||||||
pop r10
|
mov rsi, [rsp + 0x48]
|
||||||
pop r9
|
mov rdi, [rsp + 0x40]
|
||||||
pop r8
|
|
||||||
|
|
||||||
pop rdi
|
mov r8, [rsp + 0x38]
|
||||||
pop rsi
|
mov r9, [rsp + 0x30]
|
||||||
pop rbp
|
mov r10, [rsp + 0x28]
|
||||||
pop rbx
|
mov r11, [rsp + 0x20]
|
||||||
pop rdx
|
mov r12, [rsp + 0x18]
|
||||||
pop rcx
|
mov r13, [rsp + 0x10]
|
||||||
pop rax
|
mov r14, [rsp + 0x08]
|
||||||
|
mov r15, [rsp + 0x00]
|
||||||
|
|
||||||
|
add rsp, 0x78
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro check_swap_gs 0
|
%macro check_swap_gs 0
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ syscall_handler_prelude:
|
|||||||
push rcx ; user rip
|
push rcx ; user rip
|
||||||
push 0 ; bogus interrupt
|
push 0 ; bogus interrupt
|
||||||
push 0 ; bogus errorcode
|
push 0 ; bogus errorcode
|
||||||
push_all_and_segments
|
push_all
|
||||||
|
|
||||||
inc qword [rel __counter_syscall_enter]
|
inc qword [rel __counter_syscall_enter]
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ syscall_handler_prelude:
|
|||||||
|
|
||||||
swapgs
|
swapgs
|
||||||
|
|
||||||
pop_all_and_segments
|
pop_all
|
||||||
add rsp, 16 ; ignore bogus interrupt / error
|
add rsp, 16 ; ignore bogus interrupt / error
|
||||||
pop rcx ; user rip
|
pop rcx ; user rip
|
||||||
add rsp, 32 ; ignore cs, flags, rsp, ss
|
add rsp, 32 ; ignore cs, flags, rsp, ss
|
||||||
|
|||||||
Reference in New Issue
Block a user