Apr 15 2010

What does CALL instruction do in assembly?

Category: Uncategorizedwuxicn @ 8:52 AM

CALL instruction do nothing except push IP into the stack (doesn’t like function call in C).
More specific, there’re 2 kinds of CALL:

1. Near call: if it’s a near call, the assembly does those two things:
1) push EIP into the stack,
2) set EIP to the address of beginning of your function.

2. Far call: if it’s a far call, the assembly does the following FOUR things:
1) push CS into the stack (save old code segment),
2) push EIP into the stack,
3) set CS to the new code segment which your function addressed,
4) set EIP to the beginning address of your function.

BTW, the RET instruction does the reverse operations.

Tags: ,


Apr 02 2010

x86寄存器

Category: Uncategorizedwuxicn @ 4:38 PM

INTEL 80×86 CPU有下面这些寄存器:

通用寄存器 (General Purpose Registers)
1. EAX (AX/AL/AH) Accumulator.
2. EBX (BX/BL/BH) Base
3. ECX (CX/CL/CH) Counter
4. EDX (DX/DL/DH) Data

注: Exx 是32位寄存器,在80386+的CPU才有。
Continue reading “x86寄存器”

Tags: ,