arm: thumb understanding++

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-30 00:00:01 +00:00
parent ceadb1d776
commit 1f55dec44c
8 changed files with 140 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
/* Dump as many registers as we feel like to see initial CPU state. */
/* Dump registers that cannot be read from EL0. */
#include <stdio.h>
#include <inttypes.h>

View File

@@ -1,12 +1,14 @@
/* Dump registers that cannot be read from EL0. */
#include <stdio.h>
#include <inttypes.h>
int main(void) {
uint32_t cpsr;
__asm__ ("mrs %0, cpsr" : "=r" (cpsr) : :);
printf("CPSR 0x%" PRIX32 "\n", cpsr);
uint32_t spsr;
__asm__ ("mrs %0, spsr" : "=r" (spsr) : :);
printf("SPSR 0x%" PRIX32 "\n", spsr);
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-exception-levels */
printf("CPSR.M 0x%" PRIX32 "\n", cpsr & 0xF);
printf("SPSR.M 0x%" PRIX32 "\n", spsr & 0xF);
#if 0
/* TODO blows up exception in EL, but works with -machine secure=on. */