Message ID | 20250121114056.53949-9-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro | expand |
On 21/1/25 12:40, Philippe Mathieu-Daudé wrote: > CpuState caches its CPUClass since commit 6fbdff87062 > ("cpu: cache CPUClass in CPUState for hot code paths"), > use it. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/core/generic-loader.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c > index fb354693aff..0ddb3a359a2 100644 > --- a/hw/core/generic-loader.c > +++ b/hw/core/generic-loader.c > @@ -48,11 +48,8 @@ static void generic_loader_reset(void *opaque) > GenericLoaderState *s = GENERIC_LOADER(opaque); > > if (s->set_pc) { > - CPUClass *cc = CPU_GET_CLASS(s->cpu); > cpu_reset(s->cpu); > - if (cc) { > - cc->set_pc(s->cpu, s->addr); > - } > + s->cpu->cc->set_pc(s->cpu, s->addr); I guess we can directly use: cpu_set_pc(s->cpu, s->addr); > } > > if (s->data_len) {
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index fb354693aff..0ddb3a359a2 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -48,11 +48,8 @@ static void generic_loader_reset(void *opaque) GenericLoaderState *s = GENERIC_LOADER(opaque); if (s->set_pc) { - CPUClass *cc = CPU_GET_CLASS(s->cpu); cpu_reset(s->cpu); - if (cc) { - cc->set_pc(s->cpu, s->addr); - } + s->cpu->cc->set_pc(s->cpu, s->addr); } if (s->data_len) {
CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/core/generic-loader.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)