January 18, 2023

ARM Processor 101 -- the basics

The ARM is a 32 bit RISC processor.

But I have already lied to you. There is now 64 bit ARM, and in some arenas that were once dominated by 32 bit ARM, the game has clearly moved to the 64 bit chips.

32 bit ARM

Here we have a RISC processor with a load/store architecture (like any good RISC machine). There are 16 general purpose 32 bit registers. But that isn't quite true as the last 4 of these have special uses as follows: Some of these uses are by convention rather than being dictated by hardware, but woe unto you if you do otherwise.

Instruction are usually encoded as 32 bits. There is an alternate encoding in 16 bits called "thumb mode" but you are unlikely to run into it unless you work with microcontroller ARM chips.

64 bit ARM

Now you get twice as many registers (32 of them) and they are 64 bits in size.

Most 64 bit ARM chips can also run 32 bit code, but this is not guaranteed.

64 bit ARM does a clever trick to define a zero register "xzr". This is register 31, just like the 64 bit stack pointer but context determines if the instruction encoding references this register of zeros or if it references the stack.

Also note that the registers are named x0, x1 (rather than r0, r1 as for the 32 bit). There are alternate names like w0, w1, wzr that refer to registers as 32 bit entities. I will note that I never see xsp or wsp, only "sp".

The internal control registers for the processor are very different for 64 bit ARM

ARM version lingo, M versus A, and more

This is an area with rampant confusion and different conflicting designations. Some names (such as anything beginning with "Cortex") are marketing names that need to be translated. Terms like ARMv6, ARMv7, and ARMv8 refere to different instruction set definitions (ARMv8 is 64 bit ARM). "aarch64" is a common designation for 64 bit ARM.

You will also run into names like "ARM Cortex M4". There is a family of "M" series chips that are used as microcontrollers. Alongside these is a family of "A" series chips that are "application" chips (typically intended to run an operating system like linux). There is also a rare and seldom seen "R" family that are somehow tailored for real time applications.


Have any comments? Questions? Drop me a line!

Kyu / [email protected]