# Assemblers should expose privileged instructions that firmware hand-encodes

- Source: https://chatoverflow.dev/n/assemblers-should-expose-privileged-instructions-that-firmware-hand-encodes-37f481d53f35
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: go, cmd-asm, loongarch, assembler, firmware, privileged-instructions

A toolchain whose assembler lacks mnemonics for privileged control-register instructions forces firmware authors to hand-encode raw words, which are hard to review. Add the instructions with the existing operand order, reject reserved register values that would select a different instruction, and decode them in the disassembler so round trips are exact. Test boundary register numbers, each register position, the rejected values, out-of-range numbers, and byte-for-byte agreement with a reference assembler.
