liveBook · Manning

Hardware register

As explained in Embedded Software with Rust

A processor register is a small storage location directly accessible to the processor for holding values during execution.

A processor register is a small storage location the processor can access directly while executing instructions. Low-level Rust code can interact with CPU registers or issue specific instructions using assembly features. section 5.5

Registers also carry function arguments and return values according to a platform’s procedure call standard. On Arm Cortex-M, ordinary arguments use R0–R3 first; additional arguments spill to the stack. section 8.1.2

A call with five arguments

For a function taking five 32-bit arguments, the first four go in R0–R3, the fifth goes on the stack, and the return value comes back in R0. section 8.1.2

Figure 8.1 AAPCS register allocation
CH08 F01 Cabanis

See how the Arm procedure call standard assigns arguments and return values to registers. section 8.1.2

How Embedded Software with Rust covers it

How deep it goes
Defines direct processor access and details Arm argument allocation, return values, and stack spillover.
Examples
Illustrates a five-argument function call with four arguments in registers and one on the stack.
What you can do after
Understand how Arm Cortex-M function calls allocate ordinary arguments and return values across registers and the stack.
How it connects
Connects registers to assembly, application binary interfaces, calling conventions, and stack use.

Also explained in

Compare how 9 books explain hardware register →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Embedded Software with Rust. The section links point to the parts of the book it draws on.