[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 6/6] hw/sparc/sun4m: Move each sun4m_hwdef definition in i
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v2 6/6] hw/sparc/sun4m: Move each sun4m_hwdef definition in its class_init |
Date: |
Mon, 3 May 2021 18:35:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 5/3/21 6:27 PM, Richard Henderson wrote:
> On 5/2/21 11:54 AM, Philippe Mathieu-Daudé wrote:
>> +static void ss5_class_init(ObjectClass *oc, void *data)
>> +{
>> + MachineClass *mc = MACHINE_CLASS(oc);
>> + Sun4mMachineClass *smc = SUN4M_MACHINE_CLASS(mc);
>> +
>> + mc->desc = "Sun4m platform, SPARCstation 5";
>> + mc->is_default = true;
>> + mc->default_cpu_type = SPARC_CPU_TYPE_NAME("Fujitsu-MB86904");
>> + smc->hwdef = &(const struct sun4m_hwdef) {
>> .iommu_base = 0x10000000,
>> .iommu_pad_base = 0x10004000,
>> .iommu_pad_len = 0x0fffb000,
>
> This is incorrect. You're creating an anonymous object on the local
> stack frame and saving a pointer to it.
>
> You need to use a static const function scope variable.
Doh... I guess I got very lucky while testing then...
Thanks, I'll update.
Phil.
- [PATCH v2 2/6] hw/sparc/sun4m: Introduce Sun4mMachineClass, (continued)
- [PATCH v2 2/6] hw/sparc/sun4m: Introduce Sun4mMachineClass, Philippe Mathieu-Daudé, 2021/05/02
- [PATCH v2 3/6] hw/sparc/sun4m: Factor out sun4m_machine_class_init(), Philippe Mathieu-Daudé, 2021/05/02
- [PATCH v2 4/6] hw/sparc/sun4m: Register machine types in sun4m_machine_types[], Philippe Mathieu-Daudé, 2021/05/02
- [PATCH v2 5/6] hw/sparc/sun4m: Fix code style for checkpatch.pl, Philippe Mathieu-Daudé, 2021/05/02
- [PATCH v2 6/6] hw/sparc/sun4m: Move each sun4m_hwdef definition in its class_init, Philippe Mathieu-Daudé, 2021/05/02