Add small constants set, exit() and tests entry/exit
This commit is contained in:
@@ -1 +1,23 @@
|
||||
section .rodata
|
||||
; syscall
|
||||
NR_read equ 0
|
||||
NR_write equ 1
|
||||
NR_exit equ 60
|
||||
|
||||
; file descriptors
|
||||
FD_stdin equ 0
|
||||
FD_stdout equ 1
|
||||
FD_stderr equ 2
|
||||
|
||||
; ASCII
|
||||
EOS equ 0
|
||||
TAB equ 9
|
||||
NL equ 10
|
||||
DQUO equ 34
|
||||
|
||||
; Sizes
|
||||
RBP_OFFSET_CALLER equ 16
|
||||
SIZE_QWORD equ 8
|
||||
SIZE_DWORD equ 4
|
||||
SIZE_WORD equ 2
|
||||
SIZE_BYTE equ 1
|
||||
|
@@ -1 +1,9 @@
|
||||
%include "src/constants.asm"
|
||||
|
||||
section .text
|
||||
global exit
|
||||
|
||||
;----- exit(exit_code) -----;
|
||||
exit:
|
||||
mov rax, NR_exit
|
||||
syscall
|
||||
|
@@ -1 +1,18 @@
|
||||
%include "src/constants.asm"
|
||||
|
||||
; core.asm
|
||||
extern exit
|
||||
; console.asm
|
||||
; string.asm
|
||||
; convert.asm
|
||||
|
||||
section .text
|
||||
global _start
|
||||
_start:
|
||||
push rbp
|
||||
mov rbp, rsp
|
||||
sub rsp, SIZE_QWORD
|
||||
|
||||
leave
|
||||
mov rdi, 0
|
||||
call exit
|
||||
|
Reference in New Issue
Block a user