aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Welwarsky <matthias.welwarsky@sysgo.com>2016-10-06 16:11:19 +0200
committerMatthias Welwarsky <matthias.welwarsky@sysgo.com>2017-02-10 14:18:34 +0100
commit675b0170f2752c285de359f235e50a208f7f138a (patch)
tree9916a0448037dc3712472dd8656043bc9da17cf7
parent2b56f4f656e11f50d124e13e6d66a967ca45d373 (diff)
aarch64: simplify armv8_set_cpsr()
Translate from cpsr value to "enum arm_mode" by shifting up 4 bits and filling the lowest nibble with 0xF. Change-Id: Ic32186104b0c29578c4f6f99e04840ab88a0017b Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
-rw-r--r--src/target/armv8.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/src/target/armv8.c b/src/target/armv8.c
index 3f3127e..a572e23 100644
--- a/src/target/armv8.c
+++ b/src/target/armv8.c
@@ -282,36 +282,10 @@ void armv8_set_cpsr(struct arm *arm, uint32_t cpsr)
}
}
arm->core_state = state;
- if (arm->core_state == ARM_STATE_AARCH64) {
- switch (mode) {
- case SYSTEM_AAR64_MODE_EL0t:
- arm->core_mode = ARMV8_64_EL0T;
- break;
- case SYSTEM_AAR64_MODE_EL1t:
- arm->core_mode = ARMV8_64_EL0T;
- break;
- case SYSTEM_AAR64_MODE_EL1h:
- arm->core_mode = ARMV8_64_EL1H;
- break;
- case SYSTEM_AAR64_MODE_EL2t:
- arm->core_mode = ARMV8_64_EL2T;
- break;
- case SYSTEM_AAR64_MODE_EL2h:
- arm->core_mode = ARMV8_64_EL2H;
- break;
- case SYSTEM_AAR64_MODE_EL3t:
- arm->core_mode = ARMV8_64_EL3T;
- break;
- case SYSTEM_AAR64_MODE_EL3h:
- arm->core_mode = ARMV8_64_EL3H;
- break;
- default:
- LOG_DEBUG("unknow mode 0x%x", (unsigned) (mode));
- break;
- }
- } else {
+ if (arm->core_state == ARM_STATE_AARCH64)
+ arm->core_mode = (mode << 4) | 0xf;
+ else
arm->core_mode = mode;
- }
LOG_DEBUG("set CPSR %#8.8x: %s mode, %s state", (unsigned) cpsr,
armv8_mode_name(arm->core_mode),