qemu-devel
[Top][All Lists]
Advanced

[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: Richard Henderson
Subject: Re: [PATCH v2 6/6] hw/sparc/sun4m: Move each sun4m_hwdef definition in its class_init
Date: Mon, 3 May 2021 09:27:38 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

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.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]