Improved Windows ABI support
This commit is contained in:
@ -123,6 +123,8 @@ func (c *compiler) compile(x asm.Instruction) {
|
||||
|
||||
case asm.PUSH:
|
||||
switch operands := x.Data.(type) {
|
||||
case *asm.Number:
|
||||
c.code = x86.PushNumber(c.code, operands.Number)
|
||||
case *asm.Register:
|
||||
c.code = x86.PushRegister(c.code, operands.Register)
|
||||
}
|
||||
|
@ -9,15 +9,10 @@ import (
|
||||
|
||||
func (c *compiler) dllCall(x asm.Instruction) {
|
||||
size := 4
|
||||
// TODO: R15 could be in use.
|
||||
c.code = x86.MoveRegisterRegister(c.code, x86.R15, x86.RSP)
|
||||
c.code = x86.AlignStack(c.code)
|
||||
c.code = x86.SubRegisterNumber(c.code, x86.RSP, 32)
|
||||
c.code = x86.CallAtAddress(c.code, 0x00_00_00_00)
|
||||
position := len(c.code) - size
|
||||
c.code = x86.MoveRegisterRegister(c.code, x86.RSP, x86.R15)
|
||||
|
||||
label := x.Data.(*asm.Label)
|
||||
|
||||
pointer := &pointer{
|
||||
Position: Address(position),
|
||||
OpSize: 2,
|
||||
|
Reference in New Issue
Block a user