Re: instance_init() and the realize() functions

2020-07-18 Thread Thomas Huth
On 18/07/2020 09.09, Pratik Parvati wrote: > Hi team, > > Could someone please guild me to understand the difference > between *instance_init()* and the*realize()* functions? The > *class_init() *function is straight forward (it is similar to the > constructor in C++ OOP); But

Re: instance_init() and the realize() functions

2020-07-18 Thread Liviu Ionescu
> On 18 Jul 2020, at 12:43, Peter Maydell wrote: > > Note that for a lot > of device state struct members (where they correspond to guest > registers state), you want to set their values in the > device's reset method, not in instance_init or realize. > That's because the guest-visible registe

Re: instance_init() and the realize() functions

2020-07-18 Thread Peter Maydell
On Sat, 18 Jul 2020 at 09:27, Liviu Ionescu wrote: > For me it was difficult to draw a line of what initialisations should be done > in .instance_init and what in .realize, but given that .realise is called > when the whole hierarchy is ready, it might do links between objects, which > are not

Re: instance_init() and the realize() functions

2020-07-18 Thread Liviu Ionescu
> On 18 Jul 2020, at 10:09, Pratik Parvati wrote: > > The class_init() function is straight forward (it is similar to the > constructor in C++ OOP The C++ constructor initialises class **instances**, i.e. C++ objects, not C++ classes. In QEMU, the OOP functionality is implemented with nest

instance_init() and the realize() functions

2020-07-18 Thread Pratik Parvati
Hi team, Could someone please guild me to understand the difference between *instance_init()* and the* realize()* functions? The *class_init() *function is straight forward (it is similar to the constructor in C++ OOP); But I am, finding hard to quote the difference between *instance_init()* and