-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paths.asm
More file actions
34 lines (33 loc) · 714 Bytes
/
s.asm
File metadata and controls
34 lines (33 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
; BareMetal Linux syscall translation
; x86-64 passes syscall arguments as follows:
; SC RETURN ARG0 ARG1 ARG2 ARG3 ARG4 ARG5
; RAX RAX RDI RSI RDX R10 R8 R9
; -----------------------------------------------------------------------------
; b_k -- BareMetal Linux syscall API for k
%include 'api/libBareMetal.asm'
global b_k
extern b_read
b_k:
cmp ax, 0
je b_k_read_stdin
cmp ax, 1
je b_k_write_stdout
cmp ax, 60
je b_k_exit
mov rax,$-1
ret
b_k_read_stdin:
call b_read
ret
b_k_write_stdout:
push rcx
mov rcx, rdx
call [0x00100018] ; b_output
pop rcx
mov rax, rdx
ret
b_k_exit:
mov rcx, SHUTDOWN
call [b_system]
ret
;-----------------------------------------------------------------------------