[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v3 02/11] plugins: add API for registering discontinuity
From: |
Julian Ganz |
Subject: |
Re: [RFC PATCH v3 02/11] plugins: add API for registering discontinuity callbacks |
Date: |
Fri, 10 Jan 2025 11:40:15 +0000 |
Hi Alex,
January 9, 2025 at 2:57 PM, "Alex Bennée" wrote:
> Julian Ganz <neither@nut.email> writes:
> > diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
> > index 9c67374b7e..f998a465e5 100644
> > --- a/include/qemu/qemu-plugin.h
> > +++ b/include/qemu/qemu-plugin.h
> > @@ -273,6 +273,21 @@ QEMU_PLUGIN_API
> > void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id,
> > qemu_plugin_vcpu_simple_cb_t cb);
> >
> > +/**
> > + * qemu_plugin_register_vcpu_discon_cb() - register a discontinuity
> > callback
> > + * @id: plugin ID
> > + * @cb: callback function
> > + *
> > + * The @cb function is called every time a vCPU receives a discontinuity
> > event
> > + * of the specified type(s), after the vCPU was prepared to handle the
> > event.
> > + * Preparation usually entails updating the PC to some interrupt handler
> > or trap
> > + * vector entry.
> >
> The "usually" here is a bit of a weasel word. We should be clear what
> the contract is with the plugin. Can we say the PC will be updated to
> the next instruction that will execute after the callback?
The contract is indeed clear: the PC will always be updated to the
instruction that will be executed next, at least if we don't have a
second discontinuity (e.g. jump to an unmapped page). The "usually"
refers to the discontinuity itself: in the case of host calls, we don't
observe a "jump" and the next instruction executed will just be the
instruction following the call.
I could have phrased this better, and will make this more clear in the
next update.
Regards,
Julian