On 3/19/24 03:22, Pierrick Bouvier wrote:
@@ -798,6 +816,25 @@ static void plugin_gen_inject(struct qemu_plugin_tb 
*plugin_tb)
                  assert(insn != NULL);
                  gen_disable_mem_helper(plugin_tb, insn);
                  break;
+
+            case PLUGIN_GEN_FROM_TB:
+                assert(insn == NULL);
+
+                cbs = plugin_tb->cbs[PLUGIN_CB_REGULAR];
+                for (i = 0, n = (cbs ? cbs->len : 0); i < n; i++) {
+                    struct qemu_plugin_dyn_cb *cb =
+                        &g_array_index(cbs, struct qemu_plugin_dyn_cb, i);
+                    gen_udata_cb(cb);
+                }
+
+                cbs = plugin_tb->cbs[PLUGIN_CB_INLINE];
+                for (i = 0, n = (cbs ? cbs->len : 0); i < n; i++) {
+                    struct qemu_plugin_dyn_cb *cb =
+                        &g_array_index(cbs, struct qemu_plugin_dyn_cb, i);
+                    gen_inline_cb(cb);
+                }
+                break;
+

Maybe I am missing something, but couldn't we simply mix all cbs possible. This way, the order mentioned by user when registering is the only one that matters, and he can select to mix callbacks and inline ops freely.
Just checking the type of callback would be needed to know which gen_* fn 
should be used.

See patch 15.  :-)


r~

Reply via email to