Skip to content

Instantly share code, notes, and snippets.

@grantseltzer
Created April 15, 2019 20:08
Show Gist options
  • Save grantseltzer/0327af2124ddab0f50682f158e23863c to your computer and use it in GitHub Desktop.
Save grantseltzer/0327af2124ddab0f50682f158e23863c to your computer and use it in GitHub Desktop.
TEXT runtime·res_search_trampoline(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ DI, BX // move DI into BX to preserve struct addr
MOVL 24(BX), R8 // arg 5 anslen
MOVQ 16(BX), CX // arg 4 answer
MOVL 12(BX), DX // arg 3 type
MOVL 8(BX), SI // arg 2 class
MOVQ 0(BX), DI // arg 1 name
CALL libc_res_search(SB)
XORL DX, DX
CMPQ AX, $-1
JNE ok
CALL libc_error(SB)
MOVLQSX (AX), DX // move return from libc_error into DX
XORL AX, AX // size on error is 0
ok:
MOVQ AX, 28(BX) // size
MOVQ DX, 32(BX) // error code
POPQ BP
RET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment