Enabled arm64 encoding

This commit is contained in:
2025-03-06 16:54:28 +01:00
parent 5f522b519a
commit 7798eca074
9 changed files with 103 additions and 29 deletions

View File

@ -6,5 +6,10 @@ import "encoding/binary"
// The offset starts from the address of this instruction and is encoded as "imm26" times 4.
// This instruction is also known as BL (branch with link).
func Call(code []byte, offset uint32) []byte {
return binary.LittleEndian.AppendUint32(code, uint32(0b100101<<26)|offset)
return binary.LittleEndian.AppendUint32(code, EncodeCall(offset))
}
// EncodeCall returns the raw encoding of a call with the given offset.
func EncodeCall(offset uint32) uint32 {
return uint32(0b100101<<26) | offset
}

View File

@ -39,8 +39,8 @@ const (
var (
GeneralRegisters = []cpu.Register{X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19, X20, X21, X22, X23, X24, X25, X26, X27, X28}
InputRegisters = SyscallInputRegisters
OutputRegisters = SyscallInputRegisters
InputRegisters = []cpu.Register{X0, X1, X2, X3, X4, X5}
OutputRegisters = InputRegisters
SyscallInputRegisters = []cpu.Register{X8, X0, X1, X2, X3, X4, X5}
SyscallOutputRegisters = []cpu.Register{X0, X1}
WindowsInputRegisters = []cpu.Register{X0, X1, X2, X3, X4, X5, X6, X7}