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

iacaMarks.h compatibility #88

Closed
hpcbern opened this issue Jun 21, 2022 · 1 comment
Closed

iacaMarks.h compatibility #88

hpcbern opened this issue Jun 21, 2022 · 1 comment
Assignees

Comments

@hpcbern
Copy link

hpcbern commented Jun 21, 2022

Looking at iacaMarks.h for IACA version 2.1, 2.2, 2.3 and 3.0,
there's

$ tail iacaMarks.h
/**************** asm *****************
;START_MARKER
mov ebx, 111
db 0x64, 0x67, 0x90

;END_MARKER
mov ebx, 222
db 0x64, 0x67, 0x90

**************************************/

which leads (e.g. using gcc -S) to

          movl $111, %ebx
          .byte 0x64, 0x67, 0x90

and

          movl $222, %ebx
          .byte 0x64, 0x67, 0x90

which corresponds to the find_marked_kernel_x86ATT

nop_bytes = ["100", "103", "144"]

(cmp. marker_utils, line 58)

In this context, the OSACA parser seems not to be aware of the hex-notation
and that 0x64 is equal to 100, etc.
Looking at match_bytes there's a just a string comparison

if extracted_bytes[0 : len(byte_list)] == byte_list:

(cmp. marker_utils, line 191)
and unfortunately (['0x64', '0x67', '0x90'] != ['100', '103', '144'])
the markers are not found.

They have to be manually converted from hexadecimal to decimal
or (alternatively) the -l Option to manually set the lines range has to be used.

A quick hack could be just to replace the match_bytes line 191 (see above) with

if all([int(e1,0) == int(e2,0) for e1, e2 in zip(extracted_bytes[0 : len(byte_list)], byte_list)]):

Maybe converting and storing (& comparing) bytes as integers instead of strings might be another option.

@JanLJL
Copy link
Collaborator

JanLJL commented Jun 22, 2022

Hi @hpcbern,
This should be fixed now and on PyPI with the next release.
If not, please feel to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants