Message ID | 20210831121545.2874233-10-kraxel@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | build more i386 tcg code modular. | expand |
On 8/31/21 14:15, Gerd Hoffmann wrote: > Add TCGModuleOps struct, empty for now, followup patches will fill it. > This struct has pointers for tcg functions which are called by core > qemu. > > The struct is initialized (at compile time) with pointers to stub > functions. When the tcg module loads it will update the function > pointers to point to the real functions instead. > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > include/tcg/tcg-module.h | 8 ++++++++ > accel/tcg/tcg-module.c | 5 +++++ > accel/tcg/meson.build | 4 ++++ > 3 files changed, 17 insertions(+) > create mode 100644 include/tcg/tcg-module.h > create mode 100644 accel/tcg/tcg-module.c > > diff --git a/include/tcg/tcg-module.h b/include/tcg/tcg-module.h > new file mode 100644 > index 000000000000..7e87aecb2357 > --- /dev/null > +++ b/include/tcg/tcg-module.h > @@ -0,0 +1,8 @@ > +#ifndef TCG_MODULE_H > +#define TCG_MODULE_H > + > +struct TCGModuleOps { > +}; > +extern struct TCGModuleOps tcg; TCG functions taking a CPUState argument should reside in CPUClass's AccelCPUClass/TCGCPUOps, not a global struct.
Hi, > > +struct TCGModuleOps { > > +}; > > +extern struct TCGModuleOps tcg; > > TCG functions taking a CPUState argument should reside in > CPUClass's AccelCPUClass/TCGCPUOps, not a global struct. It's not that easy. Tried that first, but using TCGCPUOps outside cpu code doesn't work. take care, Gerd
diff --git a/include/tcg/tcg-module.h b/include/tcg/tcg-module.h new file mode 100644 index 000000000000..7e87aecb2357 --- /dev/null +++ b/include/tcg/tcg-module.h @@ -0,0 +1,8 @@ +#ifndef TCG_MODULE_H +#define TCG_MODULE_H + +struct TCGModuleOps { +}; +extern struct TCGModuleOps tcg; + +#endif /* TCG_MODULE_H */ diff --git a/accel/tcg/tcg-module.c b/accel/tcg/tcg-module.c new file mode 100644 index 000000000000..e864fb20c141 --- /dev/null +++ b/accel/tcg/tcg-module.c @@ -0,0 +1,5 @@ +#include "qemu/osdep.h" +#include "tcg/tcg-module.h" + +struct TCGModuleOps tcg = { +}; diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build index ec74e17a8285..93cbbf9f3926 100644 --- a/accel/tcg/meson.build +++ b/accel/tcg/meson.build @@ -1,3 +1,7 @@ +specific_ss.add(files( + 'tcg-module.c', +)) + specific_ss.add(when: 'CONFIG_TCG', if_true: files( 'cpu-exec-common.c', ))
Add TCGModuleOps struct, empty for now, followup patches will fill it. This struct has pointers for tcg functions which are called by core qemu. The struct is initialized (at compile time) with pointers to stub functions. When the tcg module loads it will update the function pointers to point to the real functions instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- include/tcg/tcg-module.h | 8 ++++++++ accel/tcg/tcg-module.c | 5 +++++ accel/tcg/meson.build | 4 ++++ 3 files changed, 17 insertions(+) create mode 100644 include/tcg/tcg-module.h create mode 100644 accel/tcg/tcg-module.c