acheron
acheron copied to clipboard
32-bit function for wow64
In case you would like to integrate this to your library. Not exactly a syscall since it's calling ntdll!Wow64SystemServiceCall . I will adapt to native x86 if there is any interest at all.
#include "textflag.h"
#define maxargs 16
//func Syscall(callid uint32,tramboline uintptr, argh ...uintptr) (uint32, error)
TEXT ·bpSyscall(SB),NOSPLIT,$0
MOVL callid+0(FP), DX
MOVL tramboline+4(FP), BX
MOVL argh+8(FP), SI
// SetLastError(0).
MOVL $0, 0x34(FS)
// Copy args to the stack.
MOVL SP, BP
PUSHL AX
MOVL argh_len+0x0c(FP), CX // words
MOVL CX, AX
SALL $2, AX
SUBL AX, SP // room for args
POPL AX
MOVL SP, DI
CLD
REP; MOVSL
// Call stdcall or cdecl function.
// DI SI BP BX are preserved, SP is not
MOVL DX,AX
CALL BX
// Return result.
MOVL AX, errcode+0x14(FP)
RET
im waiting since Jul 17, 2023...