mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
Implement fast syscall/sysret for sytem calls
This commit is contained in:
@@ -8,17 +8,17 @@ _start:
|
||||
xor rbp, rbp ; Sentinel rbp
|
||||
|
||||
mov rax, 5 ; GETPID syscall
|
||||
int 0xee
|
||||
syscall ; int 0xee
|
||||
mov [mypid], rax
|
||||
|
||||
mov rax, 8 ; FORK syscall
|
||||
int 0xee
|
||||
syscall ; int 0xee
|
||||
mov [mychild], rax
|
||||
|
||||
mov r12, [mypid]
|
||||
mov r13, [mychild]
|
||||
mov rax, 1 ; DEBUG syscall
|
||||
int 0xee
|
||||
syscall ; int 0xee
|
||||
|
||||
cmp r12, 1
|
||||
je .dosend
|
||||
@@ -32,7 +32,7 @@ _start:
|
||||
mov rax, 1 ; MESSAGE syscall
|
||||
;mov rax, 0 ; NOOP syscall
|
||||
;syscall
|
||||
int 0xee
|
||||
syscall ; int 0xee
|
||||
|
||||
inc r11
|
||||
cmp r11, 2
|
||||
@@ -41,7 +41,7 @@ _start:
|
||||
|
||||
mov rax, 4 ; SLEEP syscall
|
||||
; syscall
|
||||
int 0xee
|
||||
syscall ; int 0xee
|
||||
|
||||
add rbx, 20
|
||||
|
||||
@@ -51,11 +51,11 @@ _start:
|
||||
.dosend:
|
||||
mov rax, 6 ; SEND syscall
|
||||
mov rdi, 2 ; target is pid 2
|
||||
int 0xee
|
||||
syscall ; int 0xee
|
||||
jmp .preloop
|
||||
|
||||
.doreceive:
|
||||
mov rax, 7 ; RECEIVE syscall
|
||||
mov rdi, 1 ; source is pid 2
|
||||
int 0xee
|
||||
syscall ; int 0xee
|
||||
jmp .preloop
|
||||
|
||||
Reference in New Issue
Block a user