Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aarch64 #1366

Closed
wants to merge 251 commits into from
Closed

Aarch64 #1366

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
251 commits
Select commit Hold shift + click to select a range
7ab0cba
Add Aarch64CdeclAbi and Aarch64LinuxSyscallAbi
disconnect3d Feb 17, 2018
fb2f55f
Set uname_machine for aarch64
disconnect3d Feb 17, 2018
46e0604
Fix V0-V31 regs, small refactor
disconnect3d Feb 21, 2018
013d5cf
Add a comment
disconnect3d Feb 21, 2018
3365adb
Add Aarch64Operand and instruction mappings stub
disconnect3d Feb 22, 2018
0a564a9
Unicorn emulation kinda works
disconnect3d Feb 22, 2018
f70e4ec
Start adding registers
disconnect3d Feb 24, 2018
fdb33df
Initial support for the MOV instruction
disconnect3d Feb 28, 2018
f5d8f7d
Maybe working MOV instruction
disconnect3d Mar 4, 2018
bf357b2
Remove Thumb mode from Aarch64/arm64
disconnect3d Apr 21, 2018
4a00eaf
Cleanup
disconnect3d Jun 15, 2018
4c6facd
aarch64: start implementing mov (register and wide immediate)
nkaretnikov Jan 24, 2019
53f0476
aarch64: add basic tests for mov (register and wide immediate)
nkaretnikov Jan 24, 2019
1f36a5f
aarch64: update the syscall ABI
nkaretnikov Jan 25, 2019
25b1f1f
aarch64: add a note to the register file and tests
nkaretnikov Jan 27, 2019
6564842
aarch64: update the cdecl ABI and test it
nkaretnikov Jan 27, 2019
bfcdb43
aarch64: mark classes that need more work
nkaretnikov Jan 27, 2019
df4b833
aarch64: test the syscall ABI
nkaretnikov Jan 27, 2019
fc08a4e
aarch64: mark Armv7 Linux tests as such
nkaretnikov Jan 27, 2019
a825453
aarch64: add the write syscall and test it
nkaretnikov Jan 27, 2019
8519644
aarch64: extract unistd syscalls
nkaretnikov Jan 28, 2019
daeb213
aarch64: update the register file and add tests
nkaretnikov Jan 29, 2019
90647c1
aarch64: correctly work under Unicorn
nkaretnikov Jan 31, 2019
1274cfe
aarch64: remove Armv7-isms from the test
nkaretnikov Jan 31, 2019
ea9f1ab
aarch64: update the Aarch64Cpu class and add tests
nkaretnikov Jan 31, 2019
83d6fd9
aarch64: add ldr (register) and test it
nkaretnikov Feb 4, 2019
7017d13
aarch64: improve the mov docstring
nkaretnikov Feb 4, 2019
4f9864f
aarch64: add ldr (literal) and test it
nkaretnikov Feb 4, 2019
d3e310a
aarch64: rename test_unicorn.py to test_armv7unicorn.py
nkaretnikov Feb 5, 2019
fb1363a
aarch64: test the same code under Unicorn and Manticore
nkaretnikov Feb 5, 2019
f0ce9fb
aarch64: add some basic Cpu tests
nkaretnikov Feb 6, 2019
807561e
aarch64: run custom tests under Unicorn as well
nkaretnikov Feb 6, 2019
b4d18b0
aarch64: fix the extended register mode in ldr (register)
nkaretnikov Feb 6, 2019
b30d994
aarch64: do not return from the '_execute' method
nkaretnikov Feb 6, 2019
e352f5d
aarch64: check instruction encoding
nkaretnikov Feb 7, 2019
a727c3c
aarch64: raise an exception if nothing matches
nkaretnikov Feb 7, 2019
3b39b07
aarch64: add the 'insn_bit_str' property
nkaretnikov Feb 7, 2019
85e0533
aarch64: add ldr (immediate) and test it
nkaretnikov Feb 7, 2019
0858d12
aarch64: check 64-bit registers with 32-bit instruction variants
nkaretnikov Feb 8, 2019
095a733
aarch64: add movn and test it
nkaretnikov Feb 8, 2019
befef5b
aarch64: add movz and test it
nkaretnikov Feb 9, 2019
d00c9f8
aarch64: add orr (immediate) and test it
nkaretnikov Feb 9, 2019
dab3963
aarch64: add orr (shifted register) and test it
nkaretnikov Feb 10, 2019
35d214e
aarch64: add instruction names to docstrings
nkaretnikov Feb 10, 2019
a80e892
aarch64: add add (immediate) and test it
nkaretnikov Feb 10, 2019
a509fff
aarch64: support all mov variants and test them
nkaretnikov Feb 11, 2019
be9d87b
aarch64: fix invalid asserts
nkaretnikov Feb 12, 2019
97c0cc7
aarch64: add add (shifted register) and test it
nkaretnikov Feb 12, 2019
8fa7320
aarch64: add a helper for shifted register variants
nkaretnikov Feb 12, 2019
ff4d786
aarch64: add adr and test it
nkaretnikov Feb 12, 2019
da19c2f
aarch64: add adrp and test it
nkaretnikov Feb 12, 2019
9603456
aarch64: add b and test it
nkaretnikov Feb 12, 2019
f038b7f
aarch64: add bic and test it
nkaretnikov Feb 13, 2019
385998c
aarch64: add bl and test it
nkaretnikov Feb 13, 2019
4fedd2d
aarch64: check pc and lr when testing b
nkaretnikov Feb 13, 2019
ef6eda4
aarch64: add blr and test it
nkaretnikov Feb 13, 2019
636eb78
aarch64: add br and test it
nkaretnikov Feb 13, 2019
f491fa6
aarch64: add missing decorators and test for it
nkaretnikov Feb 13, 2019
ca298bc
aarch64: add clz and test it
nkaretnikov Feb 14, 2019
571908a
aarch64: add ldur and test it
nkaretnikov Feb 15, 2019
b08c057
aarch64: add madd and test it
nkaretnikov Feb 15, 2019
13c199c
aarch64: add mul and test it
nkaretnikov Feb 15, 2019
06ff7da
aarch64: add movk and test it
nkaretnikov Feb 16, 2019
2fc9d48
aarch64: add msub and test it
nkaretnikov Feb 16, 2019
c0a3502
aarch64: add nop and test it
nkaretnikov Feb 16, 2019
4d966a0
aarch64: add ret and test it
nkaretnikov Feb 16, 2019
062d29a
aarch64: add rbit and test it
nkaretnikov Feb 16, 2019
c031481
aarch64: add rev and test it
nkaretnikov Feb 16, 2019
67ecb2e
aarch64: add stur and test it
nkaretnikov Feb 17, 2019
d53f3ad
aarch64: add svc and test it
nkaretnikov Feb 17, 2019
1ce82e5
aarch64: add udiv and test it
nkaretnikov Feb 17, 2019
00955b2
aarch64: add umulh and test it
nkaretnikov Feb 17, 2019
396e989
aarch64: add a helper for ldur and stur
nkaretnikov Feb 18, 2019
0bf9ece
aarch64: add str (register) and test it
nkaretnikov Feb 19, 2019
d2cd683
aarch64: rename 64-bit tests to match 32-bit ones
nkaretnikov Feb 19, 2019
bf5198f
aarch64: write magic values to the stack when testing
nkaretnikov Feb 19, 2019
3132bbb
aarch64: add str (immediate) and test it
nkaretnikov Feb 19, 2019
9aabd82
aarch64: add 'timeout' to 'emu_start' to avoid hanging
nkaretnikov Feb 20, 2019
e29dd34
aarch64: add b.cond and test it
nkaretnikov Feb 20, 2019
1390cf5
aarch64: enable svc tests on Unicorn
nkaretnikov Feb 20, 2019
7b06130
aarch64: add cbnz and test it
nkaretnikov Feb 20, 2019
5b236b9
aarch64: add cbz and test it
nkaretnikov Feb 20, 2019
13747a8
aarch64: add bics and test it
nkaretnikov Feb 21, 2019
41757c4
aarch64: add tbnz and test it
nkaretnikov Feb 21, 2019
2abb4ab
aarch64: add tbz and test it
nkaretnikov Feb 22, 2019
2aacd00
aarch64: add ubfm (with aliases) and test it
nkaretnikov Feb 22, 2019
68c4e5c
aarch64: add helpers for creating immediate and register operands
nkaretnikov Feb 24, 2019
4621df3
aarch64: reorder the tests (remove misplaced)
nkaretnikov Feb 24, 2019
b0b6a4e
aarch64: reorder the tests (add misplaced)
nkaretnikov Feb 24, 2019
637a042
aarch64: test lsl (immediate)
nkaretnikov Feb 24, 2019
dc1a260
aarch64: test lsr (immediate)
nkaretnikov Feb 24, 2019
0070c40
aarch64: test ubfiz
nkaretnikov Feb 24, 2019
f22f5a5
aarch64: test ubfx
nkaretnikov Feb 24, 2019
92ec171
aarch64: test uxtb
nkaretnikov Feb 24, 2019
7396439
aarch64: test uxth
nkaretnikov Feb 24, 2019
5987bf6
aarch64: add lsl (register) and lslv, and test them
nkaretnikov Feb 25, 2019
7d5c961
aarch64: add lsr (register) and lsrv, and test them
nkaretnikov Feb 25, 2019
6e5fda5
aarch64: fix lslv and lsrv (divide by the data size)
nkaretnikov Feb 25, 2019
be47241
aarch64: use Capstone condition codes
nkaretnikov Feb 25, 2019
494b52d
aarch64: add a helper for checking condition codes
nkaretnikov Feb 25, 2019
ffe1fd2
aarch64: remove repetition when testing b.cond
nkaretnikov Feb 26, 2019
5fd79f8
aarch64: add csel and test it
nkaretnikov Feb 26, 2019
5e5260c
aarch64: add and and test it
nkaretnikov Feb 26, 2019
c42c7b7
aarch64: add ands and test it
nkaretnikov Feb 27, 2019
e1bd311
aarch64: add tst and test it
nkaretnikov Feb 27, 2019
fad079d
aarch64: ignore writes to the zero register
nkaretnikov Feb 27, 2019
4b39468
aarch64: add csinc and test it
nkaretnikov Feb 28, 2019
61d8da0
aarch64: add cinc and test it
nkaretnikov Feb 28, 2019
8f86657
aarch64: add cset and test it
nkaretnikov Feb 28, 2019
4a165e4
aarch64: add asr (register) and asrv, and test them
nkaretnikov Mar 1, 2019
2ebdf72
aarch64: add sbfm (with aliases) and test it
nkaretnikov Mar 2, 2019
7a58540
aarch64: test asr (immediate)
nkaretnikov Mar 2, 2019
ab31c43
aarch64: test sbfiz
nkaretnikov Mar 2, 2019
75146ff
aarch64: test sbfx
nkaretnikov Mar 2, 2019
c49d7b5
aarch64: test sxtb
nkaretnikov Mar 2, 2019
399fc99
aarch64: test sxth
nkaretnikov Mar 2, 2019
f214204
aarch64: test sxtw
nkaretnikov Mar 2, 2019
f59b39d
aarch64: add csinv and test it
nkaretnikov Mar 2, 2019
cabb2df
aarch64: add cinv and test it
nkaretnikov Mar 2, 2019
5f504fb
aarch64: add csetm and test it
nkaretnikov Mar 2, 2019
a5e0933
aarch64: add ldp and test it
nkaretnikov Mar 2, 2019
1a0d8bc
aarch64: add stp and test it
nkaretnikov Mar 2, 2019
c0b22aa
aarch64: add ccmp and test it
nkaretnikov Mar 6, 2019
316895e
aarch64: add bfm (with aliases) and test it
nkaretnikov Mar 6, 2019
b0ce772
aarch64: add add (extended register) and test it
nkaretnikov Mar 7, 2019
d04ad00
aarch64: add adds and test it
nkaretnikov Mar 10, 2019
aea2115
aarch64: add cmn and test it
nkaretnikov Mar 11, 2019
7ea8abe
aarch64: check that NZCV is not set
nkaretnikov Mar 11, 2019
0b90774
aarch64: add sub and subs, and test them
nkaretnikov Mar 11, 2019
073e4e5
aarch64: add cmp and test it
nkaretnikov Mar 11, 2019
02ac024
aarch64: add neg and test it
nkaretnikov Mar 11, 2019
bada488
aarch64: add ldrb and test it
nkaretnikov Mar 13, 2019
cd0dcf8
aarch64: add strb and test it
nkaretnikov Mar 13, 2019
7ed3ba4
aarch64: add ldrh and test it
nkaretnikov Mar 13, 2019
cb38652
aarch64: add strh and test it
nkaretnikov Mar 13, 2019
f8ebc54
aarch64: add ldrsw and test it
nkaretnikov Mar 13, 2019
dddb1e7
aarch64: check 32-bit registers when testing ldr
nkaretnikov Mar 13, 2019
5d1d8b8
aarch64: check 32-bit registers when testing ldp
nkaretnikov Mar 16, 2019
b107fa3
aarch64: set the width to 64 for LSL calls
nkaretnikov Mar 13, 2019
71aa4fc
aarch64: add msr (register) and mrs, and test them
nkaretnikov Mar 16, 2019
9b09e95
aarch64: remove unused code
nkaretnikov Mar 18, 2019
9a8567b
aarch64: clean up the documentation
nkaretnikov Mar 19, 2019
ec3df0d
aarch64: add addp (scalar) and test it
nkaretnikov Mar 19, 2019
45858e9
aarch64: add addp (vector) and test it
nkaretnikov Mar 19, 2019
9e7bb9a
aarch64: add add (vector) and test it
nkaretnikov Mar 20, 2019
b2e94c1
aarch64: add sub (vector) and test it
nkaretnikov Mar 20, 2019
d39c38d
aarch64: add and (vector) and test it
nkaretnikov Mar 20, 2019
7fbf018
aarch64: mention unimplemented instruction variants
nkaretnikov Mar 20, 2019
72bf49e
aarch64: fix the element count for scalar variants
nkaretnikov Mar 24, 2019
ffae619
aarch64: add cmeq and test it
nkaretnikov Mar 22, 2019
756915a
aarch64: add a link to a Capstone issue
nkaretnikov Mar 22, 2019
ffe5c66
aarch64: add eor (shifted register) and test it
nkaretnikov Mar 22, 2019
c9fa58d
aarch64: add orr (vector, register) and test it
nkaretnikov Mar 23, 2019
905f6a2
aarch64: add dup (general) and test it
nkaretnikov Mar 24, 2019
23274f7
aarch64: support stp (simd&fp) and test it
nkaretnikov Mar 24, 2019
e039752
aarch64: add umov and mov (to general), and test them
nkaretnikov Mar 24, 2019
37ae3ee
aarch64: add dczid_el0 and test it
nkaretnikov Mar 28, 2019
00ae1e4
aarch64: report which operand type is unsupported
nkaretnikov Mar 28, 2019
7c8b3f2
aarch64: write to memory between execution steps
nkaretnikov Mar 28, 2019
5fdaedb
aarch64: use an existing mask function
nkaretnikov Mar 28, 2019
eb26e87
aarch64: add ld1 (multiple structures) and test it
nkaretnikov Mar 29, 2019
b9452a1
aarch64: add dmb and test it
nkaretnikov Apr 2, 2019
408dcc6
aarch64: add ldaxr and test it
nkaretnikov Apr 2, 2019
cad2ded
aarch64: add ldxr and test it
nkaretnikov Apr 2, 2019
0439677
aarch64: change the Capstone mnemonic when deleting operands
nkaretnikov Apr 2, 2019
bedcfb5
aarch64: do not change 'cpu.instruction.cc'
nkaretnikov Apr 3, 2019
93aac5f
aarch64: clean up the docstring of sys_readlink
nkaretnikov Apr 7, 2019
bb44e36
aarch64: partially implement readlinkat
nkaretnikov Apr 7, 2019
9325e63
aarch64: add stxr and stlxr
nkaretnikov Apr 7, 2019
5d1598c
aarch64: add a "Hello, world!" demo
nkaretnikov Apr 4, 2019
76cc0fa
aarch64: allow to test symbolic values
nkaretnikov Apr 12, 2019
66f1af7
aarch64: disable asserts for symbolic values in bitwise functions
nkaretnikov Apr 12, 2019
c809c2c
aarch64: fix the sizes for symbolic values in bitwise functions
nkaretnikov Apr 12, 2019
e01d253
aarch64: do not compute the carry unless necessary
nkaretnikov Apr 12, 2019
665c5d7
aarch64: make 'COND_MAP' work with symbolic values
nkaretnikov Apr 12, 2019
06ff5cb
aarch64: make 'write' work with symbolic values
nkaretnikov Apr 12, 2019
b312c08
aarch64: make 'nzcv' work with symbolic values
nkaretnikov Apr 12, 2019
5d7d779
aarch64: remove a warning that floods the test output
nkaretnikov Apr 12, 2019
b0cbbcb
aarch64: make '_adds_subs_extended_register' work with symbolic values
nkaretnikov Apr 12, 2019
6ac9df5
aarch64: make '_add_sub_vector' work with symbolic values
nkaretnikov Apr 12, 2019
e1f4605
aarch64: make '_add_with_carry' work with symbolic values
nkaretnikov Apr 12, 2019
820147b
aarch64: make '_ccmp_imm_reg' work with symbolic values
nkaretnikov Apr 12, 2019
47e713f
aarch64: make '_cmeq' work with symbolic values
nkaretnikov Apr 12, 2019
d70de34
aarch64: make '_ADDP_vector' work with symbolic values
nkaretnikov Apr 12, 2019
0721525
aarch64: make '_ANDS_immediate' work with symbolic values
nkaretnikov Apr 12, 2019
27889de
aarch64: make '_ANDS_shifted_register' work with symbolic values
nkaretnikov Apr 12, 2019
d848b8b
aarch64: make 'B_cond' work with symbolic values
nkaretnikov Apr 12, 2019
829ad1e
aarch64: make 'BICS' work with symbolic values
nkaretnikov Apr 12, 2019
c13eea9
aarch64: make 'CLZ' work with symbolic values
nkaretnikov Apr 12, 2019
3d6d917
aarch64: make 'CSEL' work with symbolic values
nkaretnikov Apr 12, 2019
d1ffac1
aarch64: make 'CSINC' work with symbolic values
nkaretnikov Apr 12, 2019
ddaf9f5
aarch64: make 'CSINV' work with symbolic values
nkaretnikov Apr 12, 2019
9c66033
aarch64: make 'DUP' work with symbolic values
nkaretnikov Apr 12, 2019
02a392b
aarch64: make '_ORR_vector_register' work with symbolic values
nkaretnikov Apr 12, 2019
222cc99
aarch64: make 'RBIT' work with symbolic values
nkaretnikov Apr 12, 2019
30350dc
aarch64: make 'REV' work with symbolic values
nkaretnikov Apr 12, 2019
8dd822e
aarch64: make 'SBFM' work with symbolic values
nkaretnikov Apr 12, 2019
dbd7242
aarch64: make 'UDIV' work with symbolic values
nkaretnikov Apr 12, 2019
ced879a
aarch64: make 'UMOV' work with symbolic values
nkaretnikov Apr 12, 2019
5f5f4b2
aarch64: make 'UMULH' work with symbolic values
nkaretnikov Apr 12, 2019
d47f9d7
aarch64: make sure there are some constraints before testing
nkaretnikov Apr 12, 2019
d53782f
aarch64: add a method for setting registers
nkaretnikov Apr 15, 2019
bb57ca8
aarch64: make adr tests work with symbolic values
nkaretnikov Apr 15, 2019
e6edd11
aarch64: make adrp tests work with symbolic values
nkaretnikov Apr 15, 2019
d7cbcdd
aarch64: make b tests work with symbolic values
nkaretnikov Apr 15, 2019
f9dee7a
aarch64: make bl tests work with symbolic values
nkaretnikov Apr 15, 2019
704435b
aarch64: make blr tests work with symbolic values
nkaretnikov Apr 15, 2019
381cca1
aarch64: make br tests work with symbolic values
nkaretnikov Apr 15, 2019
b3c205b
aarch64: make cbnz tests work with symbolic values
nkaretnikov Apr 15, 2019
d2ee67a
aarch64: make cbz tests work with symbolic values
nkaretnikov Apr 15, 2019
01dcfe0
aarch64: make ldaxr tests work with symbolic values
nkaretnikov Apr 15, 2019
f2da8bb
aarch64: make ldp tests work with symbolic values
nkaretnikov Apr 15, 2019
a02f85e
aarch64: make ldr tests work with symbolic values
nkaretnikov Apr 15, 2019
930b0e0
aarch64: make ldrb tests work with symbolic values
nkaretnikov Apr 15, 2019
58bc101
aarch64: make ldrh tests work with symbolic values
nkaretnikov Apr 15, 2019
74d9c45
aarch64: make ldrsw tests work with symbolic values
nkaretnikov Apr 15, 2019
81b9797
aarch64: make ldur tests work with symbolic values
nkaretnikov Apr 15, 2019
98d1fc9
aarch64: make ldxr tests work with symbolic values
nkaretnikov Apr 15, 2019
a9a5ab9
aarch64: add a decorator for skipping symbolic tests
nkaretnikov Apr 15, 2019
e1f4d95
aarch64: skip 'test_dczid_el0' for symbolic values
nkaretnikov Apr 15, 2019
db91ce7
aarch64: skip 'test_dmb' for symbolic values
nkaretnikov Apr 15, 2019
2d62cdb
aarch64: make mov tests work with symbolic values
nkaretnikov Apr 15, 2019
d44bb6c
aarch64: skip immediate mov tests for symbolic values
nkaretnikov Apr 15, 2019
3034016
aarch64: skip movk tests for symbolic values
nkaretnikov Apr 15, 2019
a2fac77
aarch64: skip movn tests for symbolic values
nkaretnikov Apr 15, 2019
92ba5e1
aarch64: skip movz tests for symbolic values
nkaretnikov Apr 15, 2019
73be404
aarch64: make a nop test work with symbolic values
nkaretnikov Apr 15, 2019
61352c8
aarch64: make ret tests work with symbolic values
nkaretnikov Apr 15, 2019
0b6adb6
aarch64: skip svc tests for symbolic values
nkaretnikov Apr 15, 2019
70586ff
aarch64: make tbnz tests work with symbolic values
nkaretnikov Apr 15, 2019
8c58e85
aarch64: make tbz tests work with symbolic values
nkaretnikov Apr 15, 2019
71b2aad
aarch64: make ld1 tests work with symbolic values
nkaretnikov Apr 16, 2019
fe14e41
aarch64: add a "basic" demo
nkaretnikov Apr 17, 2019
75c1df8
Merge .travis.yml from Master
Apr 23, 2019
4c67d0f
codeclimate: add missing blank lines
nkaretnikov Apr 23, 2019
0c17814
codeclimate: remove extra in-between whitespace
nkaretnikov Apr 23, 2019
df5e5d8
codeclimate: do not use spaces with keyword arguments
nkaretnikov Apr 23, 2019
081f58f
codeclimate: remove extra blank lines
nkaretnikov Apr 23, 2019
6b06b77
codeclimate: put brackets on the same line
nkaretnikov Apr 23, 2019
67f173f
codeclimate: add missing in-between whitespace
nkaretnikov Apr 23, 2019
65db237
codeclimate: align function arguments properly
nkaretnikov Apr 23, 2019
5a24ed9
codeclimate: reformat the if statement
nkaretnikov Apr 23, 2019
edb601f
codeclimate: use def instead of lambda
nkaretnikov Apr 23, 2019
4af6f6d
codeclimate: check membership properly
nkaretnikov Apr 23, 2019
2f23935
codeclimate: replace tabs with spaces
nkaretnikov Apr 23, 2019
dde887b
codeclimate: catch a specific exception
nkaretnikov Apr 23, 2019
8273dce
codeclimate: indent properly
nkaretnikov Apr 23, 2019
420c551
codeclimate: move an import to its place
nkaretnikov Apr 23, 2019
b743f3b
codeclimate: rename arguments for nicer alignment
nkaretnikov Apr 23, 2019
db06dbc
aarch64: be more consistent when naming arguments
nkaretnikov Apr 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ os:
- linux
language: python
python:
- 3.6.5
- 3.6.6

