Various CPUState can share the same CPUClass parent,
and must not update its fields. Protect the CPUClass
by marking the CPUState pointer const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <
20260705215729.62196-2-philmd@oss.qualcomm.com>
* counter hit zero); we must restore the guest PC to the address
* of the start of the TB.
*/
- CPUClass *cc = cpu->cc;
+ const CPUClass *cc = cpu->cc;
const TCGCPUOps *tcg_ops = cc->tcg_ops;
if (tcg_ops->synchronize_from_tb) {
void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
{
TranslationBlock *tb;
- CPUClass *cc;
+ const CPUClass *cc = cpu->cc;
uint32_t n;
tb = tcg_tb_lookup(retaddr);
* to account for the re-execution of the branch.
*/
n = 1;
- cc = cpu->cc;
if (cc->tcg_ops->io_recompile_replay_branch &&
cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
cpu->neg.icount_decr.u16.low++;
static const char *gdb_get_core_xml_file(CPUState *cpu)
{
- CPUClass *cc = cpu->cc;
+ const CPUClass *cc = cpu->cc;
/*
* The CPU class can provide the XML filename via a method,
/*< private >*/
DeviceState parent_obj;
/* cache to avoid expensive CPU_GET_CLASS */
- CPUClass *cc;
+ const CPUClass *cc;
/*< public >*/
int nr_threads;