target/arm: Implement GCSPOPX
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20251008215613.300150-52-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
6fb1678f90
commit
75c8d645b9
3 changed files with 39 additions and 0 deletions
|
|
@ -120,6 +120,9 @@ static const ARMCPRegInfo gcs_reginfo[] = {
|
|||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 7, .opc2 = 4,
|
||||
.access = PL1_W, .accessfn = access_gcspushx, .fgt = FGT_NGCSEPP,
|
||||
.type = ARM_CP_GCSPUSHX },
|
||||
{ .name = "GCSPOPX", .state = ARM_CP_STATE_AA64,
|
||||
.opc0 = 1, .opc1 = 0, .crn = 7, .crm = 7, .opc2 = 6,
|
||||
.access = PL1_W, .type = ARM_CP_GCSPOPX },
|
||||
};
|
||||
|
||||
void define_gcs_cpregs(ARMCPU *cpu)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ enum {
|
|||
ARM_CP_GCSPUSHM = 0x0008,
|
||||
ARM_CP_GCSPOPM = 0x0009,
|
||||
ARM_CP_GCSPUSHX = 0x000a,
|
||||
ARM_CP_GCSPOPX = 0x000b,
|
||||
|
||||
/* Flag: reads produce resetvalue; writes ignored. */
|
||||
ARM_CP_CONST = 1 << 4,
|
||||
|
|
|
|||
|
|
@ -2568,6 +2568,33 @@ static void gen_gcspushx(DisasContext *s)
|
|||
clear_pstate_bits(PSTATE_EXLOCK);
|
||||
}
|
||||
|
||||
static void gen_gcspopx(DisasContext *s)
|
||||
{
|
||||
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 addr = tcg_temp_new_i64();
|
||||
TCGv_i64 tmp = tcg_temp_new_i64();
|
||||
TCGLabel *fail_label =
|
||||
delay_exception(s, EXCP_UDEF, syn_gcs_data_check(GCS_IT_GCSPOPX, 31));
|
||||
|
||||
/* The value at top-of-stack must be an exception token. */
|
||||
tcg_gen_qemu_ld_i64(tmp, gcspr, mmuidx, mop);
|
||||
tcg_gen_brcondi_i64(TCG_COND_NE, tmp, 0b1001, fail_label);
|
||||
|
||||
/*
|
||||
* The other three values in the exception return record
|
||||
* are ignored, but are loaded anyway to raise faults.
|
||||
*/
|
||||
tcg_gen_addi_i64(addr, gcspr, 8);
|
||||
tcg_gen_qemu_ld_i64(tmp, addr, mmuidx, mop);
|
||||
tcg_gen_addi_i64(addr, addr, 8);
|
||||
tcg_gen_qemu_ld_i64(tmp, addr, mmuidx, mop);
|
||||
tcg_gen_addi_i64(addr, addr, 8);
|
||||
tcg_gen_qemu_ld_i64(tmp, addr, mmuidx, mop);
|
||||
tcg_gen_addi_i64(gcspr, addr, 8);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up @key, returning the cpreg, which must exist.
|
||||
* Additionally, the new cpreg must also be accessible.
|
||||
|
|
@ -2893,6 +2920,14 @@ static void handle_sys(DisasContext *s, bool isread,
|
|||
gen_gcspushx(s);
|
||||
}
|
||||
return;
|
||||
case ARM_CP_GCSPOPX:
|
||||
/* Choose the CONSTRAINED UNPREDICTABLE for UNDEF. */
|
||||
if (rt != 31) {
|
||||
unallocated_encoding(s);
|
||||
} else if (s->gcs_en) {
|
||||
gen_gcspopx(s);
|
||||
}
|
||||
return;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue