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
30c89a25
Commit
30c89a25
authored
8 years ago
by
Nguyen Anh Quynh
Browse files
Options
Downloads
Patches
Plain Diff
regress: add x86_nasm_directives.py for 'bits' directive for NASM syntax
parent
836ccd94
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
suite/regress/x86_nasm_directives.py
+29
-0
29 additions, 0 deletions
suite/regress/x86_nasm_directives.py
with
29 additions
and
0 deletions
suite/regress/x86_nasm_directives.py
0 → 100755
+
29
−
0
View file @
30c89a25
#!/usr/bin/python
# Nguyen Anh Quynh, 2016
# This is to test NASM directives
# Fill in the information in the form below when you create a new regression
# Github issue: #xxx
# Author: Nguyen Anh Quynh
from
keystone
import
*
import
regress
class
TestX86
(
regress
.
RegressTest
):
def
runTest
(
self
):
# Initialize Keystone engine
ks
=
Ks
(
KS_ARCH_X86
,
KS_MODE_32
)
# change the syntax to NASM
ks
.
syntax
=
KS_OPT_SYNTAX_NASM
# compile an instruction in NASM syntax
#encoding, count = ks.asm(b"bits 32\n add eax, ebx\nbits 16\nadd eax, ebx")
encoding
,
count
=
ks
.
asm
(
b
"
bits 32
\n
add eax, ebx
\n
bits 16
\n
add eax, ebx
"
)
# Assert the result
self
.
assertEqual
(
encoding
,
[
0x01
,
0xd8
,
0x66
,
0x01
,
0xd8
])
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