stages:
- prepare
Expand All @@ -14,7 +14,7 @@ stages:
env:
global:
- CC_TEST_REPORTER_ID=db72f1ed59628c16eb0c00cbcd629c4c71f68aa1892ef42d18c7c2b8326f460a
- JOB_COUNT=2 # Two jobs generate test coverage
- JOB_COUNT=3 # Three jobs generate test coverage: ethereum, native, and other
- PYTHONWARNINGS="default::ResourceWarning" # Enable ResourceWarnings
matrix:
- TEST_TYPE=examples
Expand All @@ -30,8 +30,8 @@ branches:
cache:
pip: true
directories:
- $HOME/virtualenv/python3.6.5/lib/python3.6/site-packages
- $HOME/virtualenv/python3.6.5/bin/
- $HOME/virtualenv/python3.6.6/lib/python3.6/site-packages
- $HOME/virtualenv/python3.6.6/bin/

jobs:
include:
Expand All @@ -45,7 +45,7 @@ jobs:
script:
- true
after_script:
- aws s3 sync "s3://manticore-testdata/coverage/$TRAVIS_COMMIT" coverage/
- aws s3 sync "s3://manticore-testdata/coverage/$TRAVIS_COMMIT" coverage/
- ./cc-test-reporter sum-coverage --output - --parts $JOB_COUNT coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -

