From d99cd40d4c8f513e46e94ec553011f65866c071c Mon Sep 17 00:00:00 2001 From: kitty Date: Fri, 13 Feb 2026 14:26:37 +1100 Subject: move HERE to .bss proper i don't know how to mark the heap as executable. im not entirely sure it's possible. we can't increase its size with this but it Works. compiling mode still doesn't work though... the code in `test` runs in interpreting mode. --- jefs.s | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'jefs.s') diff --git a/jefs.s b/jefs.s index 22e1a7e..d0238ea 100644 --- a/jefs.s +++ b/jefs.s @@ -60,28 +60,32 @@ %assign __NR_exit 60 ;; }}} -section .bss +section .bss exec wstack_b: resq 2047 wstack: resq 1 +umem: resb 0x9c400 +umem_e: + section .text global _start _start: + ; mov r11, 0x0409040904090409 ; init mov r14, wstack ; point SP to top ; EXPAND BRK - xor rdi, rdi ; brk syscall called with 0 gives the current brk - mov rax, __NR_brk - syscall - mov qword [here], rax - mov qword [h0], rax - - add rax, 0x9c400 ; 640kb, entirely arbitrary - mov rdi, rax - mov rax, __NR_brk - syscall ; if this fails, have fun - mov qword [hend], rax + ; xor rdi, rdi ; brk syscall called with 0 gives the current brk + ; mov rax, __NR_brk + ; syscall + ; mov qword [here], rax + ; mov qword [h0], rax + ; + ; add rax, 0x9c400 ; 640kb, entirely arbitrary + ; mov rdi, rax + ; mov rax, __NR_brk + ; syscall ; if this fails, have fun + ; mov qword [hend], rax call interpret mov rdi, 0 @@ -298,13 +302,13 @@ defword "compile,", compile_comma, 0 mov r12, [here] ; compile mov r11, [cfa] - mov word [r12], 0x94bb + mov word [r12], 0xbb49 add r12, 2 mov qword [r12], r11 add r12, 8 ; compile call r11 - mov word [r12], 0x41ff + mov word [r12], 0xff41 add r12, 2 mov byte [r12], 0xd3 inc r12 @@ -406,13 +410,13 @@ defword "lit", lit, immediate_mask ; C: ( n -- ) ( -- n ) pspop r11 mov r12, [here] - mov dword [r12], 0x4d8d76f8 + mov dword [r12], 0xf8768d4d add r12, 4 - mov word [r12], 0x49bb + mov word [r12], 0xbb49 add r12, 2 mov qword [r12], r11 add r12, 8 - mov word [r12], 0x4d89 + mov word [r12], 0x894d add r12, 2 mov byte [r12], 0x1e inc r12 @@ -573,9 +577,9 @@ defword "HEREDUMP", heredump, 0 defvar ">in", to_in, 0, 0 defvar "state", state, 0, interpreting -defvar "here", here, 0, 0 -defvar "h0", h0, 0, 0 ; beginning of user memory area -defvar "hend", hend, 0, 0 ; ending of user memory area +defvar "here", here, 0, umem +defvar "h0", h0, 0, umem ; beginning of user memory area +defvar "hend", hend, 0, umem_e ; ending of user memory area defvar "latest", latest, 0, lfa_latest initfile: -- cgit v1.2.3