May 25, 2025 at 10:56 PM, "Julian Ganz" wrote:
> Richard Henderson wrote:
> > On 5/19/25 16:19, Julian Ganz wrote:
> > +QEMU_DISABLE_CFI
> > +static void plugin_vcpu_cb__discon(CPUState *cpu,
> > + enum qemu_plugin_discon_type type,
> > + uint64_t from)
> > +{
> > + struct qemu_plugin_cb *cb, *next;
> > + enum qemu_plugin_event ev;
> > + uint64_t to = cpu->cc->get_pc(cpu);
> > +
> > + if (cpu->cpu_index < plugin.num_vcpus) {
> > + switch (type) {
> > + case QEMU_PLUGIN_DISCON_INTERRUPT:
> > + ev = QEMU_PLUGIN_EV_VCPU_INTERRUPT;
> > + break;
> > + case QEMU_PLUGIN_DISCON_EXCEPTION:
> > + ev = QEMU_PLUGIN_EV_VCPU_EXCEPTION;
> > + break;
> > + case QEMU_PLUGIN_DISCON_HOSTCALL:
> > + ev = QEMU_PLUGIN_EV_VCPU_HOSTCALL;
> > + break;
> >
> > No point passing in QEMU_PLUGIN_DISCON_* only to covert it to
> > QEMU_PLUGIN_EV_*.
> >
> It easily looks that way, and I myself stubled upon this at least one or two
> times, but `type` is the enum we pass to the callback a few lines down and
> part
> of the public plugin API. `ev` on the other hand is the offset in the
> `cb_list`.
> So some translation is neccessary, unfortunately.
I just realized that you probably meant that we should pass ev as a
parameter to plugin_vcpu_cb__discon. This we can obviously do.
Regards,
Julian