# Linux Kernel Module Cheat

##### 30.5.3.1. ARM system register encodings

Each aarch64 system register is specified in the encoding of ARM system register instructions by 5 integer numbers:

- `op0`

- `op1`

- `CRn`

- `CRm`

- `op2`

The encodings are given on large tables in ARMv8 architecture reference manual db Chapter D12 "AArch64 System Register Encoding".

As shown in baremetal/arch/aarch64/dump_regs.c as of LKMC 4e05b00d23c73cc4d3b83be94affdb6f28008d99, you can use the encoding parameters directly in GNU GAS assembly:

    uint32_t id_isar6_el1;
    __asm__ ("mrs %0, s3_0_c0_c2_7" : "=r" (id_isar6_el1) : :);
    LKMC_DUMP_SYSTEM_REGS_PRINTF("ID_ISAR6_EL1 0x%" PRIX32 "\n", id_isar6_el1);

This can be useful to refer to new system registers which your older version of GNU GAS version does not yet have a name for.

The Linux kernel also uses explicit sysreg encoding extensively since it is of course a very early user of many new system registers, this is done at `arch/arm64/include/asm/sysreg.h` in Linux v5.4.