diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-06-09 13:26:30 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-06-09 13:26:30 +0100 |
commit | c68ffdc4fa75f9ed29ccdea16c9a910442e2fc20 (patch) | |
tree | ec2dc82b665f6046a46a4c90b5397fe51f17fac4 /extras/mini-os/kernel.c | |
parent | 0ba222a6fd5c72bda66eb3678c44fe3e43bbc6c0 (diff) | |
download | xen-c68ffdc4fa75f9ed29ccdea16c9a910442e2fc20.tar.gz xen-c68ffdc4fa75f9ed29ccdea16c9a910442e2fc20.tar.bz2 xen-c68ffdc4fa75f9ed29ccdea16c9a910442e2fc20.zip |
minios: add proper shutdown facilities
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/kernel.c')
-rw-r--r-- | extras/mini-os/kernel.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/extras/mini-os/kernel.c b/extras/mini-os/kernel.c index ea92adca6a..e02b85880f 100644 --- a/extras/mini-os/kernel.c +++ b/extras/mini-os/kernel.c @@ -46,6 +46,7 @@ #include <xen/features.h> #include <xen/version.h> +static struct netfront_dev *net_dev; u8 xen_features[XENFEAT_NR_SUBMAPS * 32]; @@ -87,7 +88,7 @@ static void periodic_thread(void *p) static void netfront_thread(void *p) { - init_netfront(NULL, NULL, NULL, NULL); + net_dev = init_netfront(NULL, NULL, NULL, NULL); } static struct blkfront_dev *blk_dev; @@ -347,9 +348,9 @@ static void refresh_cursor(int new_x, int new_y) fbfront_update(fb_dev, new_x, new_y, 9, 9); } +static struct kbdfront_dev *kbd_dev; static void kbdfront_thread(void *p) { - struct kbdfront_dev *kbd_dev; DEFINE_WAIT(w); int x = WIDTH / 2, y = HEIGHT / 2, z = 0; @@ -509,6 +510,49 @@ void start_kernel(start_info_t *si) run_idle_thread(); } +void stop_kernel(void) +{ + if (net_dev) + shutdown_netfront(net_dev); + + if (blk_dev) + shutdown_blkfront(blk_dev); + + if (fb_dev) + shutdown_fbfront(fb_dev); + + if (kbd_dev) + shutdown_kbdfront(kbd_dev); + + /* TODO: fs import */ + + local_irq_disable(); + + /* Reset grant tables */ + fini_gnttab(); + + /* Reset the console driver. */ + fini_console(); + /* TODO: record new ring mfn & event in start_info */ + + /* Reset XenBus */ + fini_xenbus(); + + /* Reset timers */ + fini_time(); + + /* Reset memory management. */ + fini_mm(); + + /* Reset events. */ + fini_events(); + + /* Reset traps */ + trap_fini(); + + /* Reset arch details */ + arch_fini(); +} /* * do_exit: This is called whenever an IRET fails in entry.S. |