section .data
fun:
add word[L+2],0x203
L: mov eax,0x1020304 ; this instruction including operand stored in 5 byte in memory
ret
what the “fun” function do? why eax will have a new value 0x1040604
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ok, you have a
mov eax, 0x1020304, with a 5-byte encoding (there is a 6-byte encoding as well, but let’s ignore that). So it looks like this (remember – little endian):Where L refers to the B8 and L+2 refers to the 03. Now if you add 0x0203 to it (remember – little endian), the 03 is added to the 03 and the 02 is added to the 02, so you get this:
Which is: