Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
X86 assembly language
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Stack instructions=== The x86 architecture has hardware support for an [[Call stack|execution stack]] mechanism. Instructions such as <code>push</code>, <code>pop</code>, <code>call</code> and <code>ret</code> are used with the properly set up stack to pass parameters, to allocate space for local data, and to save and restore call-return points. The <code>ret</code> ''size'' instruction is very useful for implementing space efficient (and fast) [[calling convention]]s where the callee is responsible for reclaiming stack space occupied by parameters. When setting up a [[stack frame]] to hold local data of a [[recursion (computer science)|recursive procedure]] there are several choices; the high level <code>enter</code> instruction (introduced with the 80186) takes a ''procedure-nesting-depth'' argument as well as a ''local size'' argument, and ''may'' be faster than more explicit manipulation of the registers (such as <code>push bp</code> ; <code>mov bp, sp</code> ; <code>sub sp, ''size''</code>). Whether it is faster or slower depends on the particular x86-processor implementation as well as the calling convention used by the compiler, programmer or particular program code; most x86 code is intended to run on x86-processors from several manufacturers and on different technological generations of processors, which implies highly varying [[microarchitecture]]s and [[microcode]] solutions as well as varying [[logic gate|gate]]- and [[transistor]]-level design choices. The full range of addressing modes (including ''immediate'' and ''base+offset'') even for instructions such as <code>push</code> and <code>pop</code>, makes direct usage of the stack for [[integer]], [[floating-point arithmetic|floating point]] and [[memory address|address]] data simple, as well as keeping the [[Application binary interface|ABI]] specifications and mechanisms relatively simple compared to some RISC architectures (require more explicit call stack details).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)