diff options
author | Ratakor <ratakor@disroot.org> | 2023-11-02 14:30:02 +0100 |
---|---|---|
committer | Ratakor <ratakor@disroot.org> | 2023-11-02 14:30:02 +0100 |
commit | d713d0fa9d6a3d6241cdcfec9149b8abaf9c5c2a (patch) | |
tree | 516d12a7ae8baad9ebdbc8971e78ed82f372adba | |
parent | 3d16629a0533b2a78f6e0692c51c5425153ea342 (diff) |
-rw-r--r-- | src/bf.s | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -14,7 +14,8 @@ default rel %define SYS_exit 0x3c section .rodata - max_codesize equ 32768 ; must be an integral multiple of the page size + ; max_codesize must be an integral multiple of the page size + max_codesize equ 528 * 4096 error_input_str db "usage: bf file.b", 0x0a error_input_str_len equ $ - error_input_str error_open_failed db "bf: failed to open file", 0x0a @@ -57,7 +58,7 @@ _start: mov rdx, 0x1 ; prot = PROT_READ mov rsi, max_codesize ; length xor rdi, rdi ; addr = 0 - mov rax, SYS_mmap ; no munmap because rbp is used until exit + mov rax, SYS_mmap ; no munmap because the file is used until exit syscall mov rbp, rax ; rbp = instructions @@ -69,6 +70,7 @@ _start: .main_loop: ; switch [instruction] + ; TODO: use a jump table instead .case1: cmp bl, '>' |