Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
mipsevm: temporary hack to allow for snapshot runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Inphi committed May 3, 2023
1 parent 2ab1eb7 commit a94f675
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mipsevm/unicorn.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,13 @@ func NewUnicornState(mu uc.Unicorn, state *State, po PreimageOracle, stdOut, std
// Shout if Go mmap calls didn't allocate the memory properly
_, err = mu.HookAdd(uc.HOOK_MEM_UNMAPPED, func(mu uc.Unicorn, typ int, addr uint64, size int, value int64) bool {
fmt.Printf("MEM UNMAPPED typ %d addr %016x size %x value %x\n", typ, addr, size, value)
return false
//return false
// TODO: Unmapped memory access can occur when loading from a snapshot that spans unused pages
// This callback should return false though to handle invalid memory accesses early
if err := mu.MemMap(addr&^4095, 4096); err != nil {
fmt.Printf("failed to mmap addr (%x). reason: %v", addr, err)
}
return true
}, 0, ^uint64(0))
if err != nil {
return nil, fmt.Errorf("failed to set up unmapped-mem-write hook: %w", err)
Expand Down

0 comments on commit a94f675

Please sign in to comment.