.fill PAGE_SIZE, 1, 0xc3
.size hypercall_page, PAGE_SIZE
+DECLARE_HYPERCALL(console_io)
DECLARE_HYPERCALL(sched_op)
#include <xtf/types.h>
+#include <xtf/console.h>
+#include <xtf/hypercall.h>
#include <arch/x86/config.h>
-#include <xen/xen.h>
-
#ifdef CONFIG_ENV_pv
/* Filled in by head_pv.S */
start_info_t *start_info = NULL;
#endif
-void arch_setup(void)
+static void xen_console_write(const char *buf, size_t len)
{
+ hypercall_console_write(buf, len);
+}
+void arch_setup(void)
+{
+ register_console_callback(xen_console_write);
}
/*
/*
* Output functions, registered if/when available.
* Possibilities:
+ * - Xen hypervisor console
*/
static cons_output_cb output_fns[1];
static unsigned int nr_cons_cb;
(type)__res; \
})
+#define _hypercall32_3(type, name, a1, a2, a3) \
+ ({ \
+ long __res, __ign1, __ign2, __ign3; \
+ asm volatile ( \
+ "call hypercall_page + %c[offset]" \
+ : "=a" (__res), "=b" (__ign1), "=c" (__ign2), "=d" (__ign3) \
+ : [offset] "i" (__HYPERVISOR_##name * 32), \
+ "1" ((long)(a1)), "2" ((long)(a2)), "3" ((long)(a3)) \
+ : "memory" ); \
+ (type)__res; \
+ })
+
#endif /* XTF_X86_32_HYPERCALL_H */
/*
(type)__res; \
})
+#define _hypercall64_3(type, name, a1, a2, a3) \
+ ({ \
+ long __res, __ign1, __ign2, __ign3; \
+ asm volatile ( \
+ "call hypercall_page + %c[offset]" \
+ : "=a" (__res), "=D" (__ign1), "=S" (__ign2), "=d" (__ign3) \
+ : [offset] "i" (__HYPERVISOR_##name * 32), \
+ "1" ((long)(a1)), "2" ((long)(a2)), "3" ((long)(a3)) \
+ : "memory" ); \
+ (type)__res; \
+ })
+
#endif /* XTF_X86_64_HYPERCALL_H */
/*
#error Bad architecture
#endif
+#define __HYPERVISOR_console_io 18
#define __HYPERVISOR_sched_op 29
+/* Commands to HYPERVISOR_console_io */
+#define CONSOLEIO_write 0
+
#ifndef __ASSEMBLY__
struct start_info {
/* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
# include <arch/x86/x86_64/hypercall-x86_64.h>
# define HYPERCALL2 _hypercall64_2
+# define HYPERCALL3 _hypercall64_3
#elif defined(__i386__)
# include <arch/x86/x86_32/hypercall-x86_32.h>
# define HYPERCALL2 _hypercall32_2
+# define HYPERCALL3 _hypercall32_3
#else
# error Bad architecture for hypercalls
/*
* Higher level hypercall helpers
*/
+static inline void hypercall_console_write(const char *buf, unsigned long count)
+{
+ (void)HYPERCALL3(long, console_io, CONSOLEIO_write, count, buf);
+}
+
static inline long hypercall_shutdown(unsigned int reason)
{
return hypercall_sched_op(SCHEDOP_shutdown, &reason);