void entry_VE(void);
void entry_ret_to_kernel(void);
+void entry_SYSCALL(void);
+
struct xen_trap_info pv_default_trap_info[] =
{
{ X86_EXC_DE, 0|4, __KERN_CS, _u(entry_DE) },
return ret;
}
-void arch_init_traps(void)
+static void init_callbacks(void)
{
/* PV equivalent of `lidt`. */
int rc = hypercall_set_trap_table(pv_default_trap_info);
if ( rc )
panic("Failed to set trap table: %d\n", rc);
+ xen_callback_register_t cb;
+
+#ifdef __x86_64__
+ cb = (xen_callback_register_t) {
+ .type = CALLBACKTYPE_syscall,
+ .flags = CALLBACKF_mask_events,
+ .address = INIT_XEN_CALLBACK(__KERN_CS, _u(entry_SYSCALL)),
+ };
+
+ rc = hypercall_register_callback(&cb);
+ if ( rc )
+ panic("Failed to register syscall callback: %d\n", rc);
+#endif
+
+ cb = (xen_callback_register_t) {
+ .type = CALLBACKTYPE_syscall32,
+ .flags = CALLBACKF_mask_events,
+ .address = INIT_XEN_CALLBACK(__KERN_CS, _u(entry_SYSCALL)),
+ };
+
+ rc = hypercall_register_callback(&cb);
+ if ( rc )
+ panic("Failed to register syscall32 callback: %d\n", rc);
+}
+
+void arch_init_traps(void)
+{
+ int rc;
+
+ init_callbacks();
+
/* Register gdt[] with Xen. Need to map it read-only first. */
if ( remap_linear(gdt, PF_SYM(AD, P)) )
panic("Unable to remap gdt[] as read-only\n");
#define MACH2PHYS_VIRT_START 0xFFFF800000000000UL
+/* Guest exited in SYSCALL context? Return to guest with SYSRET? */
+#define VGCF_in_syscall 0x100
+
#ifndef __ASSEMBLY__
/* Anonymous unions include all permissible names (e.g., al/ah/ax/eax/rax). */
typedef unsigned long xen_callback_t;
+#define INIT_XEN_CALLBACK(_cs, _ip) (_ip)
+
#endif /* __ASSEMBLY__ */
#endif /* XEN_PUBLIC_ARCH_X86_XEN_X86_64_H */