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

@ -5,14 +5,14 @@ import "git.urbach.dev/cli/q/src/cpu"
// Call places the return address on the top of the stack and continues
// program flow at the new address.
// The address is relative to the next instruction.
func Call(code []byte, address uint32) []byte {
func Call(code []byte, offset uint32) []byte {
return append(
code,
0xE8,
byte(address),
byte(address>>8),
byte(address>>16),
byte(address>>24),
byte(offset),
byte(offset>>8),
byte(offset>>16),
byte(offset>>24),
)
}

View file

@ -30,4 +30,13 @@ var (
WindowsInputRegisters = []cpu.Register{RCX, RDX, R8, R9}
WindowsOutputRegisters = []cpu.Register{RAX}
WindowsVolatileRegisters = []cpu.Register{RCX, RDX, R8, R9, R10, R11}
CPU = cpu.CPU{
General: GeneralRegisters,
Input: InputRegisters,
Output: OutputRegisters,
SyscallInput: SyscallInputRegisters,
SyscallOutput: SyscallOutputRegisters,
NumRegisters: 16,
}
)