Assuming 32-bit x86, use the following function:
get_eip: mov eax, [esp]
ret
Then, to get the value of EIP in EAX, simply:
call get_eip
More Related Contents:
- Referencing the contents of a memory location. (x86 addressing modes)
- How to convert a binary integer number to a hex string?
- Which 2’s complement integer operations can be used without zeroing high bits in the inputs, if only the low part of the result is wanted?
- What is the stack engine in the Sandybridge microarchitecture?
- How do you use gcc to generate assembly code in Intel syntax?
- What do the E and R prefixes stand for in the names of Intel 32-bit and 64-bit registers?
- What is stack frame in assembly?
- Does the Intel Memory Model make SFENCE and LFENCE redundant?
- MOV src, dest (or) MOV dest, src?
- What are the names of the new X86_64 processors registers?
- problem in understanding mul & imul instructions of Assembly language
- x64 instruction encoding and the ModRM byte
- Random number in emu8086 without using DOS/BIOS calls?
- How to write self-modifying code in x86 assembly
- gas: too many memory reference
- Why do we need to disambiguate when adding an immediate value to a value at a memory address
- Why is no value returned if a function does not explicity use ‘ret’
- How to determine if ModR/M is needed through Opcodes?
- “enter” vs “push ebp; mov ebp, esp; sub esp, imm” and “leave” vs “mov esp, ebp; pop ebp”
- How to multiply a register by 37 using only 2 consecutive leal instructions in x86?
- What does “rep; nop;” mean in x86 assembly? Is it the same as the “pause” instruction?
- Convert string to int. x86 32 bit Assembler using Nasm
- Multiplying arbitrarily long sequences of ASCII digits by a single-digit multiplier
- How to produce a minimal BIOS hello world boot sector with GCC that works from a USB stick on real hardware?
- Segment size in x86 real mode
- Arithmetic identities and EFLAGS
- Does using xor reg, reg give advantage over mov reg, 0? [duplicate]
- SAR command in X86 assembly with one parameter
- Substitutes for x86 assembly ‘call’ instruction?
- What is the compatible subset of Intel’s and AMD’s x86-64 implementations?