Enabled arm64 encoding

This commit is contained in:
Eduard Urbach 2025-03-06 16:54:28 +01:00
parent e3957fc318
commit fee1b27bfe
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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
}