English 中文(简体)
st中具体说明的返回地址如何?
原标题:How is return address specified in stack?

这就是我对以下声明的异议:<代码>功能(1,2,3);:

movl   $0x3,0x8(%esp)
movl   $0x2,0x4(%esp)
movl   $0x1,(%esp)
call   0x4012d0 <_Z8functioniii>

看来“ret Address根本不推入 st,因此ret work?

问题回答

关于X86处理器(如你的组装语言), :>指示将关于批量和转移控制的收益地址推向该功能。

因此,在进入职能时,分站在一份返回地址上,准备在<代码>ret上登入方案柜(EIP / RIP)。


并非所有的加工商结构都把返回地址放在了 st头上,常常有一套一个或多个登记册,以持有返回地址。 关于ARM处理器,BL指示将返回地址列入特定登记册(,或链接登记册>),并将控制权转让给该功能。

ia64加工商有类似之处,但有几种可能的登记册(b0-b 7)可以接收返回地址,并在指示中加以具体说明(b0为违约)。

理想的情况是,<代码> 电话/编码>发言应当考虑到这一点。 方案对下一个地点将推向 st。 当称为“次级常规”的职能完成时,当它遇到返回声明时,控制现在转向被推入 st线的地址,而且会蔓延。

它取决于ABI和架构,但如果返回地址在最后点上,它就产生了“<条码>查询/编码”指示的副作用,从而使之成为可能。

call pushes the current value of the RIP register (return address) to the stack + does the call
ret pops the return address(that call pushed) from the top of the stack (RSP register points there) and writes it in the RIP register.

例如,GNU/HCH箱:功能 f打字功能g,请看g。

http://www.ohchr.org。

... <- RSP (stack pointer shows top of stack) register points at this address
g s local vars
f s base pointer (old RBP value) <- RBP (base pointer) register points at this address
f s ret address (old RIP value) (this is what the call (from f) pushed, and what the ret (from g) will pop)
args that f called g with and didn t fit in the registers (I think on Windows this is different)
...

www.un.org/Depts/DGACM/index_spanish.htm High ADDRESS

g will free the local vars (movq %rsp, %rbp)
g will pop the "old RBP" and store it in RBP register (pop %rbp)
g will ret, which will modify RIP with the value that is stored where RSP points at

希望会有助于





相关问题
How can I do a CPU cache flush in x86 Windows?

I am interested in forcing a CPU cache flush in Windows (for benchmarking reasons, I want to emulate starting with no data in CPU cache), preferably a basic C implementation or Win32 call. Is there a ...

What are the names of the new X86_64 processors registers?

Where can I find the names of the new registers for assembly on this architecture? I am referring to registers in X86 like EAX, ESP, EBX, etc. But I d like them in 64bit. I don t think they are the ...

How do I disassemble raw 16-bit x86 machine code?

I d like to disassemble the MBR (first 512 bytes) of a bootable x86 disk that I have. I have copied the MBR to a file using dd if=/dev/my-device of=mbr bs=512 count=1 Any suggestions for a Linux ...

32bit application access to 64bit registry

I have an OS Shell written in 32bit that is replacing the Explorer.exe of a Vista machine. I run a utility which is also written in 32bit, which allows to switch between the Explorer shell and My ...

Left Shift Overflow on 68k/x86?

I heard that the Motorola 68000 and Intel x86 architectures handle overflow from left shifting differently. Specifically the 68k LSL vs. the Intel SAL/SHL assembly instructions. Does anyone know the ...

Translate a FOR to assembler

I need to translate what is commented within the method, to assembler. I have a roughly idea, but can t. Anyone can help me please? Is for an Intel x32 architecture: int secuencia ( int n, ...