flat assembler
Message board for the users of flat assembler.

Index > Windows > Addition Parameter x64

Author
Thread Post new topic Reply to topic
yq8



Joined: 08 May 2015
Posts: 15
yq8 03 Dec 2015, 17:07
Hi,

Can someone help me to convert this asm snippet from 32 format to 64 bit format:

Code:
mov eax, dword[esp+0x4]
mov ecx, 0xd
add eax, ecx
ret 
    


my idea wold be this :

Code:
mov rax, qword[rsp+0x8]
mov rcx, 0xd
add rax, rcx
ret     


but thats wrong >.<
The x64 calling conventiosna re different.
params are passed in registers, and I dunno how to do that.
Can someone help me to adjust my snippet?
Post 03 Dec 2015, 17:07
View user's profile Send private message Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 767
tthsqe 03 Dec 2015, 18:20
Hello yq8. It depends if you want the linux or MS versions.
https://en.wikipedia.org/wiki/X86_calling_conventions
For MS, the first four int args are passed in rcx, rdx, r8, r9 and the return is rax
Code:
mov rax, rcx
add rax, 0x0d
ret

or

lea rax, [rcx+0x0d]
ret    
Post 03 Dec 2015, 18:20
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.