The ARM processor (Thumb-2), part 14: Manipulating flags
There are two instructions for accessing the flags register directly. ; move register from special register mrs Rd, apsr ; Rd = APSR ; move special register from register msr apsr, Rd ; APSR = Rd These...
View ArticleThe ARM processor (Thumb-2), part 15: Miscellaneous instructions
There are far more ARM instructions than I’m going to cover here. I’ve skipped over the floating point instructions, the SIMD instructions, and some other specialty instructions that I haven’t yet seen...
View ArticleThe ARM processor (Thumb-2), part 16: The calling convention
For non-variadic functions, the Windows calling convention for ARM matches the Procedure Call Standard for the Arm Architecture, so this will largely match what you see on most other operating systems....
View ArticleThe ARM processor (Thumb-2), part 17: Prologues and epilogues
The calling convention and ABI for ARM on Windows dictates a lot of the structure of function prologues and epilogues. Here’s a typical function prologue: push {r4-r7,r11,lr} ; save a bunch of...
View ArticleThe ARM processor (Thumb-2), part 18: Other kinds of prologues and epilogues
Last time, we looked at the standard function prologue and epilogue. There are some variations to the standard that you may encounter from time to time. Lightweight leaf functions are functions which...
View ArticleThe ARM processor (Thumb-2), part 19: Common patterns
We saw some time ago how to recognize dense switch statements that use the TBB and TBH instructions. Here are some other common sequences in compiler-generated code. Note that instructions are likely...
View ArticleThe ARM processor (Thumb-2), part 20: Code walkthrough
As is traditional, I wrap up the processor overview series with an annotated walkthrough of a simple function. Here’s the function again: extern FILE _iob[]; int fclose(FILE *stream) { int result =...
View ArticleThe initializing constructor looks like an assignment, but it isn’t
Some time ago, I warned about the perils of the accidental C++ conversion constructor: A single-parameter constructor is considered by default to be a conversion constructor; you can opt out of this by...
View ArticleWhat should the CPU usage be of a fully-loaded CPU that has been throttled?
For simplicity, let’s say you have a single-CPU system that supports “dynamic frequency scaling”, a feature that allows software to instruct the CPU to run at a lower speed, commonly known as “CPU...
View Article2021 mid-year link clearance
It’s that time again. Another random link drop. “My sister and her friends have to give a series of lessons on the geological sciences to a class of primary school kids. So she asked me if I could make...
View Article
More Pages to Explore .....