install:
Expand All @@ -57,4 +57,3 @@ script:
after_success:
- ./cc-test-reporter format-coverage -t coverage.py -o "coverage/codeclimate.$TEST_TYPE.json"
- aws s3 sync coverage/ "s3://manticore-testdata/coverage/$TRAVIS_COMMIT"

Binary file added examples/script/aarch64/basic
Binary file not shown.
28 changes: 28 additions & 0 deletions examples/script/aarch64/basic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// gcc -g -static -o basic basic.c

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char* argv[], char* envp[]){
unsigned int cmd;

if (read(0, &cmd, sizeof(cmd)) != sizeof(cmd))
{
printf("Error reading stdin!");
exit(-1);
}

if (cmd > 0x41)
{
printf("Message: It is greater than 0x41\n");
}
else
{
printf("Message: It is less than or equal to 0x41\n");
}

return 0;
}


71 changes: 71 additions & 0 deletions examples/script/aarch64/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env python3

import os
import struct
import sys

from manticore.native import Manticore

# Examples:
# printf "\x41\x00\x00\x00" | PYTHONPATH=. ./examples/script/aarch64/basic.py
# printf "++\x00\x00" | PYTHONPATH=. ./examples/script/aarch64/basic.py
# printf "++++" | PYTHONPATH=. ./examples/script/aarch64/basic.py
# printf "ffffff" | PYTHONPATH=. ./examples/script/aarch64/basic.py

DIR = os.path.dirname(__file__)
FILE = os.path.join(DIR, 'basic')
STDIN = sys.stdin.readline()

# Avoid writing anything to 'STDIN' here. Do it in the 'init' hook as that's
# more flexible.
m = Manticore(FILE, concrete_start='', stdin_size=0)


@m.init
def init(state):
state.platform.input.write(state.symbolicate_buffer(STDIN, label='STDIN'))


# Hook the 'if' case.
@m.hook(0x4006bc)
def hook_if(state):
print('hook if')
state.abandon()


# Hook the 'else' case.
@m.hook(0x4006cc)
def hook_else(state):
print('hook else')
# See how the constraints are affected by input.
print_constraints(state, 6)

w0 = state.cpu.W0

if isinstance(w0, int): # concrete
print(hex(w0))
else:
print(w0) # symbolic

solved = state.solve_one(w0)
print(struct.pack("<I", solved))


# Hook 'puts' in the 'else' case.
@m.hook(0x4006d4)
def hook_puts(state):
print('hook puts')
cpu = state.cpu
print(cpu.read_string(cpu.X0))


def print_constraints(state, nlines):
i = 0
for c in str(state.constraints).split('\n'):
if i >= nlines:
break
print(c)
i += 1


m.run()
50 changes: 50 additions & 0 deletions examples/script/aarch64/count_instructions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env python3

