Added Windows calling convention registers
This commit is contained in:
parent
34aeba740a
commit
c3699ac6ac
@ -15,6 +15,7 @@ import (
|
||||
"git.akyoto.dev/cli/q/src/exe/pe"
|
||||
"git.akyoto.dev/cli/q/src/os/linux"
|
||||
"git.akyoto.dev/cli/q/src/os/mac"
|
||||
"git.akyoto.dev/cli/q/src/os/windows"
|
||||
)
|
||||
|
||||
// Result contains all the compiled functions in a build.
|
||||
@ -72,7 +73,7 @@ func (r *Result) finalize() ([]byte, []byte) {
|
||||
final.Syscall()
|
||||
case "windows":
|
||||
final.RegisterNumber(asm.SUB, x64.RSP, 32+8)
|
||||
final.RegisterNumber(asm.MOVE, x64.RCX, 1)
|
||||
final.RegisterNumber(asm.MOVE, windows.X64InputRegisters[0], 1)
|
||||
final.Label(asm.CALL_AT, "ExitProcess")
|
||||
}
|
||||
|
||||
|
36
src/os/windows/Registers.go
Normal file
36
src/os/windows/Registers.go
Normal file
@ -0,0 +1,36 @@
|
||||
package windows
|
||||
|
||||
import (
|
||||
"git.akyoto.dev/cli/q/src/arch/arm64"
|
||||
"git.akyoto.dev/cli/q/src/arch/x64"
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
var (
|
||||
X64InputRegisters = []cpu.Register{
|
||||
x64.RCX,
|
||||
x64.RDX,
|
||||
x64.R8,
|
||||
x64.R9,
|
||||
}
|
||||
|
||||
X64OutputRegisters = []cpu.Register{
|
||||
x64.RAX,
|
||||
}
|
||||
|
||||
ARM64InputRegisters = []cpu.Register{
|
||||
arm64.X0,
|
||||
arm64.X1,
|
||||
arm64.X2,
|
||||
arm64.X3,
|
||||
arm64.X4,
|
||||
arm64.X5,
|
||||
arm64.X6,
|
||||
arm64.X7,
|
||||
}
|
||||
|
||||
ARM64OutputRegisters = []cpu.Register{
|
||||
arm64.X0,
|
||||
arm64.X1,
|
||||
}
|
||||
)
|
Loading…
Reference in New Issue
Block a user