Added Corrected Documentation
This commit is contained in:
@@ -102,8 +102,23 @@ constant pc_num : reg_number := to_reg_number(15);
|
||||
Registers \inlineasm{r0} to \inlineasm{r11} can be used without special consideration as general purpose registers.
|
||||
Registers \inlineasm{r12} (stack pointer) and \inlineasm{r13} (link register) can also be used as general purpose register but are additionally altered with special instructions.
|
||||
\subsection{Stack Pointer}
|
||||
The stackpointer (\inlineasm{r12}) is used when jumping into or out of interrupt handlers (i.e. external interrupts or \inlineasm{trap} instructions and \inlineasm{reti}).
|
||||
It must be set to the correct address of the stack, before any interrupt occurs.
|
||||
The stack pointer (\inlineasm{r12}) is used when jumping into or out of interrupt handlers (i.e. external interrupts or \inlineasm{trap} instructions and \inlineasm{reti}).
|
||||
It must be set to the correct address of the stack, before any interrupt is allowed to occur.
|
||||
In the default configuration, stack grows downwards.
|
||||
The stack pointer should be word-aligned at all times.
|
||||
|
||||
The interpretation of the stack pointer is always 'The current stack pointer points to the topmost element on the stack'.
|
||||
When interfacing the stack pointer manually, always adhere to the following rules:
|
||||
\begin{itemize}
|
||||
\nolistskip
|
||||
\item When writing to the stack (push), always decrement the stack before writing your element.
|
||||
\item When reading from the stack (pop), read your element, then decrement the stack pointer.
|
||||
\end{itemize}
|
||||
Only when adhering to these rules the integrity of the stack can be ensured.
|
||||
|
||||
The initial stack pointer position does not need to be a memory address,
|
||||
but the word address below it needs to be valid.
|
||||
|
||||
\subsection{Link Register}
|
||||
The link register (\inlineasm{r13}) is set by the \inlineasm{call} instruction.
|
||||
This allows for flexible function returns using the pseudo instruction \inlineasm{ret} (a branch to the link register).
|
||||
|
||||
Reference in New Issue
Block a user