Module Name: src Committed By: pooka Date: Mon Apr 29 14:51:41 UTC 2013
Modified Files: src/lib/librumpuser: rumpuser.c rumpuser_bio.c rumpuser_component.c rumpuser_int.h rumpuser_pth.c rumpuser_sp.c src/sys/rump/include/rump: rumpuser.h src/sys/rump/librump/rumpkern: klock.c rump.c Log Message: Make the rump kernel upcalls which were previous available only to the sysproxy module available for the entire hypervisor. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/lib/librumpuser/rumpuser.c cvs rdiff -u -r1.3 -r1.4 src/lib/librumpuser/rumpuser_bio.c cvs rdiff -u -r1.2 -r1.3 src/lib/librumpuser/rumpuser_component.c cvs rdiff -u -r1.6 -r1.7 src/lib/librumpuser/rumpuser_int.h cvs rdiff -u -r1.17 -r1.18 src/lib/librumpuser/rumpuser_pth.c cvs rdiff -u -r1.55 -r1.56 src/lib/librumpuser/rumpuser_sp.c cvs rdiff -u -r1.92 -r1.93 src/sys/rump/include/rump/rumpuser.h cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpkern/klock.c cvs rdiff -u -r1.262 -r1.263 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/lib/librumpuser/rumpuser.c diff -u src/lib/librumpuser/rumpuser.c:1.40 src/lib/librumpuser/rumpuser.c:1.41 --- src/lib/librumpuser/rumpuser.c:1.40 Mon Apr 29 13:21:03 2013 +++ src/lib/librumpuser/rumpuser.c Mon Apr 29 14:51:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $ */ +/* $NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include "rumpuser_port.h" #if !defined(lint) -__RCSID("$NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $"); +__RCSID("$NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $"); #endif /* !lint */ #include <sys/ioctl.h> @@ -64,12 +64,10 @@ __RCSID("$NetBSD: rumpuser.c,v 1.40 2013 #include "rumpuser_int.h" -rump_unschedulefn rumpuser__unschedule; -rump_reschedulefn rumpuser__reschedule; +struct rumpuser_hyperup rumpuser__hyp; int -rumpuser_init(int version, - rump_reschedulefn rumpkern_resched, rump_unschedulefn rumpkern_unsched) +rumpuser_init(int version, const struct rumpuser_hyperup *hyp) { if (version != RUMPUSER_VERSION) { @@ -94,9 +92,7 @@ rumpuser_init(int version, #endif rumpuser__thrinit(); - - rumpuser__unschedule = rumpkern_unsched; - rumpuser__reschedule = rumpkern_resched; + rumpuser__hyp = *hyp; return 0; } @@ -465,7 +461,7 @@ rumpuser_clock_sleep(uint64_t sec, uint6 int nlocks; int rv; - rumpuser__unschedule(0, &nlocks, NULL); + rumpkern_unsched(&nlocks, NULL); /*LINTED*/ rqt.tv_sec = sec; @@ -513,7 +509,7 @@ rumpuser_clock_sleep(uint64_t sec, uint6 abort(); } - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); return rv; } Index: src/lib/librumpuser/rumpuser_bio.c diff -u src/lib/librumpuser/rumpuser_bio.c:1.3 src/lib/librumpuser/rumpuser_bio.c:1.4 --- src/lib/librumpuser/rumpuser_bio.c:1.3 Mon Apr 29 13:57:46 2013 +++ src/lib/librumpuser/rumpuser_bio.c Mon Apr 29 14:51:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_bio.c,v 1.3 2013/04/29 13:57:46 pooka Exp $ */ +/* $NetBSD: rumpuser_bio.c,v 1.4 2013/04/29 14:51:39 pooka Exp $ */ /*- * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -88,9 +88,9 @@ dobio(struct rumpuser_bio *biop) #endif } } - rumpuser__reschedule(0, NULL); + rumpkern_sched(0, NULL); biop->bio_done(biop->bio_donearg, (size_t)rv, error); - rumpuser__unschedule(0, &dummy, NULL); + rumpkern_unsched(&dummy, NULL); /* paranoia */ biop->bio_donearg = NULL; @@ -129,7 +129,7 @@ rumpuser_bio(int fd, int op, void *data, static int usethread = 1; int nlocks; - rumpuser__unschedule(0, &nlocks, NULL); + rumpkern_unsched(&nlocks, NULL); if (!inited) { pthread_mutex_lock(&biomtx); @@ -175,5 +175,5 @@ rumpuser_bio(int fd, int op, void *data, pthread_mutex_unlock(&biomtx); } - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); } Index: src/lib/librumpuser/rumpuser_component.c diff -u src/lib/librumpuser/rumpuser_component.c:1.2 src/lib/librumpuser/rumpuser_component.c:1.3 --- src/lib/librumpuser/rumpuser_component.c:1.2 Sat Apr 27 14:59:08 2013 +++ src/lib/librumpuser/rumpuser_component.c Mon Apr 29 14:51:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_component.c,v 1.2 2013/04/27 14:59:08 pooka Exp $ */ +/* $NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $ */ /* * Copyright (c) 2013 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include "rumpuser_port.h" #if !defined(lint) -__RCSID("$NetBSD: rumpuser_component.c,v 1.2 2013/04/27 14:59:08 pooka Exp $"); +__RCSID("$NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $"); #endif /* !lint */ /* @@ -47,7 +47,7 @@ rumpuser_component_unschedule(void) { int nlocks; - rumpuser__unschedule(0, &nlocks, NULL); + rumpkern_unsched(&nlocks, NULL); return (void *)(intptr_t)nlocks; } @@ -56,5 +56,5 @@ rumpuser_component_schedule(void *cookie { int nlocks = (int)(intptr_t)cookie; - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); } Index: src/lib/librumpuser/rumpuser_int.h diff -u src/lib/librumpuser/rumpuser_int.h:1.6 src/lib/librumpuser/rumpuser_int.h:1.7 --- src/lib/librumpuser/rumpuser_int.h:1.6 Mon Apr 29 12:56:04 2013 +++ src/lib/librumpuser/rumpuser_int.h Mon Apr 29 14:51:39 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_int.h,v 1.6 2013/04/29 12:56:04 pooka Exp $ */ +/* $NetBSD: rumpuser_int.h,v 1.7 2013/04/29 14:51:39 pooka Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -29,17 +29,30 @@ #include <rump/rumpuser.h> -extern rump_unschedulefn rumpuser__unschedule; -extern rump_reschedulefn rumpuser__reschedule; - #define seterror(value) do { if (error) *error = value;} while (/*CONSTCOND*/0) +extern struct rumpuser_hyperup rumpuser__hyp; + +static inline void +rumpkern_unsched(int *nlocks, void *interlock) +{ + + rumpuser__hyp.hyp_backend_unschedule(0, nlocks, interlock); +} + +static inline void +rumpkern_sched(int nlocks, void *interlock) +{ + + rumpuser__hyp.hyp_backend_schedule(nlocks, interlock); +} + #define KLOCK_WRAP(a) \ do { \ int nlocks; \ - rumpuser__unschedule(0, &nlocks, NULL); \ + rumpkern_unsched(&nlocks, NULL); \ a; \ - rumpuser__reschedule(nlocks, NULL); \ + rumpkern_sched(nlocks, NULL); \ } while (/*CONSTCOND*/0) #define DOCALL(rvtype, call) \ @@ -57,9 +70,9 @@ do { \ { \ rvtype rv; \ int nlocks; \ - rumpuser__unschedule(0, &nlocks, NULL); \ + rumpkern_unsched(&nlocks, NULL); \ rv = call; \ - rumpuser__reschedule(nlocks, NULL); \ + rumpkern_sched(nlocks, NULL); \ if (rv == -1) \ seterror(errno); \ else \ Index: src/lib/librumpuser/rumpuser_pth.c diff -u src/lib/librumpuser/rumpuser_pth.c:1.17 src/lib/librumpuser/rumpuser_pth.c:1.18 --- src/lib/librumpuser/rumpuser_pth.c:1.17 Mon Apr 29 12:56:04 2013 +++ src/lib/librumpuser/rumpuser_pth.c Mon Apr 29 14:51:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_pth.c,v 1.17 2013/04/29 12:56:04 pooka Exp $ */ +/* $NetBSD: rumpuser_pth.c,v 1.18 2013/04/29 14:51:40 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ #include "rumpuser_port.h" #if !defined(lint) -__RCSID("$NetBSD: rumpuser_pth.c,v 1.17 2013/04/29 12:56:04 pooka Exp $"); +__RCSID("$NetBSD: rumpuser_pth.c,v 1.18 2013/04/29 14:51:40 pooka Exp $"); #endif /* !lint */ #include <assert.h> @@ -381,11 +381,11 @@ rumpuser_cv_wait(struct rumpuser_cv *cv, int nlocks; cv->nwaiters++; - rumpuser__unschedule(0, &nlocks, mtx); + rumpkern_unsched(&nlocks, mtx); mtxexit(mtx); NOFAIL_ERRNO(pthread_cond_wait(&cv->pthcv, &mtx->pthmtx)); mtxenter(mtx); - rumpuser__reschedule(nlocks, mtx); + rumpkern_sched(nlocks, mtx); cv->nwaiters--; } @@ -417,7 +417,7 @@ rumpuser_cv_timedwait(struct rumpuser_cv clock_gettime(CLOCK_REALTIME, &ts); cv->nwaiters++; - rumpuser__unschedule(0, &nlocks, mtx); + rumpkern_unsched(&nlocks, mtx); mtxexit(mtx); ts.tv_sec += sec; @@ -428,7 +428,7 @@ rumpuser_cv_timedwait(struct rumpuser_cv } rv = pthread_cond_timedwait(&cv->pthcv, &mtx->pthmtx, &ts); mtxenter(mtx); - rumpuser__reschedule(nlocks, mtx); + rumpkern_sched(nlocks, mtx); cv->nwaiters--; if (rv != 0 && rv != ETIMEDOUT) abort(); Index: src/lib/librumpuser/rumpuser_sp.c diff -u src/lib/librumpuser/rumpuser_sp.c:1.55 src/lib/librumpuser/rumpuser_sp.c:1.56 --- src/lib/librumpuser/rumpuser_sp.c:1.55 Sat Apr 27 17:35:10 2013 +++ src/lib/librumpuser/rumpuser_sp.c Mon Apr 29 14:51:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser_sp.c,v 1.55 2013/04/27 17:35:10 pooka Exp $ */ +/* $NetBSD: rumpuser_sp.c,v 1.56 2013/04/29 14:51:40 pooka Exp $ */ /* * Copyright (c) 2010, 2011 Antti Kantee. All Rights Reserved. @@ -37,7 +37,7 @@ #include "rumpuser_port.h" #if !defined(lint) -__RCSID("$NetBSD: rumpuser_sp.c,v 1.55 2013/04/27 17:35:10 pooka Exp $"); +__RCSID("$NetBSD: rumpuser_sp.c,v 1.56 2013/04/29 14:51:40 pooka Exp $"); #endif /* !lint */ #include <sys/types.h> @@ -83,8 +83,6 @@ static struct spclient spclist[MAXCLI]; static unsigned int disco; static volatile int spfini; -static struct rumpuser_sp_ops spops; - static char banner[MAXBANNER]; #define PROTOMAJOR 0 @@ -179,18 +177,18 @@ static void lwproc_switch(struct lwp *l) { - spops.spop_schedule(); - spops.spop_lwproc_switch(l); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + rumpuser__hyp.hyp_lwproc_switch(l); + rumpuser__hyp.hyp_unschedule(); } static void lwproc_release(void) { - spops.spop_schedule(); - spops.spop_lwproc_release(); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + rumpuser__hyp.hyp_lwproc_release(); + rumpuser__hyp.hyp_unschedule(); } static int @@ -198,9 +196,9 @@ lwproc_rfork(struct spclient *spc, int f { int rv; - spops.spop_schedule(); - rv = spops.spop_lwproc_rfork(spc, flags, comm); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + rv = rumpuser__hyp.hyp_lwproc_rfork(spc, flags, comm); + rumpuser__hyp.hyp_unschedule(); return rv; } @@ -210,9 +208,9 @@ lwproc_newlwp(pid_t pid) { int rv; - spops.spop_schedule(); - rv = spops.spop_lwproc_newlwp(pid); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + rv = rumpuser__hyp.hyp_lwproc_newlwp(pid); + rumpuser__hyp.hyp_unschedule(); return rv; } @@ -222,9 +220,9 @@ lwproc_curlwp(void) { struct lwp *l; - spops.spop_schedule(); - l = spops.spop_lwproc_curlwp(); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + l = rumpuser__hyp.hyp_lwproc_curlwp(); + rumpuser__hyp.hyp_unschedule(); return l; } @@ -234,9 +232,9 @@ lwproc_getpid(void) { pid_t p; - spops.spop_schedule(); - p = spops.spop_getpid(); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + p = rumpuser__hyp.hyp_getpid(); + rumpuser__hyp.hyp_unschedule(); return p; } @@ -245,18 +243,18 @@ static void lwproc_execnotify(const char *comm) { - spops.spop_schedule(); - spops.spop_execnotify(comm); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + rumpuser__hyp.hyp_execnotify(comm); + rumpuser__hyp.hyp_unschedule(); } static void lwproc_lwpexit(void) { - spops.spop_schedule(); - spops.spop_lwpexit(); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + rumpuser__hyp.hyp_lwpexit(); + rumpuser__hyp.hyp_unschedule(); } static int @@ -265,9 +263,9 @@ rumpsyscall(int sysnum, void *data, regi long retval[2] = {0, 0}; int rv; - spops.spop_schedule(); - rv = spops.spop_syscall(sysnum, data, retval); - spops.spop_unschedule(); + rumpuser__hyp.hyp_schedule(); + rv = rumpuser__hyp.hyp_syscall(sysnum, data, retval); + rumpuser__hyp.hyp_unschedule(); regrv[0] = retval[0]; regrv[1] = retval[1]; @@ -784,7 +782,7 @@ sp_copyin(void *arg, const void *raddr, void *rdata = NULL; /* XXXuninit */ int rv, nlocks; - rumpuser__unschedule(0, &nlocks, NULL); + rumpkern_unsched(&nlocks, NULL); rv = copyin_req(spc, raddr, len, wantstr, &rdata); if (rv) @@ -794,7 +792,7 @@ sp_copyin(void *arg, const void *raddr, free(rdata); out: - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); if (rv) return EFAULT; return 0; @@ -820,9 +818,9 @@ sp_copyout(void *arg, const void *laddr, struct spclient *spc = arg; int nlocks, rv; - rumpuser__unschedule(0, &nlocks, NULL); + rumpkern_unsched(&nlocks, NULL); rv = send_copyout_req(spc, raddr, laddr, dlen); - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); if (rv) return EFAULT; @@ -850,7 +848,7 @@ rumpuser_sp_anonmmap(void *arg, size_t h void *resp, *rdata; int nlocks, rv; - rumpuser__unschedule(0, &nlocks, NULL); + rumpkern_unsched(&nlocks, NULL); rv = anonmmap_req(spc, howmuch, &rdata); if (rv) { @@ -868,7 +866,7 @@ rumpuser_sp_anonmmap(void *arg, size_t h *addr = resp; out: - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); if (rv) return rv; @@ -881,9 +879,9 @@ rumpuser_sp_raise(void *arg, int signo) struct spclient *spc = arg; int rv, nlocks; - rumpuser__unschedule(0, &nlocks, NULL); + rumpkern_unsched(&nlocks, NULL); rv = send_raise_req(spc, signo); - rumpuser__reschedule(nlocks, NULL); + rumpkern_sched(nlocks, NULL); return rv; } @@ -1298,7 +1296,7 @@ spserver(void *arg) static unsigned cleanupidx; static struct sockaddr *cleanupsa; int -rumpuser_sp_init(const char *url, const struct rumpuser_sp_ops *spopsp, +rumpuser_sp_init(const char *url, const char *ostype, const char *osrelease, const char *machine) { pthread_t pt; @@ -1323,7 +1321,6 @@ rumpuser_sp_init(const char *url, const if (s == -1) return errno; - spops = *spopsp; sarg = malloc(sizeof(*sarg)); if (sarg == NULL) { close(s); Index: src/sys/rump/include/rump/rumpuser.h diff -u src/sys/rump/include/rump/rumpuser.h:1.92 src/sys/rump/include/rump/rumpuser.h:1.93 --- src/sys/rump/include/rump/rumpuser.h:1.92 Mon Apr 29 14:07:01 2013 +++ src/sys/rump/include/rump/rumpuser.h Mon Apr 29 14:51:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpuser.h,v 1.92 2013/04/29 14:07:01 pooka Exp $ */ +/* $NetBSD: rumpuser.h,v 1.93 2013/04/29 14:51:40 pooka Exp $ */ /* * Copyright (c) 2007-2013 Antti Kantee. All Rights Reserved. @@ -36,15 +36,33 @@ #if !defined(_KERNEL) && !defined(LIBRUMPUSER) #error The rump/rumpuser.h interface is not for non-kernel consumers #endif +struct lwp; /* * init */ #define RUMPUSER_VERSION 16 -typedef void (*rump_reschedulefn)(int, void *); -typedef void (*rump_unschedulefn)(int, int *, void *); -int rumpuser_init(int, rump_reschedulefn, rump_unschedulefn); + +/* hypervisor upcall routines */ +struct rumpuser_hyperup { + void (*hyp_schedule)(void); + void (*hyp_unschedule)(void); + void (*hyp_backend_unschedule)(int, int *, void *); + void (*hyp_backend_schedule)(int, void *); + void (*hyp_lwproc_switch)(struct lwp *); + void (*hyp_lwproc_release)(void); + int (*hyp_lwproc_rfork)(void *, int, const char *); + int (*hyp_lwproc_newlwp)(pid_t); + struct lwp * (*hyp_lwproc_curlwp)(void); + int (*hyp_syscall)(int, void *, long *); + void (*hyp_lwpexit)(void); + void (*hyp_execnotify)(const char *); + pid_t (*hyp_getpid)(void); + void *hyp__extra[8]; +}; +int rumpuser_init(int, const struct rumpuser_hyperup *); +void rumpuser_fini(void); /* * memory allocation @@ -151,7 +169,6 @@ int rumpuser_thread_create(void *(*f)(v void rumpuser_thread_exit(void) __dead; int rumpuser_thread_join(void *); -struct lwp; void rumpuser_set_curlwp(struct lwp *); struct lwp *rumpuser_get_curlwp(void); @@ -210,22 +227,7 @@ int rumpuser_daemonize_done(int); * syscall proxy */ -struct rumpuser_sp_ops { - void (*spop_schedule)(void); - void (*spop_unschedule)(void); - - void (*spop_lwproc_switch)(struct lwp *); - void (*spop_lwproc_release)(void); - int (*spop_lwproc_rfork)(void *, int, const char *); - int (*spop_lwproc_newlwp)(pid_t); - struct lwp * (*spop_lwproc_curlwp)(void); - int (*spop_syscall)(int, void *, long *); - void (*spop_lwpexit)(void); - void (*spop_execnotify)(const char *); - pid_t (*spop_getpid)(void); -}; - -int rumpuser_sp_init(const char *, const struct rumpuser_sp_ops *, +int rumpuser_sp_init(const char *, const char *, const char *, const char *); int rumpuser_sp_copyin(void *, const void *, void *, size_t); int rumpuser_sp_copyinstr(void *, const void *, void *, size_t *); Index: src/sys/rump/librump/rumpkern/klock.c diff -u src/sys/rump/librump/rumpkern/klock.c:1.5 src/sys/rump/librump/rumpkern/klock.c:1.6 --- src/sys/rump/librump/rumpkern/klock.c:1.5 Tue Oct 9 13:35:50 2012 +++ src/sys/rump/librump/rumpkern/klock.c Mon Apr 29 14:51:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: klock.c,v 1.5 2012/10/09 13:35:50 pooka Exp $ */ +/* $NetBSD: klock.c,v 1.6 2013/04/29 14:51:41 pooka Exp $ */ /* * Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: klock.c,v 1.5 2012/10/09 13:35:50 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: klock.c,v 1.6 2013/04/29 14:51:41 pooka Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -166,3 +166,14 @@ rump_user_schedule(int nlocks, void *int if (nlocks) _kernel_lock(nlocks); } + +void +rump_user_kthread(void) +{ + + KASSERT(curlwp == NULL); + rump_schedule(); + if (rump_lwproc_newlwp(0) != 0) + panic("kthread create failed"); + rump_unschedule(); +} Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.262 src/sys/rump/librump/rumpkern/rump.c:1.263 --- src/sys/rump/librump/rumpkern/rump.c:1.262 Sun Apr 28 13:17:25 2013 +++ src/sys/rump/librump/rumpkern/rump.c Mon Apr 29 14:51:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.262 2013/04/28 13:17:25 pooka Exp $ */ +/* $NetBSD: rump.c,v 1.263 2013/04/29 14:51:41 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.262 2013/04/28 13:17:25 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.263 2013/04/29 14:51:41 pooka Exp $"); #include <sys/systm.h> #define ELFSIZE ARCH_ELFSIZE @@ -101,10 +101,10 @@ int rump_threads = 0; int rump_threads = 1; #endif -static int rump_proxy_syscall(int, void *, long *); -static int rump_proxy_rfork(void *, int, const char *); -static void rump_proxy_lwpexit(void); -static void rump_proxy_execnotify(const char *); +static int rump_hyp_syscall(int, void *, long *); +static int rump_hyp_rfork(void *, int, const char *); +static void rump_hyp_lwpexit(void); +static void rump_hyp_execnotify(const char *); static void rump_component_load(const struct rump_component *); static struct lwp *bootlwp; @@ -184,18 +184,20 @@ spgetpid(void) return curproc->p_pid; } -static const struct rumpuser_sp_ops spops = { - .spop_schedule = rump_schedule, - .spop_unschedule = rump_unschedule, - .spop_lwproc_switch = rump_lwproc_switch, - .spop_lwproc_release = rump_lwproc_releaselwp, - .spop_lwproc_rfork = rump_proxy_rfork, - .spop_lwproc_newlwp = rump_lwproc_newlwp, - .spop_lwproc_curlwp = rump_lwproc_curlwp, - .spop_lwpexit = rump_proxy_lwpexit, - .spop_syscall = rump_proxy_syscall, - .spop_execnotify = rump_proxy_execnotify, - .spop_getpid = spgetpid, +static const struct rumpuser_hyperup hyp = { + .hyp_schedule = rump_schedule, + .hyp_unschedule = rump_unschedule, + .hyp_backend_unschedule = rump_user_unschedule, + .hyp_backend_schedule = rump_user_schedule, + .hyp_lwproc_switch = rump_lwproc_switch, + .hyp_lwproc_release = rump_lwproc_releaselwp, + .hyp_lwproc_rfork = rump_hyp_rfork, + .hyp_lwproc_newlwp = rump_lwproc_newlwp, + .hyp_lwproc_curlwp = rump_lwproc_curlwp, + .hyp_lwpexit = rump_hyp_lwpexit, + .hyp_syscall = rump_hyp_syscall, + .hyp_execnotify = rump_hyp_execnotify, + .hyp_getpid = spgetpid, }; int @@ -247,8 +249,7 @@ rump_init(void) rump_inited = 1; /* initialize hypervisor */ - if (rumpuser_init(RUMPUSER_VERSION, - rump_user_schedule, rump_user_unschedule) != 0) { + if (rumpuser_init(RUMPUSER_VERSION, &hyp) != 0) { rumpuser_dprintf("rumpuser init failed\n"); return EINVAL; } @@ -533,7 +534,7 @@ int rump_init_server(const char *url) { - return rumpuser_sp_init(url, &spops, ostype, osrelease, MACHINE); + return rumpuser_sp_init(url, ostype, osrelease, MACHINE); } void @@ -776,7 +777,7 @@ rump_kernelfsym_load(void *symtab, uint6 } static int -rump_proxy_syscall(int num, void *arg, long *retval) +rump_hyp_syscall(int num, void *arg, long *retval) { register_t regrv[2] = {0, 0}; struct lwp *l; @@ -796,7 +797,7 @@ rump_proxy_syscall(int num, void *arg, l } static int -rump_proxy_rfork(void *priv, int flags, const char *comm) +rump_hyp_rfork(void *priv, int flags, const char *comm) { struct vmspace *newspace; struct proc *p; @@ -825,7 +826,7 @@ rump_proxy_rfork(void *priv, int flags, * Order all lwps in a process to exit. does *not* wait for them to drain. */ static void -rump_proxy_lwpexit(void) +rump_hyp_lwpexit(void) { struct proc *p = curproc; uint64_t where; @@ -877,7 +878,7 @@ rump_proxy_lwpexit(void) * Notify process that all threads have been drained and exec is complete. */ static void -rump_proxy_execnotify(const char *comm) +rump_hyp_execnotify(const char *comm) { struct proc *p = curproc;