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
033ca9c1
Commit
033ca9c1
authored
Sep 23, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start on mips emulator
parent
8d196213
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
build.sh
risc/build.sh
+1
-1
run.py
risc/run.py
+49
-0
No files found.
risc/build.sh
View file @
033ca9c1
#!/bin/bash
#!/bin/bash
cd
../minigeth
cd
../minigeth
GOOS
=
linux
GOARCH
=
riscv64
go build
GOOS
=
linux
GOARCH
=
mips
go build
cp
go-ethereum ../risc/go-ethereum
cp
go-ethereum ../risc/go-ethereum
cd
../risc
cd
../risc
file go-ethereum
file go-ethereum
...
...
risc/run.py
0 → 100755
View file @
033ca9c1
#!/usr/bin/env python3
from
elftools.elf.elffile
import
ELFFile
from
hexdump
import
hexdump
from
unicorn
import
*
from
unicorn.mips_const
import
*
mu
=
Uc
(
UC_ARCH_MIPS
,
UC_MODE_32
+
UC_MODE_BIG_ENDIAN
)
cnt
=
0
def
hook_code
(
uc
,
address
,
size
,
user_data
):
global
cnt
cnt
+=
1
if
cnt
==
1000
:
raise
Exception
(
"too many instructions"
)
try
:
print
(
">>> Tracing instruction at 0x
%
x, instruction size =
%
u"
%
(
address
,
size
))
#print(' code hook: pc=%08x sp=%08x' % (
# uc.reg_read(UC_MIPS_REG_PC),
# uc.reg_read(UC_MIPS_REG_SP)
# ))
except
:
raise
Exception
(
"ctrl-c"
)
elf
=
open
(
"go-ethereum"
,
"rb"
)
data
=
elf
.
read
()
elf
.
seek
(
0
)
rte
=
data
.
find
(
b
"
\x08\x02\x2c\x95
"
)
print
(
hex
(
rte
))
elffile
=
ELFFile
(
elf
)
#for seg in elffile.iter_segments():
# print(seg.header, dir(seg.header))
entry
=
elffile
.
header
.
e_entry
print
(
"entrypoint:
%
x"
%
entry
)
SIZE
=
16
*
1024
*
1024
mu
.
mem_map
(
0
,
SIZE
)
mu
.
mem_write
(
0x10000
,
data
)
hexdump
(
mu
.
mem_read
(
entry
,
0x10
))
mu
.
reg_write
(
UC_MIPS_REG_SP
,
SIZE
-
4
)
mu
.
hook_add
(
UC_HOOK_CODE
,
hook_code
,
user_data
=
mu
)
mu
.
emu_start
(
entry
,
SIZE
)
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