From: BitKeeper B. <ri...@su...> - 2005-03-13 10:02:43
|
ChangeSet 1.1159.256.52, 2005/03/13 01:36:29+00:00, ia...@fr... Add hypercall to allow domains to request that they be crashed. Signed-off-by: ia...@xe... linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h | 16 ++++++++++++++++ xen/common/domain.c | 4 ++++ xen/include/public/io/domain_controller.h | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff -Nru a/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h --- a/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h 2005-03-13 05:02:39 -05:00 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/hypervisor.h 2005-03-13 05:02:39 -05:00 @@ -289,6 +289,22 @@ return ret; } +static inline int +HYPERVISOR_crash( + void) +{ + int ret; + unsigned long ign1; + __asm__ __volatile__ ( + TRAP_INSTR + : "=a" (ret), "=b" (ign1) + : "0" (__HYPERVISOR_sched_op), + "1" (SCHEDOP_shutdown | (SHUTDOWN_crash << SCHEDOP_reasonshift)) + : "memory" ); + + return ret; +} + static inline long HYPERVISOR_set_timer_op( u64 timeout) diff -Nru a/xen/common/domain.c b/xen/common/domain.c --- a/xen/common/domain.c 2005-03-13 05:02:39 -05:00 +++ b/xen/common/domain.c 2005-03-13 05:02:39 -05:00 @@ -16,6 +16,7 @@ #include <asm/shadow.h> #include <public/dom0_ops.h> #include <asm/domain_page.h> +#include <public/io/domain_controller.h> /* Both these structures are protected by the domlist_lock. */ rwlock_t domlist_lock = RW_LOCK_UNLOCKED; @@ -167,6 +168,9 @@ machine_restart(0); } } + + if ( reason == SHUTDOWN_crash ) + domain_crash(); /* we will not return */ current->shutdown_code = reason; set_bit(DF_SHUTDOWN, ¤t->flags); diff -Nru a/xen/include/public/io/domain_controller.h b/xen/include/public/io/domain_controller.h --- a/xen/include/public/io/domain_controller.h 2005-03-13 05:02:39 -05:00 +++ b/xen/include/public/io/domain_controller.h 2005-03-13 05:02:39 -05:00 @@ -19,7 +19,7 @@ #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */ #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */ #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ - +#define SHUTDOWN_crash 3 /* Tell controler we've crashed. */ /* * CONTROLLER MESSAGING INTERFACE. |