Added temporary fix for stack alignment

This commit is contained in:
Eduard Urbach 2024-08-19 11:26:24 +02:00
parent 05789d9626
commit e9a0494aa7
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -50,11 +50,14 @@ func (r *Result) finalize() ([]byte, []byte, dll.List) {
final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 0) final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 0)
final.Syscall() final.Syscall()
case "windows": case "windows":
final.RegisterNumber(asm.SUB, x64.RSP, 8)
final.RegisterNumber(asm.MOVE, windows.X64InputRegisters[0], 0) final.RegisterNumber(asm.MOVE, windows.X64InputRegisters[0], 0)
final.DLLCall("kernel32.ExitProcess") final.DLLCall("kernel32.ExitProcess")
} }
dlls := dll.List{} dlls := dll.List{
{Name: "kernel32", Functions: []string{"ExitProcess"}},
}
// This will place the main function immediately after the entry point // This will place the main function immediately after the entry point
// and also add everything the main function calls recursively. // and also add everything the main function calls recursively.
@ -80,6 +83,7 @@ func (r *Result) finalize() ([]byte, []byte, dll.List) {
final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 1) final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 1)
final.Syscall() final.Syscall()
case "windows": case "windows":
final.RegisterNumber(asm.SUB, x64.RSP, 8)
final.RegisterNumber(asm.MOVE, windows.X64InputRegisters[0], 1) final.RegisterNumber(asm.MOVE, windows.X64InputRegisters[0], 1)
final.Label(asm.DLLCALL, "kernel32.ExitProcess") final.Label(asm.DLLCALL, "kernel32.ExitProcess")
} }