On 10/14/2026 1:14 PM, Pierrick Bouvier wrote: > On 10/14/2026 12:43 PM, Philippe Mathieu-Daudé wrote: >> On 14/10/26 20:25, Pierrick Bouvier wrote: >>> This allows a specific target to declare its implementation of >>> semihosting. >>> >>> Reviewed-by: Brian Cain <[email protected]> Signed-off- >>> by: Pierrick Bouvier <[email protected]> --- >>> include/hw/core/cpu.h | 6 ++++++ include/semihosting/ >>> common-semi.h | 17 +++++++++++++++++ 2 files changed, 23 >>> insertions(+) >>> >>> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index >>> 76801444a16..456154df6f6 100644 --- a/include/hw/core/cpu.h +++ b/ >>> include/hw/core/cpu.h @@ -98,6 +98,9 @@ struct AccelCPUClass; /* >>> see sysemu-cpu-ops.h */ struct SysemuCPUOps; +/* see semihosting/ >>> common-semi.h */ +struct SemihostingCPUOps; + /** * CPUClass: * >>> @class_by_name: Callback to map -cpu command line model name to an >>> @@ -186,6 +189,9 @@ struct CPUClass { #ifdef CONFIG_TCG /* when >>> TCG is not available, this pointer is NULL */ const TCGCPUOps >>> *tcg_ops; + + /* when target does not implement semihosting, >>> this pointer is NULL */ + const struct SemihostingCPUOps >>> *semi_ops; >> >> Could these be *const? > > This field is not statically initialized, so we can't use *const. > It would trigger: In function ‘arm_cpu_class_init’: > target/arm/cpu.c:2669:18: error: assignment of read-only member ‘semi_ops’ > 2669 | cc->semi_ops = &arm_semihosting_ops; > | > > Current const ensures we can't modify callbacks set ( > cpu->cc->semi_ops-> (const)), which is what matters the most. > > Note: that's the same pattern than all other ops. > > Reviewed-by: Pierrick Bouvier <[email protected]> >
Sorry for the reviewed-by, my fingers slipped over my signature shortcut. Regards, Pierrick
