mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-06 14:05:40 +00:00
Go: add x86 RegWriteMmr method
This commit is contained in:
parent
475c8de3de
commit
74f783a274
|
@ -36,6 +36,7 @@ type Unicorn interface {
|
||||||
MemWrite(addr uint64, data []byte) error
|
MemWrite(addr uint64, data []byte) error
|
||||||
RegRead(reg int) (uint64, error)
|
RegRead(reg int) (uint64, error)
|
||||||
RegWrite(reg int, value uint64) error
|
RegWrite(reg int, value uint64) error
|
||||||
|
RegWriteMmr(reg int, value *X86Mmr) error
|
||||||
Start(begin, until uint64) error
|
Start(begin, until uint64) error
|
||||||
StartWithOptions(begin, until uint64, options *UcOptions) error
|
StartWithOptions(begin, until uint64, options *UcOptions) error
|
||||||
Stop() error
|
Stop() error
|
||||||
|
|
26
bindings/go/unicorn/x86.go
Normal file
26
bindings/go/unicorn/x86.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package unicorn
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// #include <unicorn/unicorn.h>
|
||||||
|
// #include <unicorn/x86.h>
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
type X86Mmr struct {
|
||||||
|
Selector uint16
|
||||||
|
Base uint64
|
||||||
|
Limit uint32
|
||||||
|
Flags uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *uc) RegWriteMmr(reg int, value *X86Mmr) error {
|
||||||
|
var val C.uc_x86_mmr
|
||||||
|
val.selector = C.uint16_t(value.Selector)
|
||||||
|
val.base = C.uint64_t(value.Base)
|
||||||
|
val.limit = C.uint32_t(value.Limit)
|
||||||
|
val.flags = C.uint32_t(value.Flags)
|
||||||
|
ucerr := C.uc_reg_write(u.handle, C.int(reg), unsafe.Pointer(&val))
|
||||||
|
return errReturn(ucerr)
|
||||||
|
}
|
Loading…
Reference in a new issue