diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-09-07 23:04:15 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-09-07 23:04:15 -0700 |
| commit | 06ce6d8b66db0a274e36d05f8a9b470455b84728 (patch) | |
| tree | 5bc85c89c0e27621f268622dd6026a62219b7ac8 /hex.e | |
| parent | 92b8da05981328c2d4b106d9de008625b6895620 (diff) | |
add tracing of the latest output point in packstring
this is necessary because packstring isn't implemented in terms of pack8, unlike packalign also add a bunch more magic comments to hex.e, which would be in the wrong place without the semantic change Force-Push: yes Change-Id: I422b8d00a07568be5113e005fddaeab82f5ca731
Diffstat (limited to 'hex.e')
| -rw-r--r-- | hex.e | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hex.e b/hex.e index 963b82a..ead2dc4 100644 --- a/hex.e +++ b/hex.e @@ -17,6 +17,7 @@ ~ (buffer start, output point -- buffer start, output point) : output-start-routine + ~ : This is the start routine, the first thing that runs when the ELF loads. current-offset L!' cold-start ~ The basic registers preserved across syscalls are rbx, rsp, rbp. ~ To avoid redundant moves, we store the buffer pointer in rbx just once, @@ -110,6 +111,7 @@ ~ (output memory start, current output point ~ -- output memory start, current output point) : output-read-byte + ~ : This is the routine named "read-byte". current-offset L!' read-byte ~ We use self-xor as a concise way to set registers to zero. :rax :rax xor-reg64-reg64 ~ syscall number for sys-read @@ -129,6 +131,7 @@ ~ (output memory start, current output point ~ -- output memory start, current output point) : output-decode-nibble + ~ : This is the routine named "decode-nibble". current-offset L!' decode-nibble 0x30 :rax sub-reg64-imm8 ~ ASCII zero @@ -164,6 +167,7 @@ ~ (output memory start, current output point ~ -- output memory start, current output point) : output-exit + ~ : This is the routine named "exit". current-offset L!' exit 60 :rax mov-reg64-imm32 ~ syscall number for sys-exit 0 :rdi mov-reg64-imm32 ~ exit code @@ -177,6 +181,7 @@ ~ (output memory start, current output point ~ -- output memory start, current output point) : output-error-handlers + ~ : These are the error handler routines. current-offset L!' invalid-byte L@' origin L@' invalid-byte-message + :rsi mov-reg64-imm64 L@' invalid-byte-message-size :rdx mov-reg64-imm64 @@ -206,6 +211,7 @@ ~ (output memory start, current output point ~ -- output memory start, current output point) : output-messages + ~ : These are the message strings. current-offset dup L!' invalid-byte-message 3unroll s" Invalid byte." packstring current-offset 4 roll - L!' invalid-byte-message-size @@ -233,6 +239,8 @@ output-decode-nibble output-error-handlers output-messages + ~ : This is a buffer that's zero in the ELF, but is written to at runtime + ~ : and used as a variable. current-offset L!' buffer 0 pack64 current-offset L!' total-size ; |