Commit 3782c561 authored by inphi's avatar inphi

cannon: Remove unicorn references

parent cbae9e68
...@@ -32,9 +32,8 @@ And as it executes each step, it can optionally produce the witness data for the ...@@ -32,9 +32,8 @@ And as it executes each step, it can optionally produce the witness data for the
The Cannon CLI is used to load a program into an initial state, The Cannon CLI is used to load a program into an initial state,
transition it N steps quickly without witness generation, and 1 step while producing a witness. transition it N steps quickly without witness generation, and 1 step while producing a witness.
`mipsevm` is backed by the Unicorn emulator, but instrumented for proof generation, `mipsevm` is instrumented for proof generation and handles delay-slots by isolating each individual instruction
and handles delay-slots by isolating each individual instruction and tracking `nextPC` and tracking `nextPC` to emulate the delayed `PC` changes after delay-slot execution.
to emulate the delayed `PC` changes after delay-slot execution.
## Witness Data ## Witness Data
......
...@@ -108,7 +108,7 @@ func TestEVM(t *testing.T) { ...@@ -108,7 +108,7 @@ func TestEVM(t *testing.T) {
// TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison. // TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison.
uniPost := us.state.EncodeWitness() uniPost := us.state.EncodeWitness()
require.Equal(t, hexutil.Bytes(uniPost).String(), hexutil.Bytes(evmPost).String(), require.Equal(t, hexutil.Bytes(uniPost).String(), hexutil.Bytes(evmPost).String(),
"unicorn produced different state than EVM") "mipsevm produced different state than EVM")
} }
require.Equal(t, uint32(endAddr), state.PC, "must reach end") require.Equal(t, uint32(endAddr), state.PC, "must reach end")
// inspect test result // inspect test result
...@@ -175,7 +175,7 @@ func TestHelloEVM(t *testing.T) { ...@@ -175,7 +175,7 @@ func TestHelloEVM(t *testing.T) {
// TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison. // TODO: maybe more readable to decode the evmPost state, and do attribute-wise comparison.
uniPost := us.state.EncodeWitness() uniPost := us.state.EncodeWitness()
require.Equal(t, hexutil.Bytes(uniPost).String(), hexutil.Bytes(evmPost).String(), require.Equal(t, hexutil.Bytes(uniPost).String(), hexutil.Bytes(evmPost).String(),
"unicorn produced different state than EVM") "mipsevm produced different state than EVM")
} }
end := time.Now() end := time.Now()
delta := end.Sub(start) delta := end.Sub(start)
......
...@@ -11,8 +11,7 @@ import ( ...@@ -11,8 +11,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
) )
// Note: 2**12 = 4 KiB, the minimum page-size in Unicorn for mmap // Note: 2**12 = 4 KiB, the min phys page size in the Go runtime.
// as well as the Go runtime min phys page size.
const ( const (
PageAddrSize = 12 PageAddrSize = 12
PageKeySize = 32 - PageAddrSize PageKeySize = 32 - PageAddrSize
......
...@@ -56,15 +56,6 @@ func (m *InstrumentedState) handleSyscall() error { ...@@ -56,15 +56,6 @@ func (m *InstrumentedState) handleSyscall() error {
v0 = a0 v0 = a0
//fmt.Printf("mmap hint 0x%x size 0x%x\n", v0, sz) //fmt.Printf("mmap hint 0x%x size 0x%x\n", v0, sz)
} }
// Go does this thing where it first gets memory with PROT_NONE,
// and then mmaps with a hint with prot=3 (PROT_READ|WRITE).
// We can ignore the NONE case, to avoid duplicate/overlapping mmap calls to unicorn.
//prot := a2
//if prot != 0 {
// if err := mu.MemMap(uint64(v0), uint64(sz)); err != nil {
// log.Fatalf("mmap fail: %v", err)
// }
//}
case 4045: // brk case 4045: // brk
v0 = 0x40000000 v0 = 0x40000000
case 4120: // clone (not supported) case 4120: // clone (not supported)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment