qemu/target/ppc/translate/bhrb-impl.c.inc
Glenn Miles 6bfcf1dc23 target/ppc: Add clrbhrb and mfbhrbe instructions
Add support for the clrbhrb and mfbhrbe instructions.

Since neither instruction is believed to be critical to
performance, both instructions were implemented using helper
functions.

Access to both instructions is controlled by bits in the
HFSCR (for privileged state) and MMCR0 (for problem state).
A new function, helper_mmcr0_facility_check, was added for
checking MMCR0[BHRBA] and raising a facility_unavailable exception
if required.

NOTE: For P8 and P9, due to a performance issue, branch history will
not be kept, but the instructions will be allowed to execute
as normal with the exception that the mfbhrbe instruction will
always return a zero value.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
2024-05-24 09:33:32 +10:00

44 lines
958 B
C++

/*
* Power ISA Decode For BHRB Instructions
*
* Copyright IBM Corp. 2023
*
* Authors:
* Glenn Miles <milesg@linux.vnet.ibm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
static bool trans_MFBHRBE(DisasContext *ctx, arg_XFX_bhrbe *arg)
{
REQUIRE_INSNS_FLAGS2(ctx, ISA207S);
TCGv_i32 bhrbe = tcg_constant_i32(arg->bhrbe);
gen_helper_mfbhrbe(cpu_gpr[arg->rt], tcg_env, bhrbe);
return true;
}
static bool trans_CLRBHRB(DisasContext *ctx, arg_CLRBHRB *arg)
{
REQUIRE_INSNS_FLAGS2(ctx, ISA207S);
gen_helper_clrbhrb(tcg_env);
return true;
}
#else
static bool trans_MFBHRBE(DisasContext *ctx, arg_XFX_bhrbe *arg)
{
gen_invalid(ctx);
return true;
}
static bool trans_CLRBHRB(DisasContext *ctx, arg_CLRBHRB *arg)
{
gen_invalid(ctx);
return true;
}
#endif