Implement cold start

This commit is contained in:
2026-02-27 16:20:11 +00:00
parent 2fafd02e28
commit ca6ac0f9bf

View File

@@ -1651,6 +1651,10 @@
;; => 0x28 bytes
;; Cold start
(data (i32.const 0x0ba0) "\78\0b\00\00") ;; QUIT
;; The trampoline is a workaround for WebAssembly's lack of indirect
;; jumps and code addresses. Instead of jumping into the next
;; codeword, NEXT sets the $fn global to the function index of the
@@ -1669,7 +1673,6 @@
(func (export "reset")
i32.const 0xf000 global.set $sp ;; Set the stack pointer
;; i32.const 0x???? global.set $ip ;; Set the IP to point at QUIT
;; call $next
;; call $trampoline
))
i32.const 0x0ba0 global.set $ip ;; Set the IP to the cold start
call $next
call $trampoline))