@@ -1,7 +1,9 @@
#include <xen/config.h>
#include <xen/types.h>
+#include <xen/xsplice_patch.h>
#include <xen/xsplice.h>
#include "config.h"
+#include <xen/lib.h>
static char name[] = "xen_hello_world";
extern const char *xen_hello_world(void);
@@ -9,6 +11,19 @@ extern const char *xen_hello_world(void);
/* External symbol. */
extern const char *xen_extra_version(void);
+void apply_hook(void)
+{
+ printk(KERN_DEBUG "Hook executing.\n");
+}
+
+void revert_hook(void)
+{
+ printk(KERN_DEBUG "Hook unloaded.\n");
+}
+
+xsplice_loadcall_t xsplice_load_data __section(".xsplice.hooks.load") = apply_hook;
+xsplice_unloadcall_t xsplice_unload_data __section(".xsplice.hooks.unload") = revert_hook;
+
struct xsplice_patch_func __section(".xsplice.funcs") xsplice_xen_hello_world = {
.name = name,
.new_addr = (unsigned long)(xen_hello_world),
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- xen/arch/x86/test/xen_hello_world.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)