Gupje/documentation/source/architectures/arm64/debugger/arm64_debugger_storage.rst
2024-08-02 16:05:02 +02:00

147 lines
17 KiB
ReStructuredText

**********************************
Debugger Storage Overview on ARM64
**********************************
Overview of the storage setup on ARM64 for the debugger. To interact with this storage dump you can either dump the storage location and parse the entries or use the *utils/debugger/debugger_archs/arm64_processor_state.py* processor state, which is also passed as an argument in **GA_arm64_debugger**.
.. note:: All addresses below asume ``STORAGE_LOCATION`` + **Address**
+---------+------------------------+----------------------------------------------------------------------------------------+
| Address | Function | Comment |
+=========+========================+========================================================================================+
| 0x0 | X0 | Stores Register X0 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x8 | X1 | Stores Register X1 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x10 | X2 | Stores Register X2 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x18 | X3 | Stores Register X3 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x20 | X4 | Stores Register X4 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x28 | X5 | Stores Register X5 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x30 | X6 | Stores Register X6 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x38 | X7 | Stores Register X7 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x40 | X8 | Stores Register X8 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x48 | X9 | Stores Register X9 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x50 | X10 | Stores Register X10 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x58 | X11 | Stores Register X11 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x60 | X12 | Stores Register X12 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x68 | X13 | Stores Register X13 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x70 | X14 | Stores Register X14 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x78 | X15 | Stores Register X15 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x80 | X16 | Stores Register X16 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x88 | X17 | Stores Register X17 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x90 | X18 | Stores Register X18 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x98 | X19 | Stores Register X19 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xa0 | X20 | Stores Register X20 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xa8 | X21 | Stores Register X21 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xb0 | X22 | Stores Register X22 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xb8 | X23 | Stores Register X23 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xc0 | X24 | Stores Register X24 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xc8 | X25 | Stores Register X25 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xd0 | X26 | Stores Register X26 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xd8 | X27 | Stores Register X27 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xe0 | X28 | Stores Register X28 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xe8 | X29 | Stores the ``Frame Pointer`` |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xf0 | X30 | Stores the ``Link Register`` |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xf8 | SP | Stores the ``Stack Pointer`` |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x100 | TTBR0_EL3 | Stores ``TTBR0_EL3`` |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x108 | TTBR0_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x110 | TTBR0_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x118 | SCTLR_EL3 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x120 | SCTLR_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x128 | SCTLR_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x130 | VBAR_EL3 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x130 | VBAR_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x140 | VBAR_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x148 | TCR_EL3 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x150 | TCR_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x158 | TCR_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x160 | ELR_EL3 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x168 | ELR_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x170 | ELR_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x178 | SP_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x180 | SP_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x188 | SP_EL0 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x190 | SPSR_EL3 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x198 | SPSR_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x1a0 | SPSR_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x1a8 | MAIR_EL3 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x1b0 | MAIR_EL2 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x1b8 | MAIR_EL1 | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0x1c0 | CurrentEL | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| | | |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xfc0 | DBG_SETUP_JUMP | ``DEBUGGER`` Set to 0x77 to jump to ``DBG_SETUP_JUMP_ADDRESS`` and when DEVICE_SETUP=1 |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xfc8 | DBG_SETUP_JUMP_ADDRESS | ``DEBUGGER`` Address to jump to when ``DBG_SETUP_JUMP`` is set to *0x77* |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xfd0 | DBG_MMU_DISABLE | **DISABLED** ``DEBUGGER`` Disable the MMU on entry and enable the MMU on leave |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xfd8 | DBG_JUMP_TO | ``DEBUGGER`` Address to jump to instead of the debugger |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xfe0 | DBG_CONT_EXEC | ``DEBUGGER`` Do not jump in debugger but into |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xfe8 | TEMP X0 | ``DEBUGGER`` Temporary storage for X0 value |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xff0 | Store X0 | ``DEBUGGER`` Stores exception id for the ``SMC`` call |
+---------+------------------------+----------------------------------------------------------------------------------------+
| 0xff8 | JUMP_ADDR | ``DEBUGGER`` Memory location that instructs the debugger where to jump to |
+---------+------------------------+----------------------------------------------------------------------------------------+
.. note:: This memory segment is still being updated to add registers
When ``DBG_CONT_EXEC`` is set to **0x777** the debugger will not enter the debugger_main address, but instead restore the original processor state and jump into ``DBG_JUMP_TO``. This allows the debugger to be run without user interaction.