From 5088edf797252b470d1e74f9125fae29fc026911 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 30 Nov 2012 09:32:27 +0000 Subject: [minios] Add xenbus shutdown control support Add a thread watching the xenbus shutdown control path and notifies a wait queue. Add HYPERVISOR_shutdown convenient inline for minios shutdown. Add proper shutdown to the minios test application. Signed-off-by: Samuel Thibault Committed-by: Keir Fraser --- extras/mini-os/include/kernel.h | 3 +++ extras/mini-os/include/x86/x86_32/hypercall-x86_32.h | 8 ++++++++ extras/mini-os/include/x86/x86_64/hypercall-x86_64.h | 8 ++++++++ 3 files changed, 19 insertions(+) (limited to 'extras/mini-os/include') diff --git a/extras/mini-os/include/kernel.h b/extras/mini-os/include/kernel.h index b36f172ed8..78692e6c12 100644 --- a/extras/mini-os/include/kernel.h +++ b/extras/mini-os/include/kernel.h @@ -1,6 +1,9 @@ #ifndef _KERNEL_H_ #define _KERNEL_H_ +extern unsigned int do_shutdown; +extern unsigned int shutdown_reason; +extern struct wait_queue_head shutdown_queue; extern void do_exit(void) __attribute__((noreturn)); extern void stop_kernel(void); diff --git a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h index 43028eea0a..ef52ecdd8f 100644 --- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h +++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h @@ -172,6 +172,14 @@ HYPERVISOR_sched_op( return _hypercall2(int, sched_op, cmd, arg); } +static inline int +HYPERVISOR_shutdown( + unsigned int reason) +{ + struct sched_shutdown shutdown = { .reason = reason }; + return _hypercall2(int, sched_op, SCHEDOP_shutdown, &shutdown); +} + static inline long HYPERVISOR_set_timer_op( uint64_t timeout) diff --git a/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h b/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h index b874f039fe..513d74e09f 100644 --- a/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h +++ b/extras/mini-os/include/x86/x86_64/hypercall-x86_64.h @@ -176,6 +176,14 @@ HYPERVISOR_sched_op( return _hypercall2(int, sched_op, cmd, arg); } +static inline int +HYPERVISOR_shutdown( + unsigned int reason) +{ + struct sched_shutdown shutdown = { .reason = reason }; + return _hypercall2(int, sched_op, SCHEDOP_shutdown, &shutdown); +} + static inline long HYPERVISOR_set_timer_op( uint64_t timeout) -- cgit v1.2.3