Added Windows calling convention registers

This commit is contained in:
Eduard Urbach 2024-08-17 15:08:18 +02:00
parent 34aeba740a
commit c3699ac6ac
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 38 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import (
"git.akyoto.dev/cli/q/src/exe/pe" "git.akyoto.dev/cli/q/src/exe/pe"
"git.akyoto.dev/cli/q/src/os/linux" "git.akyoto.dev/cli/q/src/os/linux"
"git.akyoto.dev/cli/q/src/os/mac" "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. // Result contains all the compiled functions in a build.
@ -72,7 +73,7 @@ func (r *Result) finalize() ([]byte, []byte) {
final.Syscall() final.Syscall()
case "windows": case "windows":
final.RegisterNumber(asm.SUB, x64.RSP, 32+8) 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") final.Label(asm.CALL_AT, "ExitProcess")
} }

View 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,
}
)