summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--readme.md2
-rw-r--r--sanctuary.s13
2 files changed, 8 insertions, 7 deletions
diff --git a/readme.md b/readme.md
index 3b3edfb..43b0da8 100644
--- a/readme.md
+++ b/readme.md
@@ -91,7 +91,7 @@ if no word was found. if a word was found,
its xt is returned along with the true flag.
### `grow ( u -- )`
-grows the user memory space by u bytes.
+grows, and marks as executable, the user memory space by u bytes.
### `here ( -- a )`
yields the address of the first available byte in user memory.
diff --git a/sanctuary.s b/sanctuary.s
index f1a7047..f9fc5f0 100644
--- a/sanctuary.s
+++ b/sanctuary.s
@@ -73,12 +73,6 @@ _start:
mov r11, init_brk
pspush r11
call grow
- ; TODO grow should call executable automatically
- mov r11, qword [dp0]
- pspush r11
- mov r11, init_brk
- pspush r11
- call executable
call interpret
call bye
@@ -97,6 +91,13 @@ defcode "grow", grow, 0
mov rax, __NR_brk
syscall
mov qword [dp$], rax
+ ; this marks the *whole user memory* as executable.
+ ; technically redundant but i think it's fine
+ mov r14, qword [dp0]
+ pspush r14
+ sub rax, r14
+ pspush rax
+ call executable
ret
defcode "executable", executable, 0