aboutsummaryrefslogtreecommitdiff
path: root/target/arm/pauth_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-01-21 10:23:13 +0000
committerPeter Maydell <peter.maydell@linaro.org>2019-01-21 10:38:54 +0000
commit04d13549fa10bb9775a90701e4e6fd0a2cbf83cb (patch)
treec0d44c16b0bc386123eacd40f41971feaad28b61 /target/arm/pauth_helper.c
parent5d8634f5a3a8474525edcfd581a659830e9e97c0 (diff)
downloadqemu-04d13549fa10bb9775a90701e4e6fd0a2cbf83cb.zip
qemu-04d13549fa10bb9775a90701e4e6fd0a2cbf83cb.tar.gz
qemu-04d13549fa10bb9775a90701e4e6fd0a2cbf83cb.tar.bz2
target/arm: Implement pauth_strip
Stripping out the authentication data does not require any crypto, it merely requires the virtual address parameters. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20190108223129.5570-25-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/pauth_helper.c')
-rw-r--r--target/arm/pauth_helper.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
index 902f68a..e02376a 100644
--- a/target/arm/pauth_helper.c
+++ b/target/arm/pauth_helper.c
@@ -38,6 +38,15 @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
g_assert_not_reached(); /* FIXME */
}
+static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param)
+{
+ uint64_t extfield = -param.select;
+ int bot_pac_bit = 64 - param.tsz;
+ int top_pac_bit = 64 - 8 * param.tbi;
+
+ return deposit64(ptr, bot_pac_bit, top_pac_bit - bot_pac_bit, extfield);
+}
+
static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier,
ARMPACKey *key, bool data, int keynumber)
{
@@ -46,7 +55,10 @@ static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier,
static uint64_t pauth_strip(CPUARMState *env, uint64_t ptr, bool data)
{
- g_assert_not_reached(); /* FIXME */
+ ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
+ ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data);
+
+ return pauth_original_ptr(ptr, param);
}
static void QEMU_NORETURN pauth_trap(CPUARMState *env, int target_el,