assembly - Hand-assembling an x86 call instruction -


Curiously, I decided to assemble some X86 code. I am still recovering, but I can not understand the proper encoding for the call directive.

I think that this is basically the E8 xx Xx xx xx , where xx xx xx xx is the one that I want to jump in.

The way I tried this encoding, it is (NASM):

This is included and the link is ok, but the program crashes.

I saw how the NSAM has given the instruction call_printf , and it generates a different xx xx xx xx than I do, I wonder if I was specifying the address wrong or something, but the code

  times 512 nop dd _printf times 512 nop  

a gazillion 90 s is around the same address I got from the gathered call , which means that I do not have the actual address of _printf which should be

(Even: i call Was curious about other encoding, which starts with ) FF . What is the difference?)

0xE8 is used with relative address, then the following instructions are used in the A800 00 00 00: Some encodings starting with 0xFF can be used for indirect calls, where the addresses are stored in the register or memory of the destination. If you want to take action on a specific address, Can:

  mov eax, 0x12345678; Address of the process (not relative) Call eX  

0x 9A encoding allows you to call away the updated CS-register also. For example: 0x1234: 0x55667788

Update the value of the command indicator for 0x1234 for the CS register and 0x55667788. The return address is also pushed to stack values ​​with both CS and instructions.

I recommend that for more information about different encodings.


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -