summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--core.e17
-rw-r--r--log-load.e6
-rw-r--r--transform.e4
3 files changed, 21 insertions, 6 deletions
diff --git a/core.e b/core.e
index 0390812..8c14948 100644
--- a/core.e
+++ b/core.e
@@ -1180,3 +1180,20 @@ here !
 ~ (input point, alignment byte count -- input point)
 : unpackalign align-size ;
 
+
+~ Development utilities
+~ ~~~~~~~~~~~~~~~~~~~~~
+
+~   This peforms the "hlt" instruction (Intel's mnemomic, short for "halt"),
+~ which will cause the program to exit with a segmentation fault. If you're
+~ running under a debugger, this is a convenient way to get execution to stop
+~ at a certain point.
+~
+~   It's called "crash" rather than "hlt" to distinguish it from the word
+~ which outputs the instruction as machine code.
+
+: crash
+  [ here @
+    hlt
+    here ! ] ;asm
+
diff --git a/log-load.e b/log-load.e
index 100211c..2c82d9f 100644
--- a/log-load.e
+++ b/log-load.e
@@ -263,16 +263,14 @@
   3roll swap log-load-create
   ~ (address for new variable word, log address)
 
-  log-load-here 3unroll
+  log-load-here swap 3unroll
   ~ (log address, address for new variable word, here)
 
   dup @
   ~ (log address, address for new variable word, here, output point)
   dup 8 + pack64
 
-  3roll
-  :rax
-  mov-reg64-imm64
+  3roll :rax mov-reg64-imm64
   ~ (log address, here, output point)
 
   :rax push-reg64
diff --git a/transform.e b/transform.e
index 0c39489..7952152 100644
--- a/transform.e
+++ b/transform.e
@@ -418,8 +418,8 @@ allocate-transform-state s" transform-state" variable
 
   here @ dup
   ~ (self execution token, output point)
-  dup 8 + pack64
-  swap :rax mov-reg64-imm64
+  dup 8 + host-address-space-to-target pack64
+  swap host-address-space-to-target :rax mov-reg64-imm64
   ~ (output point)
   :rax push-reg64
   pack-next