mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
target/arm: Implement GCSSS1
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20251008215613.300150-54-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
committed by
Peter Maydell
parent
a94b6aab8e
commit
22d20e3804
@@ -129,6 +129,9 @@ static const ARMCPRegInfo gcs_reginfo[] = {
|
||||
{ .name = "GCSPOPM", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 7, .opc2 = 1,
|
||||
.access = PL0_R, .type = ARM_CP_GCSPOPM },
|
||||
{ .name = "GCSSS1", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 3, .crn = 7, .crm = 7, .opc2 = 2,
|
||||
.access = PL0_W, .type = ARM_CP_GCSSS1 },
|
||||
{ .name = "GCSPUSHX", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 7, .opc2 = 4,
|
||||
.access = PL1_W, .accessfn = access_gcspushx, .fgt = FGT_NGCSEPP,
|
||||
|
||||
@@ -53,6 +53,7 @@ enum {
|
||||
ARM_CP_GCSPUSHX = 0x000a,
|
||||
ARM_CP_GCSPOPX = 0x000b,
|
||||
ARM_CP_GCSPOPCX = 0x000c,
|
||||
ARM_CP_GCSSS1 = 0x000d,
|
||||
|
||||
/* Flag: reads produce resetvalue; writes ignored. */
|
||||
ARM_CP_CONST = 1 << 4,
|
||||
|
||||
@@ -2643,6 +2643,31 @@ static void gen_gcspopx(DisasContext *s)
|
||||
tcg_gen_addi_i64(gcspr, addr, 8);
|
||||
}
|
||||
|
||||
static void gen_gcsss1(DisasContext *s, int rt)
|
||||
{
|
||||
TCGv_i64 gcspr = cpu_gcspr[s->current_el];
|
||||
int mmuidx = core_gcs_mem_index(s->mmu_idx);
|
||||
MemOp mop = finalize_memop(s, MO_64 | MO_ALIGN);
|
||||
TCGv_i64 inptr = cpu_reg(s, rt);
|
||||
TCGv_i64 cmp = tcg_temp_new_i64();
|
||||
TCGv_i64 new = tcg_temp_new_i64();
|
||||
TCGv_i64 old = tcg_temp_new_i64();
|
||||
TCGLabel *fail_label =
|
||||
delay_exception(s, EXCP_UDEF, syn_gcs_data_check(GCS_IT_GCSSS1, rt));
|
||||
|
||||
/* Compute the valid cap entry that the new stack must have. */
|
||||
tcg_gen_deposit_i64(cmp, inptr, tcg_constant_i64(1), 0, 12);
|
||||
/* Compute the in-progress cap entry for the old stack. */
|
||||
tcg_gen_deposit_i64(new, gcspr, tcg_constant_i64(5), 0, 3);
|
||||
|
||||
/* Swap the valid cap the with the in-progress cap. */
|
||||
tcg_gen_atomic_cmpxchg_i64(old, inptr, cmp, new, mmuidx, mop);
|
||||
tcg_gen_brcond_i64(TCG_COND_NE, old, cmp, fail_label);
|
||||
|
||||
/* The new stack had a valid cap: change gcspr. */
|
||||
tcg_gen_andi_i64(gcspr, inptr, ~7);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up @key, returning the cpreg, which must exist.
|
||||
* Additionally, the new cpreg must also be accessible.
|
||||
@@ -2984,6 +3009,11 @@ static void handle_sys(DisasContext *s, bool isread,
|
||||
gen_gcspopx(s);
|
||||
}
|
||||
return;
|
||||
case ARM_CP_GCSSS1:
|
||||
if (s->gcs_en) {
|
||||
gen_gcsss1(s, rt);
|
||||
}
|
||||
return;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user