Implemented indirect calls
This commit is contained in:
parent
bdd5e5a28e
commit
9c6eb45fe9
4 changed files with 45 additions and 5 deletions
|
@ -48,8 +48,9 @@ func (r *Result) finalize() ([]byte, []byte) {
|
|||
final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 0)
|
||||
final.Syscall()
|
||||
case "windows":
|
||||
final.RegisterNumber(asm.MOVE, x64.RAX, 0)
|
||||
final.Return()
|
||||
final.RegisterNumber(asm.SUB, x64.RSP, 32+8)
|
||||
final.RegisterNumber(asm.MOVE, x64.RCX, 0)
|
||||
final.Label(asm.CALL_AT, "ExitProcess")
|
||||
}
|
||||
|
||||
// This will place the main function immediately after the entry point
|
||||
|
@ -70,8 +71,9 @@ func (r *Result) finalize() ([]byte, []byte) {
|
|||
final.RegisterNumber(asm.MOVE, x64.SyscallInputRegisters[1], 1)
|
||||
final.Syscall()
|
||||
case "windows":
|
||||
final.RegisterNumber(asm.MOVE, x64.RAX, 1)
|
||||
final.Return()
|
||||
final.RegisterNumber(asm.SUB, x64.RSP, 32+8)
|
||||
final.RegisterNumber(asm.MOVE, x64.RCX, 1)
|
||||
final.Label(asm.CALL_AT, "ExitProcess")
|
||||
}
|
||||
|
||||
code, data := final.Finalize()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue