Added basic support for arm64

This commit is contained in:
Eduard Urbach 2025-03-06 13:40:17 +01:00
parent cc1c990dc8
commit dfe807c2e2
Signed by: eduard
GPG key ID: 49226B848C78F6C8
25 changed files with 270 additions and 33 deletions

View file

@ -1,6 +1,7 @@
package asmc
import (
"git.urbach.dev/cli/q/src/arm"
"git.urbach.dev/cli/q/src/asm"
"git.urbach.dev/cli/q/src/config"
"git.urbach.dev/cli/q/src/dll"
@ -24,8 +25,20 @@ func Finalize(a asm.Assembler, dlls dll.List) ([]byte, []byte) {
dlls: dlls,
}
for _, x := range a.Instructions {
c.compile(x)
switch config.TargetArch {
case config.ARM:
for _, x := range a.Instructions {
c.compileARM(x)
}
c.code = arm.MoveRegisterNumber(c.code, arm.X0, 0)
c.code = arm.MoveRegisterNumber(c.code, arm.X8, 0x5D)
c.code = arm.Syscall(c.code)
case config.X86:
for _, x := range a.Instructions {
c.compileX86(x)
}
}
c.resolvePointers()