What is Stack pointer?

The register that points to the current top of the stack; sp (x2) in RISC-V. In many ISAs the stack grows toward lower addresses.

Field: ISA & Assembly

Stack pointer in the explanations

Questions that mention Stack pointer (4)

  1. When a program calls a subroutine (function), which area is generally used to temporarily save the return address and similar information?
  2. In the standard RISC-V calling convention, when calling a function with ten integer arguments, where are the ninth and tenth passed?
  3. Where is a non-static local (automatic) variable declared inside a C function placed at run time?
  4. During a context switch, what must be saved for the process being switched out?

Related terms

Return address Calling convention Stack frame Context switch Page table Addressing mode Application binary interface (ABI) Assembler Branch delay slot Callee-saved register

Back to the glossary