Implemented arm64 instructions: ldp and stp
This commit is contained in:
12
src/arm/LoadPair.go
Normal file
12
src/arm/LoadPair.go
Normal file
@ -0,0 +1,12 @@
|
||||
package arm
|
||||
|
||||
import "git.urbach.dev/cli/q/src/cpu"
|
||||
|
||||
// LoadPair calculates an address from a base register value and an immediate offset,
|
||||
// loads two 64-bit doublewords from memory, and writes them to two registers.
|
||||
// This is the post-index version of the instruction so the offset is applied to the base register after the memory access.
|
||||
func LoadPair(reg1 cpu.Register, reg2 cpu.Register, base cpu.Register, offset int) uint32 {
|
||||
offset /= 8
|
||||
offset &= 0b1111111
|
||||
return 0b1010100011<<22 | (uint32(offset) << 15) | (uint32(reg2) << 10) | (uint32(base) << 5) | uint32(reg1)
|
||||
}
|
Reference in New Issue
Block a user