See MIPS Run - Dominic Sweetman

This book is effectively "All the grubby details of programming a RISC processor, MIPS edition". The usual computer science education will teach you about 5-stage RISC pipelines, TLBs and caches. There will probably be some discussion that interrupts exist. Maybe some hints about how you stick a maths coprocessor on the side. The actual reality... not so much, and that's where this book comes in.

It covers things from the angle of, well, if not how to write your own OS, at least how to bring up an embedded system using MIPS. Indeed, this is the first book I've read to care significantly about how endianness interacts with peripherals, and how such peripherals should be wired up to the bus when assumptions collide. It talks about the details of caches and TLBs, of interrupts and control registers, debugging and profiling (including EJTAG), floating-point and more. It digs into ABIs and position-independent code. It's pretty comprehensive, as one might expect at around 500 pages.

This is the second edition, "See MIPS Run Linux", from 2007. The depth of "Linux stuff" is not huge - more a few pointers on the architecture-specifics ofroughly how Linux runs on MIPS, and I felt that was a little underwhelming.

MIPS really is no longer flavour-of-the-month - everyone seems to love ARM or RISC-V now. I'm still fond of MIPS and its branch delay slots, having had a lot of fun reverse engineering the PlayStation ROM back in the day, and it's still soooo much more pleasant than x86. Is this book useful now? Maybe not directly, unless you're doing MIPS work, but there's a lot of transferable knowledge. The content is based around late '90s-early 2000s technology, and is largely fairly cleanly designed, having no need for x86 backwards-compatability. It still reaches the world of OOO superscalar and start of hyperthreading. As such, it's a good introduction to the patterns that still exist on the cutting edge processors of today, so it's a good grounding in the absense of equivalent material for more modern stuff (which I'm sure exists, but I've never found - an OS dev wiki is not a structured learning environment!).

Despite being aver 500 pages long, it's a fairly approachable read: The chapters are well-defined, and while there are boring reference-like parts they're fairly skippable, and the prose isn't too dull. Indeed, there are some fairly interesting opinions in there, perhaps most visible in the glossary. It's not the dryest book ever!

It is also a fairly specific book, with the focus on helping systems programmers program systems. It neither goes into deep hardware details, nor assumes strong software engineering/algorithmic programming, but instead concentrates on that border where someone has to boostrap the system, get it running code, and try to move from assembly to C as quickly as possible. It's for the person who has friends on the HW and embedded applications teams, and is bridging the gap.

Verdict? I liked it. In terms of modern relevance, I think it's hard to justify the time reading it, but as I said I have a soft spot for MIPS, and it provides a nice guided tour of the innermost software gubbins of a real, heavyweight architecture, even if it's not the one we're all using now. More fun than you might expect.

Posted 2022-01-01.