Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
ec307ac5
Commit
ec307ac5
authored
Oct 04, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instrumenting
parent
177d162f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
MIPS.sol
contracts/MIPS.sol
+0
-1
main.go
mipsevm/main.go
+7
-4
run.py
risc/run.py
+2
-2
No files found.
contracts/MIPS.sol
View file @
ec307ac5
...
...
@@ -96,7 +96,6 @@ contract MIPS {
// TODO: test ll and sc
function stepNextPC(bytes32 stateHash, uint32 pc, uint64 nextPC) internal view returns (bytes32) {
uint32 insn = m.ReadMemory(stateHash, pc);
//return stateHash;
uint32 opcode = insn >> 26; // 6-bits
uint32 func = insn & 0x3f; // 6-bits
...
...
mipsevm/main.go
View file @
ec307ac5
...
...
@@ -135,6 +135,9 @@ func opStaticCall(pc *uint64, interpreter *vm.EVMInterpreter, scope *vm.ScopeCon
fmt
.
Println
(
"HOOKED READ! "
,
fmt
.
Sprintf
(
"%x = %x"
,
addr
,
nret
))
}
if
addr
==
0xc0000080
{
if
nret
==
0xDEAD0000
{
fmt
.
Printf
(
"exec is done"
)
}
if
debug
>=
1
{
fmt
.
Printf
(
"%7d %8X %08X : %08X %08X %08X %08X %08X %08X %08X %08X %08X
\n
"
,
pcCount
,
nret
,
ram
[
nret
],
...
...
@@ -143,9 +146,9 @@ func opStaticCall(pc *uint64, interpreter *vm.EVMInterpreter, scope *vm.ScopeCon
ram
[
0xc0000018
],
ram
[
0xc000001c
],
ram
[
0xc0000020
],
ram
[
0xc0000024
])
}
if
ram
[
nret
]
==
0xC
{
/*
syscall := ram[0xc0000008]
fmt.Printf("syscall %d at %x (step %d)\n", syscall, nret, pcCount
)
if syscall == 4004 {
syscall
:=
ram
[
0xc0000008
]
os
.
Stderr
.
WriteString
(
fmt
.
Sprintf
(
"syscall %d at %x (step %d)
\n
"
,
syscall
,
nret
,
pcCount
)
)
/*
if syscall == 4004 {
fmt.Printf("WRITE!")
}*/
}
...
...
@@ -286,7 +289,7 @@ func main() {
/*debug = 1
steps := 1000000
runTest(os.Args[1], steps, interpreter, bytecode, uint64(steps)*10000)*/
RunMinigeth
(
os
.
Args
[
1
],
interpreter
,
bytecode
,
10000000
)
RunMinigeth
(
os
.
Args
[
1
],
interpreter
,
bytecode
,
10000000
0
)
}
else
{
debug
=
2
runTest
(
os
.
Args
[
1
],
20
,
interpreter
,
bytecode
,
1000000
)
...
...
risc/run.py
View file @
ec307ac5
...
...
@@ -68,7 +68,7 @@ def start_instrumenting():
mu
.
hook_add
(
UC_HOOK_CODE
,
hook_code_simple
,
user_data
=
mu
)
elif
tracelevel
==
1
:
mu
.
hook_add
(
UC_HOOK_BLOCK
,
hook_code_simple
,
user_data
=
mu
)
if
tracelevel
>=
3
:
if
tracelevel
>=
4
:
instrumenting_all
=
True
instrumenting
=
True
...
...
@@ -368,7 +368,7 @@ mu.hook_add(UC_HOOK_MEM_FETCH_UNMAPPED, hook_mem_invalid)
mu
.
hook_add
(
UC_HOOK_INTR
,
hook_interrupt
)
#mu.hook_add(UC_HOOK_INSN, hook_interrupt, None, 1, 0, 0x0c000000)
if
tracelevel
==
4
:
if
tracelevel
==
3
:
start_instrumenting
()
with
open
(
"/tmp/minigeth.bin"
,
"wb"
)
as
f
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment