nx_emu_sparc64_main.nx source
↩ module page · 18 lines · 724 B
1// nx_emu_sparc64_main.nx -- CLI for NX-EMU sparc64: load + run a static
2// SPARC V9 ELF. Usage: nx_emu_sparc64 <prog.elf> (exit code = guest exit).
3// Mirror of nx_emu_rv64_main / nx_emu_arm64_main: Nishi CARRIES sparc64
4// execution on its own interpreter -- NO qemu (qemu-sparc64 = benchmark
5// oracle that must agree). license_tier: ORIGINAL
6
7import "nx_emu_sparc64.nx"
8import "nx_syscalls_x86_64.nx"
9
10func main(argc: i64, argv: *i64) -> i64 {
11 if argc < 2 { return 200 }
12 let path: *u8 = argv[1] as *u8
13 let lenbox: *i64 = sys_mmap(16) as *i64
14 let buf: *u8 = sys_read_file_x86_64(path, lenbox)
15 if (buf as i64) == 0 { return 201 }
16 let r: i64 = emu_sparc64_load_elf(buf, lenbox[0])
17 return r
18}