code wiki / (root) / nx_x86_64_loadstore_test.nx

nx_x86_64_loadstore_test.nx

buildroot/runtime/nx_x86_64_loadstore_test.nx

3765 B100 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic x86
docsdependenciesstructsconstsfunctions

about

nx_x86_64_loadstore_test.nx -- session 2 smoke for load/store/GEP. Hand-builds a program that: 1. allocates a 32-byte stack buffer via subq $32, %rsp 2. stores a sequence of bytes into the buffer via different store widths (movb / movw / movl / movq) 3. loads them back via the corresponding load widths with the expected sign-extension behaviour 4. computes an expected output via a couple of adds, then writes the result via sys_write Test value: write the byte 'X' (0x58) to stdout, then exit 0. - movb $0x58, -1(%rbp) ; store byte - movzbq -1(%rbp), %rsi ; load unsigned byte into address-form We adapt: build a small in-stack buffer "X\n" and write 2 bytes.

dependencies 3 imports · 0 importers

syscalls.nx nx_outbuf.nx nx_x86_64.nx nx_x86_64_loadstore_test.nx

imports: syscalls.nxnx_outbuf.nxnx_x86_64.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main out_new sys_mmap out_str out_char x86_emit_function_start x86_emit_section_text out_str ↻ out_str ↻ out_char ↻ x86_emit_label out_str ↻ out_char ↻ x86_emit_movabsq out_str ↻ out_i64 out_char ↻ sys_mmap ↻ out_char ↻ x86_emit_syscall out_str ↻ x86_emit_function_end out_str ↻ out_char ↻ x86_emit_prologue x86_round_up_16 out_str ↻ out_i64 ↻ x86_emit_store_byte x86_reg_low8 out_str ↻ x86_emit_mem_disp out_i64 ↻ out_char ↻ out_str ↻ out_char ↻ x86_emit_load_byte_unsigne out_str ↻ x86_emit_mem_disp ↻ out_char ↻

structs

none

consts

none

functions

21func main() -> i64