| View previous topic :: View next topic |
| Author |
Message |
Xblade Of Heaven Master Cheater
Reputation: 0
Joined: 16 Oct 2005 Posts: 395 Location: DEAD
|
Posted: Sun Dec 14, 2014 8:34 am Post subject: small problem moving a value under x64 bits |
|
|
Hi all, i try explain me problem trying move a reg value to other reg and the stored value is a bit confused.
this is the code:
| Code: | push rax
push rbx
mov rbx,rcx
test rbx,rbx
jz short _code
mov rbx,dword ptr[rbx+8] //value 8 bytes stored FFFFFFFBXXXXXXXX
test rbx,rbx
jz short _code
cmp dword ptr [rbx+10],'string' //string no exist in FFFFFFFBXXXXXXXX but yes in 00000000XXXXXXXX no idea why show me FFFFFFFBXXXXXXXX
jne short _code
//BLABLABLA
_code:
pop rbx
pop rax |
debugging test rbx,rbx under mov rbx,dword ptr[rbx+8] i can see FFFFFFFBXXXXXXXX onto rbx register, i cant understand why this happen, i need move and store on rbx only 0000000XXXXXXXX no FFFFFFFBXXXXXXX because here dont exist the string, any can help me why this happen?
_________________
Welcome to the Hell.
 |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Sun Dec 14, 2014 8:49 am Post subject: |
|
|
| Code: |
mov rbx,dword ptr[rbx+8]
|
does not exist
it gets automatically upscaled to
| Code: |
mov rbx,qword ptr [rbx+8]
|
to limit it to 4 bytes, use
| Code: |
xor rbx,rbx
mov ebx,dword ptr[rbx+8]
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Xblade Of Heaven Master Cheater
Reputation: 0
Joined: 16 Oct 2005 Posts: 395 Location: DEAD
|
Posted: Sun Dec 14, 2014 9:07 am Post subject: |
|
|
thanks again db, using xor rbx,rbx the value stored is now correct.
regards
_________________
Welcome to the Hell.
 |
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun Dec 14, 2014 4:26 pm Post subject: |
|
|
I often see such things:
movzx rbx,byte ptr [rbx+08]
movsx rbx,byte ptr [rbx+08]
movzx rbx,word ptr [rbx+08]
movsx rbx,word ptr [rbx+08]
movsxd rbx,dword ptr [rbx+08]
also, simple "MOV EAX, EBX" automatically zeroes upper 32 bits of RAX register
- 64-bit operands generate a 64-bit result in the destination general-purpose register.
- 32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in the destination general-purpose register.
- 8-bit and 16-bit operands generate an 8-bit or 16-bit result. The upper 56 bits or 48 bits (respectively) of the destination general-purpose register are not be modified by the operation. If the result of an 8-bit or 16-bit operation is intended for 64-bit address calculation, explicitly sign-extend the register to the full 64-bits.
_________________
|
|
| Back to top |
|
 |
Xblade Of Heaven Master Cheater
Reputation: 0
Joined: 16 Oct 2005 Posts: 395 Location: DEAD
|
Posted: Sun Dec 14, 2014 6:50 pm Post subject: |
|
|
thanks too mgr.inz.Player
_________________
Welcome to the Hell.
 |
|
| Back to top |
|
 |
|