本文整理汇总了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
}