aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorBalaji Rao <balajirrao@gmail.com>2007-12-28 03:56:24 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-01-30 06:50:04 -0500
commitec04b13f67be3c90b38c625f4b8bdfea54c1ff60 (patch)
tree7819de21361fdd65487ef75ea9f2b774e4203f83 /arch/x86
parent5c55841d16dbf7c759fa6fb2ecc5e615b86d17db (diff)
lguest: Reboot support
Reboot Implemented (Prevent fd leak, fix style and fix documentation --RR) Signed-off-by: Balaji Rao <balajirrao@gmail.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/lguest/boot.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 92c56117eae..d6b18e2e543 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -67,6 +67,7 @@
67#include <asm/mce.h> 67#include <asm/mce.h>
68#include <asm/io.h> 68#include <asm/io.h>
69#include <asm/i387.h> 69#include <asm/i387.h>
70#include <asm/reboot.h> /* for struct machine_ops */
70 71
71/*G:010 Welcome to the Guest! 72/*G:010 Welcome to the Guest!
72 * 73 *
@@ -812,7 +813,7 @@ static void lguest_safe_halt(void)
812 * rather than virtual addresses, so we use __pa() here. */ 813 * rather than virtual addresses, so we use __pa() here. */
813static void lguest_power_off(void) 814static void lguest_power_off(void)
814{ 815{
815 hcall(LHCALL_CRASH, __pa("Power down"), 0, 0); 816 hcall(LHCALL_SHUTDOWN, __pa("Power down"), LGUEST_SHUTDOWN_POWEROFF, 0);
816} 817}
817 818
818/* 819/*
@@ -822,7 +823,7 @@ static void lguest_power_off(void)
822 */ 823 */
823static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p) 824static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p)
824{ 825{
825 hcall(LHCALL_CRASH, __pa(p), 0, 0); 826 hcall(LHCALL_SHUTDOWN, __pa(p), LGUEST_SHUTDOWN_POWEROFF, 0);
826 /* The hcall won't return, but to keep gcc happy, we're "done". */ 827 /* The hcall won't return, but to keep gcc happy, we're "done". */
827 return NOTIFY_DONE; 828 return NOTIFY_DONE;
828} 829}
@@ -926,6 +927,11 @@ static unsigned lguest_patch(u8 type, u16 clobber, void *ibuf,
926 return insn_len; 927 return insn_len;
927} 928}
928 929
930static void lguest_restart(char *reason)
931{
932 hcall(LHCALL_SHUTDOWN, __pa(reason), LGUEST_SHUTDOWN_RESTART, 0);
933}
934
929/*G:030 Once we get to lguest_init(), we know we're a Guest. The pv_ops 935/*G:030 Once we get to lguest_init(), we know we're a Guest. The pv_ops
930 * structures in the kernel provide points for (almost) every routine we have 936 * structures in the kernel provide points for (almost) every routine we have
931 * to override to avoid privileged instructions. */ 937 * to override to avoid privileged instructions. */
@@ -1059,6 +1065,7 @@ __init void lguest_init(void)
1059 * the Guest routine to power off. */ 1065 * the Guest routine to power off. */
1060 pm_power_off = lguest_power_off; 1066 pm_power_off = lguest_power_off;
1061 1067
1068 machine_ops.restart = lguest_restart;
1062 /* Now we're set up, call start_kernel() in init/main.c and we proceed 1069 /* Now we're set up, call start_kernel() in init/main.c and we proceed
1063 * to boot as normal. It never returns. */ 1070 * to boot as normal. It never returns. */
1064 start_kernel(); 1071 start_kernel();