; socktest.asm -- call the firmware's socket() wrapper and return. ; ; Isolates the first call tftp_open makes. Run with rdebug `jump` from the ; remote-debug process (or from a create_process child) to see whether the ; socket API is usable in that context. ; ; socket = bit 3F5C9A00h (Ghidra 07EB9340) ; socket(domain, type, protocol) = socket(2, 2, 0) ; ; Evidence cells (32-bit, bit addresses): ; 01874000 stage (1 entered, 2 socket returned) ; 01874020 socket() return (fd, or a negative errno) ; 01874200 entry SP ; 01874220 entry A14 .text _start: setf 16, 0, 0 setf 32, 0, 1 mmtm sp, a0,a1,a2,a3,a4,a5,a6,a7 move sp, @01874200h, 1 move a14, @01874220h, 1 movi 1, a0, L move a0, @01874000h, 1 movi 01873800h, a14, L movi 0, a0, L move a0, *a14+, 1 ; arg2 = protocol movi 2, a0, L move a0, *a14+, 1 ; arg1 = SOCK_DGRAM movi 2, a0, L move a0, *a14+, 1 ; arg0 = AF_INET calla 3F5C9A00h ; socket move @01874200h, sp, 1 move @01874220h, a14, 1 setf 16, 0, 0 setf 32, 0, 1 move a8, @01874020h, 1 movi 2, a0, L move a0, @01874000h, 1 mmfm sp, a0,a1,a2,a3,a4,a5,a6,a7 movi 0, a8, L rets .end