Improved Windows support

This commit is contained in:
2024-08-19 17:25:51 +02:00
parent e9a0494aa7
commit 6b48ee0a48
8 changed files with 50 additions and 8 deletions

View File

@ -126,11 +126,13 @@ func (a Assembler) Finalize(dlls dll.List) ([]byte, []byte) {
case DLLCALL:
size := 4
// TODO: R15 could be in use.
code = x64.MoveRegisterRegister(code, x64.R15, x64.RSP)
code = x64.AlignStack(code)
code = x64.SubRegisterNumber(code, x64.RSP, 32)
code = x64.CallAtAddress(code, 0x00_00_00_00)
position := len(code) - size
code = x64.AddRegisterNumber(code, x64.RSP, 32)
code = x64.MoveRegisterRegister(code, x64.RSP, x64.R15)
label := x.Data.(*Label)
pointer := &Pointer{