os_debug_dump_rax clobbers upper 32 bits of RAX #79
Closed
macpacheco
started this conversation in
Show and tell
Replies: 2 comments 3 replies
-
Thank you for reporting this! I’ll look into the fix. Anytime you use an opcode against the low 32-bit of a 64-bit register it will clear the upper 32-bits. At least it’s handy for clearing a 64-bit register:
Both do the exact same but the xor against eax is a slightly shorter instruction. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Never rolling EAX (use RAX instead) fixes it:
Output: |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dumps correctly first time, then dumps 0000000090ABCDEF
Here's the culprit:
mov rax,0x1234567890ABCDEF
rol eax, 8
rol eax, 8
rol eax, 16
; now rax contains: 0000000090ABCDEF
Need to add a push RAX, pop RAX on os_debug_dump_rax to fix. However the clever way RET was reused for RAX, RAX, AX, AL dump, the code needs to be refactored.
Beta Was this translation helpful? Give feedback.
All reactions