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

keystone failing on certain instructions #546

Open
Caesurus opened this issue Jan 9, 2023 · 0 comments
Open

keystone failing on certain instructions #546

Caesurus opened this issue Jan 9, 2023 · 0 comments

Comments

@Caesurus
Copy link

Caesurus commented Jan 9, 2023

When I get assembly this way from gcc:

$echo " " |gcc -xc -S -o- - -m64
        .file   ""
        .text
        .ident  "GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0"
        .section        .note.GNU-stack,"",@progbits
        .section        .note.gnu.property,"a"
        .align 8
        .long    1f - 0f
        .long    4f - 1f
        .long    5
0:
        .string  "GNU"
1:
        .align 8
        .long    0xc0000002
        .long    3f - 2f
2:
        .long    0x3
3:
        .align 8
4:

The .long lines without 0x are causing issues:

$ kstool x64 '.long    3f - 2f'
ERROR: failed on ks_asm() with count = 0, error = 'Invalid directive (KS_ERR_ASM_DIRECTIVE_INVALID)' (code = 139)

But if they are reformatted:

$ kstool x64 '.long    0x3f - 0x2f'
.long    0x3f - 0x2f = [ 10 00 00 00 ]

It's fine.

Additionally I have errors on these as well:

kstool x64 'movb     (%rcx,%rdx), %dl'
ERROR: failed on ks_asm() with count = 0, error = 'Invalid operand (KS_ERR_ASM_INVALIDOPERAND)' (code = 512)

and

kstool x64 'leal     -48(%rax,%rdx), %eax'
ERROR: failed on ks_asm() with count = 0, error = 'Invalid operand (KS_ERR_ASM_INVALIDOPERAND)' (code = 512)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant