Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Keystone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Third Party Mirrors
Keystone
Commits
c49c63a0
Commit
c49c63a0
authored
8 years ago
by
Fotis Loukos
Browse files
Options
Downloads
Patches
Plain Diff
Added regress test for jumps to absolute addresses
parent
f18b6e19
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
suite/regress/all_archs_branch_addr.py
+52
-0
52 additions, 0 deletions
suite/regress/all_archs_branch_addr.py
with
52 additions
and
0 deletions
suite/regress/all_archs_branch_addr.py
0 → 100755
+
52
−
0
View file @
c49c63a0
#!/usr/bin/python
# Test branches to absolute addresses for all architectures
# Github issue: #108
# Author: Fotis Loukos
from
keystone
import
*
import
regress
class
TestARM
(
regress
.
RegressTest
):
def
runTest
(
self
):
ks
=
Ks
(
KS_ARCH_ARM
,
KS_MODE_ARM
)
encoding
,
count
=
ks
.
asm
(
b
"
b #0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0x02
,
0x00
,
0x00
,
0xea
])
encoding
,
count
=
ks
.
asm
(
b
"
bl #0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0x02
,
0x00
,
0x00
,
0xeb
])
class
TestARM64
(
regress
.
RegressTest
):
def
runTest
(
self
):
ks
=
Ks
(
KS_ARCH_ARM64
,
0
)
encoding
,
count
=
ks
.
asm
(
b
"
b #0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0x04
,
0x00
,
0x00
,
0x14
])
encoding
,
count
=
ks
.
asm
(
b
"
bl #0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0x04
,
0x00
,
0x00
,
0x94
])
class
TestSPARC
(
regress
.
RegressTest
):
def
runTest
(
self
):
ks
=
Ks
(
KS_ARCH_SPARC
,
KS_MODE_BIG_ENDIAN
+
KS_MODE_SPARC32
)
encoding
,
count
=
ks
.
asm
(
b
"
b 0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0x10
,
0x80
,
0x00
,
0x04
])
class
TestMIPS
(
regress
.
RegressTest
):
def
runTest
(
self
):
ks
=
Ks
(
KS_ARCH_MIPS
,
KS_MODE_MIPS32
)
encoding
,
count
=
ks
.
asm
(
b
"
b 0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0x03
,
0x00
,
0x00
,
0x10
,
0x00
,
0x00
,
0x00
,
0x00
])
class
TestPPC
(
regress
.
RegressTest
):
def
runTest
(
self
):
ks
=
Ks
(
KS_ARCH_PPC
,
KS_MODE_PPC32
+
KS_MODE_BIG_ENDIAN
)
encoding
,
count
=
ks
.
asm
(
b
"
b 0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0x48
,
0x00
,
0x00
,
0x10
])
class
TestSystemZ
(
regress
.
RegressTest
):
def
runTest
(
self
):
ks
=
Ks
(
KS_ARCH_SYSTEMZ
,
KS_MODE_BIG_ENDIAN
)
encoding
,
count
=
ks
.
asm
(
b
"
j 0x1010
"
,
0x1000
)
self
.
assertEqual
(
encoding
,
[
0xa7
,
0xf4
,
0x00
,
0x08
])
if
__name__
==
'
__main__
'
:
regress
.
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment