I came across this assembly code and when trying to compile it it said there was an error. Not know much about assembly i was wondering if someone could help me. Thanks in advance.
JMP 0x1F
POPL %ESI
MOVL %ESI, 0x8(%ESI)
XORL %EAX, %EAX
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.
Put a label at the destination of the
JMPand use that instead of the constant0x1F. Alternatively, knowing the length of the instruction, use a construct such asJMP .+length+offset, in this case length is 2 bytes, so it becomesJMP .+0x21. This will be then encoded as0xeb 0x1fwhich is what the phrack link apparently wants. Relative jumps in x86 are encoded as offsets from the start of the next instruction, if you don’t know the instruction length you can put a label after the instruction like so:(Local labels may be helpful, but in this particular case
1f+0x1fwould have been very confusing.)Be advised, when assembling code the assembler might pick an encoding you don’t expect and hence mess up your offsets if you don’t use labels.