Implemented more arm64 instructions

This commit is contained in:
2025-03-06 23:13:14 +01:00
parent cb908e7b31
commit 0ac7fc9a85
26 changed files with 232 additions and 73 deletions

View File

@ -1,15 +1,8 @@
package arm
import "encoding/binary"
// Call branches to a PC-relative offset, setting the register X30 to PC+4.
// 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, EncodeCall(offset))
}
// EncodeCall returns the raw encoding of a call with the given offset.
func EncodeCall(offset uint32) uint32 {
func Call(offset uint32) uint32 {
return uint32(0b100101<<26) | offset
}