mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 10:48:19 +00:00
Go binding: add mem_protect wrapper
This commit is contained in:
parent
c37b2582d7
commit
638ff7a3f5
1 changed files with 5 additions and 0 deletions
|
@ -28,6 +28,7 @@ func errReturn(err C.uc_err) error {
|
|||
type Unicorn interface {
|
||||
MemMap(addr, size uint64) error
|
||||
MemMapProt(addr, size uint64, prot int) error
|
||||
MemProtect(addr, size uint64, prot int) error
|
||||
MemUnmap(addr, size uint64) error
|
||||
MemRead(addr, size uint64) ([]byte, error)
|
||||
MemReadInto(dst []byte, addr uint64) error
|
||||
|
@ -128,6 +129,10 @@ func (u *uc) MemMap(addr, size uint64) error {
|
|||
return u.MemMapProt(addr, size, PROT_ALL)
|
||||
}
|
||||
|
||||
func (u *uc) MemProtect(addr, size uint64, prot int) error {
|
||||
return errReturn(C.uc_mem_protect(u.handle, C.uint64_t(addr), C.size_t(size), C.uint32_t(prot)))
|
||||
}
|
||||
|
||||
func (u *uc) MemUnmap(addr, size uint64) error {
|
||||
return errReturn(C.uc_mem_unmap(u.handle, C.uint64_t(addr), C.size_t(size)))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue