summaryrefslogtreecommitdiff
path: root/asm/lisp/test.pit
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-10-23 20:47:43 -0400
committerLLLL Colonq <llll@colonq>2026-10-23 20:48:45 -0400
commitdb58f43065c3b397754bb9efcb4a7376b2538131 (patch)
tree81452d262163237e82821e0eb5e518e581fa9276 /asm/lisp/test.pit
parent62ab8e0b42a57bd794941f030b4c3140d6f7c744 (diff)
pit: Add tests, fix binding bugHEADmaster
Diffstat (limited to 'asm/lisp/test.pit')
-rw-r--r--asm/lisp/test.pit29
1 files changed, 29 insertions, 0 deletions
diff --git a/asm/lisp/test.pit b/asm/lisp/test.pit
new file mode 100644
index 0000000..cafa8f4
--- /dev/null
+++ b/asm/lisp/test.pit
@@ -0,0 +1,29 @@
+(let ( (elf (elf/new!))
+ (entrypoint 0x696000)
+ (toff 0x1000)
+ (phdroff 0x2000))
+ (elf/write-bytes! elf toff
+ '( 0xb8 0x3c 0x00 0x00 0x00 ;; mov rax, 60
+ 0xbf 0x2a 0x00 0x00 0x00 ;; mov rdi, 42
+ 0x0f 0x05 ;; syscall
+ ))
+ (elf/write-program-header! elf (+ phdroff elf/64_PROGRAM_HEADER_SIZE)
+ :type elf/PROGRAM_HEADER_TYPE_LOAD
+ :offset toff
+ :virtual-addr entrypoint
+ :file-size 0x100
+ :mem-size 0x100
+ :flags (bitwise/or elf/PROGRAM_HEADER_FLAG_R elf/PROGRAM_HEADER_FLAG_X)
+ )
+ (elf/write-header! elf
+ :type elf/TYPE_EXEC
+ :machine elf/MACHINE_AMD64
+ :program-header-offset phdroff
+ :program-header-entry-size elf/64_PROGRAM_HEADER_SIZE
+ :program-header-entries 2
+ :section-header-offset 0
+ :section-header-entry-size elf/64_SECTION_HEADER_SIZE
+ :section-header-entries 0
+ :entry entrypoint
+ )
+ (elf/spit! "test.elf" elf))