Module Name: src Committed By: pooka Date: Fri Apr 25 19:56:01 UTC 2014
Modified Files: src/sys/rump/librump/rumpkern: emul.c rump.c Log Message: cpu_reboot() is more of an emul.c thing than a rump.c thing To generate a diff of this commit: cvs rdiff -u -r1.164 -r1.165 src/sys/rump/librump/rumpkern/emul.c cvs rdiff -u -r1.301 -r1.302 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/rump/librump/rumpkern/emul.c diff -u src/sys/rump/librump/rumpkern/emul.c:1.164 src/sys/rump/librump/rumpkern/emul.c:1.165 --- src/sys/rump/librump/rumpkern/emul.c:1.164 Tue Mar 11 00:59:38 2014 +++ src/sys/rump/librump/rumpkern/emul.c Fri Apr 25 19:56:01 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.164 2014/03/11 00:59:38 pooka Exp $ */ +/* $NetBSD: emul.c,v 1.165 2014/04/25 19:56:01 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.164 2014/03/11 00:59:38 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.165 2014/04/25 19:56:01 pooka Exp $"); #include <sys/param.h> #include <sys/null.h> @@ -63,6 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.1 #include "rump_private.h" +void (*rump_vfs_fini)(void) = (void *)nullop; + /* * physmem is largely unused (except for nmbcluster calculations), * so pick a default value which suits ZFS. if an application wants @@ -307,3 +309,45 @@ turnstile_print(volatile void *obj, void /* nada */ } #endif + +void +cpu_reboot(int howto, char *bootstr) +{ + int ruhow = 0; + void *finiarg; + + printf("rump kernel halting...\n"); + + if (!RUMP_LOCALPROC_P(curproc)) + finiarg = curproc->p_vmspace->vm_map.pmap; + else + finiarg = NULL; + + /* dump means we really take the dive here */ + if ((howto & RB_DUMP) || panicstr) { + ruhow = RUMPUSER_PANIC; + goto out; + } + + /* try to sync */ + if (!((howto & RB_NOSYNC) || panicstr)) { + rump_vfs_fini(); + } + + doshutdownhooks(); + + /* your wish is my command */ + if (howto & RB_HALT) { + printf("rump kernel halted\n"); + rumpuser_sp_fini(finiarg); + for (;;) { + rumpuser_clock_sleep(RUMPUSER_CLOCK_RELWALL, 10, 0); + } + } + + /* this function is __dead, we must exit */ + out: + printf("halted\n"); + rumpuser_sp_fini(finiarg); + rumpuser_exit(ruhow); +} Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.301 src/sys/rump/librump/rumpkern/rump.c:1.302 --- src/sys/rump/librump/rumpkern/rump.c:1.301 Fri Apr 25 18:25:38 2014 +++ src/sys/rump/librump/rumpkern/rump.c Fri Apr 25 19:56:01 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.301 2014/04/25 18:25:38 pooka Exp $ */ +/* $NetBSD: rump.c,v 1.302 2014/04/25 19:56:01 pooka Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.301 2014/04/25 18:25:38 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.302 2014/04/25 19:56:01 pooka Exp $"); #include <sys/systm.h> #define ELFSIZE ARCH_ELFSIZE @@ -125,7 +125,6 @@ rump_aiodone_worker(struct work *wk, voi static int rump_inited; void (*rump_vfs_drainbufs)(int) = (void *)nullop; -void (*rump_vfs_fini)(void) = (void *)nullop; int (*rump_vfs_makeonedevnode)(dev_t, const char *, devmajor_t, devminor_t) = (void *)nullop; int (*rump_vfs_makedevnodes)(dev_t, const char *, char, @@ -543,48 +542,6 @@ rump_init_server(const char *url) return rumpuser_sp_init(url, ostype, osrelease, MACHINE); } -void -cpu_reboot(int howto, char *bootstr) -{ - int ruhow = 0; - void *finiarg; - - printf("rump kernel halting...\n"); - - if (!RUMP_LOCALPROC_P(curproc)) - finiarg = curproc->p_vmspace->vm_map.pmap; - else - finiarg = NULL; - - /* dump means we really take the dive here */ - if ((howto & RB_DUMP) || panicstr) { - ruhow = RUMPUSER_PANIC; - goto out; - } - - /* try to sync */ - if (!((howto & RB_NOSYNC) || panicstr)) { - rump_vfs_fini(); - } - - doshutdownhooks(); - - /* your wish is my command */ - if (howto & RB_HALT) { - printf("rump kernel halted\n"); - rumpuser_sp_fini(finiarg); - for (;;) { - rumpuser_clock_sleep(RUMPUSER_CLOCK_RELWALL, 10, 0); - } - } - - /* this function is __dead, we must exit */ - out: - printf("halted\n"); - rumpuser_sp_fini(finiarg); - rumpuser_exit(ruhow); -} - static int compcounter[RUMP_COMPONENT_MAX]; static int compinited[RUMP_COMPONENT_MAX];