本文整理匯總了Golang中github.com/unicorn-engine/unicorn/bindings/go/unicorn.Unicorn.MemUnmap方法的典型用法代碼示例。如果您正苦於以下問題:Golang Unicorn.MemUnmap方法的具體用法?Golang Unicorn.MemUnmap怎麽用?Golang Unicorn.MemUnmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/unicorn-engine/unicorn/bindings/go/unicorn.Unicorn
的用法示例。
在下文中一共展示了Unicorn.MemUnmap方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Clear
func (s *WorkingSet) Clear(mu uc.Unicorn) *errors.Error {
if s.newest == -1 {
return nil
}
for i := s.oldest; i != s.newest; i = (i + 1) % len(s.mapped) {
err := mu.MemUnmap(s.mapped[i], pagesize)
if err != nil {
return wrap(err)
}
}
return nil
}
示例2: StoreInWorkingSet
func (s *WorkingSet) StoreInWorkingSet(addr uint64, mu uc.Unicorn) error {
if s.newest == -1 {
s.mapped[0] = addr
s.oldest = 0
s.newest = 0
}
s.newest = (s.newest + 1) % len(s.mapped)
if s.newest == s.oldest { // unmap old page
addr_to_unmap := s.mapped[s.oldest]
err := mu.MemUnmap(addr_to_unmap, pagesize)
if err != nil {
return err
}
}
s.oldest = (s.oldest + 1) % len(s.mapped)
s.mapped[s.newest] = addr
return nil
}
示例3: StoreInWorkingSet
func (s *WorkingSet) StoreInWorkingSet(addr uint64, mu uc.Unicorn) *errors.Error {
if log_mem {
log.WithFields(log.Fields{"addr": hex(addr)}).Debug("Store In Working Set")
}
if s.newest == -1 {
s.mapped[0] = addr
s.oldest = 0
s.newest = 0
}
s.newest = (s.newest + 1) % len(s.mapped)
if s.newest == s.oldest { // unmap old page
addr_to_unmap := s.mapped[s.oldest]
if log_mem {
log.WithFields(log.Fields{"addr_to_unmap": addr_to_unmap}).Debug("unmap")
}
err := mu.MemUnmap(addr_to_unmap, pagesize)
if err != nil {
return wrap(err)
}
}
s.oldest = (s.oldest + 1) % len(s.mapped)
s.mapped[s.newest] = addr
return nil
}