This commit is contained in:
parent
31c5ed614c
commit
bac5986425
61 changed files with 2745 additions and 0 deletions
13
src/x86/LoadAddress.go
Normal file
13
src/x86/LoadAddress.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package x86
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"git.urbach.dev/cli/q/src/cpu"
|
||||
)
|
||||
|
||||
// LoadAddress calculates the address with the RIP-relative offset and writes the result to the destination register.
|
||||
func LoadAddress(code []byte, destination cpu.Register, offset int) []byte {
|
||||
code = encode(code, AddressMemory, destination, 0b101, 8, 0x8D)
|
||||
return binary.LittleEndian.AppendUint32(code, uint32(offset))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue