On 12/6/24 17:02, Rowan Hart wrote:
+++ b/tests/tcg/plugins/inject.c

Could we find a better name?

For sure, maybe "hypercalls.c" since that's really what it's mostly about.


Sounds good.

@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2024, Rowan Hart <rowanbh...@gmail.com>
+ *
+ * License: GNU GPL, version 2 or later.
+ *   See the COPYING file in the top-level directory.
+ */

We can add a comment here about what the plugin is doing.

Will do!

One challenge with picking a random value, is how to ensure this pattern has no 
other meaning for all architectures? I'm not sure we can find a single pattern 
of bytes that works for all arch, even though that would be definitely stylish 
:).

In more, it seems that we are reinventing the syscall interface, while we 
already have it. But as the current instrumentation only works for user-mode, 
having a specific hypercall interface might be worth it for plugins, so system 
mode could benefit from it too.

The work done here could serve later to define a proper interface.


I'll see what I can do about this. SIMICS supports many architectures and has a
"magic instruction" interface[0] (basically hypercalls) and has these
instructions defined per-architecture in a way that at minimum there are 12
values available which work on every architecture the simulator supports. QEMU
supports more architectures than SIMICS but I think we could start there and
follow a similar approach.

[0]:
https://intel.github.io/tsffs/simics/simics-user-guide/breakpoints.html#Magic-Breakpoints


Looks like a good model to reuse if we want to implement something similar.

-Rowan


Reply via email to