flat assembler
Message board for the users of flat assembler.

Index > Linux > 64bit - how to load bit value and printf it

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 12937
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 27 Mar 2016, 03:11
this seems troublesome, are there other methods?

Code:
 mov    rdi,f3a
 xor    rax,rax
 call   [SDL_GetVersion]

 mov    rdi,f3

 xor    r8,r8
 mov    r8b,[f3a]
 mov    rsi,r8

 xor    r9,r9
 mov    r9b,[f3b]
 mov    rdx,r9

 xor    r10,r10
 mov    r10b,[f3c]
 mov    rcx,r10

 xor    rax,rax
 call   [printf]

segment readable writeable
f3      db 'SDL version %d.%d.%d',10,0
f3a     db 0
f3b     db 0
f3c     db 0
    


SDL version 2.0.4
Post 27 Mar 2016, 03:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 27 Mar 2016, 04:36
Is this for Linux or Windows?
Post 27 Mar 2016, 04:36
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12937
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 27 Mar 2016, 05:15
sorry revolution,
this for linux.
Post 27 Mar 2016, 05:15
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 27 Mar 2016, 11:20
Moved to Linux.
Post 27 Mar 2016, 11:20
View user's profile Send private message Visit poster's website Reply with quote
redsock



Joined: 09 Oct 2009
Posts: 434
Location: Australia
redsock 27 Mar 2016, 23:18
Maybe I am missing something here, but at the very least:
Code:
        mov     rdi, f3a
        call    PLT [SDL_GetVersion]

        mov     rdi, f3
        movzx   esi, byte [f3a]
        movzx   edx, byte [f3b]
        movzx   ecx, byte [f3c]
        call    PLT [printf]
    
rax doesn't need to be defined prior to a normal register-argument function, and the argument order for x86_64 ABI non-syscall is rdi, rsi, rdx, rcx, r8, r9.

Did I miss something?

_________________
2 Ton Digital - https://2ton.com.au/
Post 27 Mar 2016, 23:18
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 12937
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 0010456
sleepsleep 30 Mar 2016, 11:42
thanks redsock, =)
Post 30 Mar 2016, 11:42
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.