Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


64bit address in machin code

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
mrgorungo
Newbie cheater
Reputation: 0

Joined: 20 May 2019
Posts: 12

PostPosted: Wed Sep 21, 2022 9:14 am    Post subject: 64bit address in machin code Reply with quote

so if its 32bit
mov r13,[00400000]
will be shown as 4C 8B 2C 25 [00 00 40 00] in machine code
so i can tell 00 00 40 00 is little endian of [00400000]

but when it comes to 64bit
mov r13,[123456789]
the machine code will be
4C 8B 2D [78 7B 90 E1]
and idk how to convert [78 7B 90 E1] to [123456789]

any help?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 143

Joined: 06 Jul 2014
Posts: 4380

PostPosted: Wed Sep 21, 2022 12:38 pm    Post subject: Reply with quote

RIP-relative addressing

RIP is the instruction pointer. That register contains the address of the next instruction to execute.
RIP-relative addressing will address some memory location relative to RIP. It usually uses a signed 32-bit displacement.
e.g. if `mov r13,[123456789]` is located at the address 41B4EC0A, then the relative 32-bit offset would be 0x123456789 - 0x41B4EC0A - 7 = 0xE1907B78.
( `- 7` because RIP is the address of the next instruction; `0xE1907B78` as bytes would be 78 7B 90 E1 )

IIRC there is also an addressing mode that accesses the first 4 GiB of the address space with a direct offset

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
mrgorungo
Newbie cheater
Reputation: 0

Joined: 20 May 2019
Posts: 12

PostPosted: Wed Sep 21, 2022 1:09 pm    Post subject: Reply with quote

ParkourPenguin wrote:
RIP-relative addressing

RIP is the instruction pointer. That register contains the address of the next instruction to execute.
RIP-relative addressing will address some memory location relative to RIP. It usually uses a signed 32-bit displacement.
e.g. if `mov r13,[123456789]` is located at the address 41B4EC0A, then the relative 32-bit offset would be 0x123456789 - 0x41B4EC0A - 7 = 0xE1907B78.
( `- 7` because RIP is the address of the next instruction; `0xE1907B78` as bytes would be 78 7B 90 E1 )

IIRC there is also an addressing mode that accesses the first 4 GiB of the address space with a direct offset


thanks for explaining, understood!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites