Skip to content

Commit 344d016

Browse files
committed
import
0 parents  commit 344d016

File tree

499 files changed

+266445
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

499 files changed

+266445
-0
lines changed

.gitignore

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
.DS_Store
2+
*.swp
3+
*.d
4+
*.o
5+
*.a
6+
7+
qemu/config-all-devices.mak
8+
9+
i386-softmmu/
10+
arm-softmmu/
11+
aarch64-softmmu/
12+
mips-softmmu/
13+
mips64-softmmu/
14+
mipsel-softmmu/
15+
mips64el-softmmu/
16+
sparc-softmmu/
17+
sparc64-softmmu/
18+
m68k-softmmu/
19+
20+
qapi-types.h
21+
qapi-visit.h
22+
x86_64-softmmu/
23+
tags
24+
qemu/config-host.ld
25+
qemu/config.log
26+
qemu/config.status
27+
qemu/config-host.h
28+
qemu/config-host.h-timestamp
29+
qemu/config-host.mak
30+
qemu/qapi-types.c
31+
qemu/qapi-visit.c
32+
33+
sample_x86
34+
sample_x86.exe
35+
sample_x86.static
36+
sample_arm
37+
sample_arm.exe
38+
sample_arm.static
39+
sample_arm64
40+
sample_arm64.exe
41+
sample_arm64.static
42+
sample_mips
43+
sample_mips.exe
44+
sample_mips.static
45+
sample_sparc
46+
sample_sparc.exe
47+
sample_sparc.static
48+
shellcode
49+
shellcode.exe
50+
shellcode.static
51+
sample_m68k
52+
sample_m68k.exe
53+
sample_m68k.static
54+
55+
libunicorn*.dll
56+
libunicorn*.so
57+
libunicorn*.dylib
58+
59+
unicorn.pc
60+
61+
unicorn.lib
62+
unicorn.dll
63+
unicorn_*.lib
64+
unicorn_*.dll
65+
66+
67+
docs/paper/*.dvi
68+
docs/paper/*.ps
69+
docs/paper/*.pdf
70+
docs/paper/*.htm
71+
docs/paper/*.log
72+
73+
*.tgz
74+
*.zip
75+
*.pyc
76+
_*.txt
77+
_*.diff
78+
tmp/
79+
80+
bindings/python/build/
81+
config.log

AUTHORS.TXT

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Nguyen Anh Quynh <aquynh -at- gmail.com>
2+
Dang Hoang Vu <dang.hvu -at- gmail.com>

COMPILE.TXT

+218
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
This documentation explains how to compile, install & run Unicorn on MacOSX,
2+
Linux, *BSD & Solaris. We also show steps to cross-compile for Microsoft Windows.
3+
4+
*-*-*-*-*-*
5+
6+
[0] Dependencies
7+
8+
Unicorn requires few dependent packages as followings
9+
10+
- For Mac OS X, "pkg-config" is needed.
11+
Brew users can install "pkg-config" with:
12+
13+
$ brew install pkg-config
14+
15+
- For Linux, glib2-dev is needed.
16+
Ubuntu/Debian users can install this with:
17+
18+
$ sudo apt-get install libglib2.0-dev
19+
20+
- For Windows, cross-compile using Mingw. Mingw-glib2 is needed.
21+
22+
On Ubuntu 14.04 64-bit, do:
23+
24+
1. Download DEB packages for Mingw64 from https://launchpad.net/~greg-hellings/+archive/ubuntu/mingw-libs/+build/2924251
25+
26+
2. To cross-compile for Windows 32-bit, install Mingw with (ignore all the warnings):
27+
28+
$ sudo dpkg -i --force-depends mingw64-x86-glib2_2.31.0_all.deb
29+
30+
To cross-compile for Windows 64-bit, install Mingw with:
31+
32+
$ sudo dpkg -i --force-depends mingw64-x64-glib2_2.31.0_all.deb
33+
34+
35+
36+
[1] Tailor Unicorn to your need.
37+
38+
Out of 8 archtitectures supported by Unicorn (Arm, Arm64, Mips, PPC, Sparc,
39+
SystemZ, XCore & X86), if you just need several selected archs, choose which
40+
ones you want to compile in by editing "config.mk" before going to next steps.
41+
42+
By default, all 8 architectures are compiled.
43+
44+
The other way of customize Unicorn without having to edit config.mk is to
45+
pass the desired options on the commandline to ./make.sh. Currently,
46+
Unicorn supports 3 options, as followings.
47+
48+
- UNICORN_ARCHS: specify list of architectures to compiled in.
49+
- UNICORN_STATIC: build static library.
50+
- UNICORN_SHARED: build dynamic (shared) library.
51+
52+
To avoid editing config.mk for these customization, we can pass their values to
53+
make.sh, as followings.
54+
55+
$ UNICORN_ARCHS="arm aarch64 x86" ./make.sh
56+
57+
NOTE: on commandline, put these values in front of ./make.sh, not after it.
58+
59+
For each option, refer to docs/README for more details.
60+
61+
62+
63+
[2] Compile from source
64+
65+
On *nix (such as MacOSX, Linux, *BSD, Solaris):
66+
67+
- To compile for current platform, run:
68+
69+
$ ./make.sh
70+
71+
- On 64-bit OS, run the command below to cross-compile Unicorn for 32-bit binary:
72+
73+
$ ./make.sh nix32
74+
75+
76+
77+
[3] Install Unicorn on *nix (such as MacOSX, Linux, *BSD, Solaris)
78+
79+
To install Unicorn, run:
80+
81+
$ sudo ./make.sh install
82+
83+
For FreeBSD/OpenBSD, where sudo is unavailable, run:
84+
85+
$ su; ./make.sh install
86+
87+
Users are then required to enter root password to copy Unicorn into machine
88+
system directories.
89+
90+
Afterwards, run ./tests/test* to see the tests disassembling sample code.
91+
92+
93+
NOTE: The core framework installed by "./make.sh install" consist of
94+
following files:
95+
96+
/usr/include/unicorn/unicorn.h
97+
/usr/include/unicorn/x86.h
98+
/usr/include/unicorn/arm.h
99+
/usr/include/unicorn/arm64.h
100+
/usr/include/unicorn/mips.h
101+
/usr/include/unicorn/ppc.h
102+
/usr/include/unicorn/sparc.h
103+
/usr/include/unicorn/m68k.h
104+
/usr/include/unicorn/platform.h
105+
/usr/lib/libunicorn.so (for Linux/*nix), or /usr/lib/libunicorn.dylib (OSX)
106+
/usr/lib/libunicorn.a
107+
108+
109+
110+
[4] Cross-compile for Windows from *nix
111+
112+
To cross-compile for Windows, Linux & gcc-mingw-w64-i686 (and also gcc-mingw-w64-x86-64
113+
for 64-bit binaries) are required.
114+
115+
- To cross-compile Windows 32-bit binary, simply run:
116+
117+
$ ./make.sh cross-win32
118+
119+
- To cross-compile Windows 64-bit binary, run:
120+
121+
$ ./make.sh cross-win64
122+
123+
Resulted files libunicorn.dll, libunicorn.dll.a & tests/test*.exe can then
124+
be used on Windows machine.
125+
126+
To run sample_x86.exe on Windows 32-bit, you need the following files:
127+
128+
- unicorn.dll
129+
- /usr/i686-w64-mingw32/sys-root/mingw/bin/libglib-2.0-0.dll
130+
- /usr/lib/gcc/i686-w64-mingw32/4.8/libgcc_s_sjlj-1.dll
131+
- /usr/i686-w64-mingw32/lib/libwinpthread-1.dll
132+
133+
To run sample_x86.exe on Windows 64-bit, you need the following files:
134+
- unicorn.dll
135+
- /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libglib-2.0-0.dll
136+
- /usr/lib/gcc/x86_64-w64-mingw32/4.8/libgcc_s_sjlj-1.dll
137+
- /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll
138+
139+
Then run either "sample_x86.exe -32" or "sample_x86.exe -64" to test emulators for X86 32-bit or X86 64-bit.
140+
For other architectures, run "sample_xxx.exe" found in the same directory.
141+
142+
143+
144+
[5] Cross-compile for iOS from Mac OSX.
145+
146+
To cross-compile for iOS (iPhone/iPad/iPod), Mac OSX with XCode installed is required.
147+
148+
- To cross-compile for ArmV7 (iPod 4, iPad 1/2/3, iPhone4, iPhone4S), run:
149+
$ ./make.sh ios_armv7
150+
151+
- To cross-compile for ArmV7s (iPad 4, iPhone 5C, iPad mini), run:
152+
$ ./make.sh ios_armv7s
153+
154+
- To cross-compile for Arm64 (iPhone 5S, iPad mini Retina, iPad Air), run:
155+
$ ./make.sh ios_arm64
156+
157+
- To cross-compile for all iDevices (armv7 + armv7s + arm64), run:
158+
$ ./make.sh ios
159+
160+
Resulted files libunicorn.dylib, libunicorn.a & tests/test* can then
161+
be used on iOS devices.
162+
163+
164+
165+
[6] Cross-compile for Android
166+
167+
To cross-compile for Android (smartphone/tablet), Android NDK is required.
168+
NOTE: Only ARM and ARM64 are currently supported.
169+
170+
$ NDK=/android/android-ndk-r10e ./make.sh cross-android arm
171+
or
172+
$ NDK=/android/android-ndk-r10e ./make.sh cross-android arm64
173+
174+
Resulted files libunicorn.so, libunicorn.a & tests/test* can then
175+
be used on Android devices.
176+
177+
178+
179+
[7] Compile on Windows with Cygwin
180+
181+
To compile under Cygwin gcc-mingw-w64-i686 or x86_64-w64-mingw32 run:
182+
183+
- To compile Windows 32-bit binary under Cygwin, run:
184+
185+
$ ./make.sh cygwin-mingw32
186+
187+
- To compile Windows 64-bit binary under Cygwin, run:
188+
189+
$ ./make.sh cygwin-mingw64
190+
191+
Resulted files libunicorn.dll, libunicorn.dll.a & tests/test*.exe can then
192+
be used on Windows machine.
193+
194+
195+
196+
[8] By default, "cc" (default C compiler on the system) is used as compiler.
197+
198+
- To use "clang" compiler instead, run the command below:
199+
200+
$ ./make.sh clang
201+
202+
- To use "gcc" compiler instead, run:
203+
204+
$ ./make.sh gcc
205+
206+
207+
208+
[9] To uninstall Unicorn, run the command below:
209+
210+
$ sudo ./make.sh uninstall
211+
212+
213+
214+
[10] Language bindings
215+
216+
So far, only Python is supported by bindings in the main code.
217+
Look for the bindings under directory bindings/, and refer to README file
218+
of corresponding languages.

0 commit comments

Comments
 (0)