forked from snipersim/snipersim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.arm64
98 lines (80 loc) · 3.79 KB
/
README.arm64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
____ _ __ _ ____ __ __
/ ___| _ __ (_)_ __ ___ _ __ / / / \ | _ \| \/ |
\___ \| '_ \| | '_ \ / _ \ '__| / / / _ \ | |_) | |\/| |
___) | | | | | |_) | __/ | / / / ___ \| _ <| | | |
|____/|_| |_|_| .__/ \___|_| /_/ /_/ \_\_| \_\_| |_|
|_|
========================================
0. Contents of this file
========================================
1. Prerequisites
2. Installing Sniper/ARM
3. Running Sniper/ARM
========================================
1. Prerequisites
========================================
1.1. ARM64 with Linux
-----------------------
Sniper's frontend needs to run on an ARM64 board running Linux.
Tested platforms:
- Firefly-RK3399 (http://en.t-firefly.com/en/firenow/Firefly_RK3399/) with Ubuntu 16.04.
1.2. x86 PC/Server with Linux
-------------------------------
Simulator host that runs the Sniper backend, as in a regular installation of x86 Sniper.
1.3. DynamoRIO
----------------
Dynamic instrumentation tool used for the generation of ARM traces.
Within the ARM64 board, get DynamoRIO latest version:
> git clone https://github.com/DynamoRIO/dynamorio.git
Installation instructions will follow in section 2.
We'll refer to the directory containing DynamoRIO source code as DR_ROOT.
1.4. Capstone
---------------
The Capstone disassembly framework is necessary for the backend decoder.
Within the x86 host, get Capstone latest version and compile it:
> git clone https://github.com/aquynh/capstone.git
> cd capstone
> ./make.sh
We'll refer to that directory containing Capstone source code and compiled library as CAPSTONE_ROOT.
1.5. Sniper
-------------
Sniper's code (ARM version) has to be available in both the ARM64 board and the x86 host.
We refer to the directories containing Sniper's code as SIM_ROOT_ARM and SIM_ROOT_HOST, respectively.
========================================
2. Installing Sniper/ARM
========================================
2.1. Install frontend on ARM64
--------------------------------
- Compile Sniper's sift library libsift.a (ignore errors about not being able to compile the dump sift executable):
> cd $(SIM_ROOT_ARM)/sift; make
- Create a symbolic link to the DynamoRIO frontend source from DynamoRIO clients (use full paths):
> ln -s $(SIM_ROOT_ARM)/frontend/dr-frontend $(DR_ROOT)/clients/dr-frontend
- Create a build directory in DR_ROOT:
> cd $(DR_ROOT); mkdir build; cd build
- Set up the SNIPER_HOME environment variable:
> export SNIPER_HOME=$(SIM_ROOT_ARM)
- Configure within 'build' directory and compile:
> cmake -DDEBUG=ON .. ; make
- Create a symbolic link to the DynamoRIO build directory from Sniper home:
> ln -s $(DR_ROOT)/build $(SIM_ROOT_ARM)/dynamorio
2.2. Install backend on x86 host
----------------------------------
- Create a symbolic link to the Capstone source and installation directory from Sniper:
> ln -s $(CAPSTONE_ROOT) $(SIM_ROOT_HOST)/capstone
- Compile decoder library:
> cd $(SIM_ROOT_HOST)/decoder_lib; make
- Compile Sniper as usual:
> cd $(SIM_ROOT_HOST); make
========================================
3. Running Sniper/ARM
========================================
3.1. Create traces on ARM64
-----------------------------
- To create a NAME_OF_TRACE.sift trace file for PROGRAM:
> $(SIM_ROOT_ARM)/dynamorio/bin64/drrun -debug -loglevel 1 -c $(SIM_ROOT_ARM)/dynamorio/clients/lib64/debug/libdr-frontend.so -roi 0 -f 0 -d 0 -b 0 -o NAME_OF_TRACE -e 0 -s 0 -r 0 -stop 0 -verbose -- PROGRAM
(Note: for recording only Region of Interest, set -roi 1)
3.2. Run traces on x86 host
-----------------------------
- To run the trace NAME_OF_TRACE.sift with an ARM Cortex A72 core:
> cd $(SIM_ROOT_HOST)
> ./run-sniper -v --traces=NAME_OF_TRACE.sift -ccortex-a72