import os

from manticore.native import Manticore

# Modified 'count_instructions.py' to demonstrate execution of a
# statically-linked "Hello, world!" AArch64 binary.

DIR = os.path.dirname(__file__)
FILE = os.path.join(DIR, 'hello42')

if __name__ == '__main__':
m = Manticore(FILE)

with m.locked_context() as context:
context['count'] = 0

@m.hook(None)
def explore(state):
with m.locked_context() as context:
context['count'] += 1

if state.cpu.PC == 0x406f10: # puts
s = state.cpu.read_string(state.cpu.X0)
assert s == 'hello'
print(f'puts argument: {s}')

elif state.cpu.PC == 0x40706c: # puts result
result = state.cpu.X0
assert result >= 0
print(f'puts result: {result}')

elif state.cpu.PC == 0x415e50: # exit
status = state.cpu.X0
syscall = state.cpu.X8
assert syscall == 94 # sys_exit_group
print(f'exit status: {status}')

def execute_instruction(self, insn, msg):
print(f'{msg}: 0x{insn.address:x}: {insn.mnemonic} {insn.op_str}')

m.subscribe('will_execute_instruction', lambda self, state, pc, insn:
execute_instruction(self, insn, 'next'))
m.subscribe('did_execute_instruction', lambda self, state, last_pc, pc, insn:
execute_instruction(self, insn, 'done'))

m.run(procs=1)

print(f"Executed {m.context['count']} instructions")
Binary file added examples/script/aarch64/hello42
Binary file not shown.
8 changes: 8 additions & 0 deletions examples/script/aarch64/hello42.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// gcc -g -static -o hello42 hello42.c
#include <stdio.h>

int main()
{
puts("hello");
return 42;
}
Loading