mirror of
https://github.com/Cxbx-Reloaded/unicorn.git
synced 2024-11-27 21:30:55 +00:00
Go binding: add mem_protect wrapper
This commit is contained in:
parent
c37b2582d7
commit
638ff7a3f5
@ -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 New Issue
Block a user