Define MODULAR for rump core components. This enables module loading via the kernel module framework (instead of dlopen()). For now it only works on amd64 and i386, but for the rest it should just be a matter of including the relevant kobj_machdep.c modules from the kernel sources.diff -r1.2 -r1.3 src/sys/rump/librump/Makefile.inc
(pooka)
--- src/sys/rump/librump/Makefile.inc 2008/10/30 01:54:24 1.2
+++ src/sys/rump/librump/Makefile.inc 2009/01/01 19:07:43 1.3
@@ -1,3 +1,14 @@ | @@ -1,3 +1,14 @@ | |||
1 | # $NetBSD: Makefile.inc,v 1.2 2008/10/30 01:54:24 christos Exp $ | 1 | # $NetBSD: Makefile.inc,v 1.3 2009/01/01 19:07:43 pooka Exp $ | |
2 | # | 2 | # | |
3 | ||||
4 | # | |||
5 | # Mandatory flags | |||
6 | # | |||
7 | CPPFLAGS+= -DMODULAR | |||
8 | ||||
9 | # | |||
10 | # Optional flags | |||
11 | # | |||
12 | ||||
13 | # Comment this out if you want the build to default to allowing threads | |||
3 | CPPFLAGS+= -DRUMP_WITHOUT_THREADS | 14 | CPPFLAGS+= -DRUMP_WITHOUT_THREADS |
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern 2008/12/31 13:08:57 1.26
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern 2009/01/01 19:07:43 1.27
@@ -1,80 +1,91 @@ | @@ -1,80 +1,91 @@ | |||
1 | # $NetBSD: Makefile.rumpkern,v 1.26 2008/12/31 13:08:57 pooka Exp $ | 1 | # $NetBSD: Makefile.rumpkern,v 1.27 2009/01/01 19:07:43 pooka Exp $ | |
2 | # | 2 | # | |
3 | 3 | |||
4 | .include "${RUMPTOP}/Makefile.rump" | 4 | .include "${RUMPTOP}/Makefile.rump" | |
5 | 5 | |||
6 | LIB= rump | 6 | LIB= rump | |
7 | LDFLAGS+= -Wl,--wrap=malloc | 7 | LDFLAGS+= -Wl,--wrap=malloc | |
8 | 8 | |||
9 | .PATH: ${RUMPTOP}/librump/rumpkern \ | 9 | .PATH: ${RUMPTOP}/librump/rumpkern \ | |
10 | ${RUMPTOP}/../kern ${RUMPTOP}/../lib/libkern \ | 10 | ${RUMPTOP}/../kern ${RUMPTOP}/../lib/libkern \ | |
11 | ${RUMPTOP}/../conf ${RUMPTOP}/../dev \ | 11 | ${RUMPTOP}/../conf ${RUMPTOP}/../dev \ | |
12 | ${RUMPTOP}/../../common/lib/libutil \ | 12 | ${RUMPTOP}/../../common/lib/libutil \ | |
13 | ${RUMPTOP}/../../common/lib/libc/gen | 13 | ${RUMPTOP}/../../common/lib/libutil \ | |
14 | ${RUMPTOP}/../../common/lib/libc/gen \ | |||
15 | ${RUMPTOP}/../../common/lib/libc/stdlib | |||
14 | 16 | |||
15 | # | 17 | # | |
16 | # Source modules, first the ones specifically implemented for librump. | 18 | # Source modules, first the ones specifically implemented for librump. | |
17 | # | 19 | # | |
18 | SRCS= rump.c emul.c intr.c locks.c ltsleep.c percpu.c pool.c sleepq.c vm.c | 20 | SRCS= rump.c emul.c intr.c locks.c ltsleep.c percpu.c pool.c sleepq.c vm.c | |
19 | 21 | |||
20 | # stubs | 22 | # stubs | |
21 | # | 23 | # | |
22 | SRCS+= misc_stub.c pmap_stub.c | 24 | SRCS+= misc_stub.c pmap_stub.c | |
23 | 25 | |||
24 | # autogenerated | 26 | # autogenerated | |
25 | # | 27 | # | |
26 | SRCS+= rump_syscalls.c | 28 | SRCS+= rump_syscalls.c | |
27 | 29 | |||
28 | # | 30 | # | |
29 | # Rest are from the std kernel sources. | 31 | # Rest are from the std kernel sources. | |
30 | # | 32 | # | |
31 | # sys/kern | 33 | # sys/kern | |
32 | SRCS+= kern_auth.c kern_descrip.c kern_malloc_stdtype.c kern_module.c \ | 34 | SRCS+= kern_auth.c kern_descrip.c kern_ksyms.c kern_malloc_stdtype.c \ | |
33 | kern_rate.c kern_stub.c kern_sysctl.c kern_timeout.c \ | 35 | kern_module.c kern_rate.c kern_stub.c kern_sysctl.c \ | |
34 | kern_uidinfo.c param.c sys_descrip.c sys_generic.c | 36 | kern_timeout.c kern_uidinfo.c param.c sys_descrip.c \ | |
37 | sys_generic.c | |||
35 | 38 | |||
36 | # sys/kern subr (misc) | 39 | # sys/kern subr (misc) | |
37 | SRCS+= subr_devsw.c subr_callback.c subr_hash.c subr_iostat.c \ | 40 | SRCS+= subr_devsw.c subr_callback.c subr_hash.c subr_iostat.c \ | |
38 | subr_kobj.c subr_once.c subr_prf2.c subr_specificdata.c \ | 41 | subr_kobj.c subr_once.c subr_prf2.c subr_specificdata.c \ | |
39 | subr_time.c subr_workqueue.c | 42 | subr_time.c subr_workqueue.c | |
40 | 43 | |||
41 | # the funny bit. this doesn't really belong here, but helps with the | 44 | # the funny bit. this doesn't really belong here, but helps with the | |
42 | # needs of kern_descrip.c. And since it's a fully dynamic interface, | 45 | # needs of kern_descrip.c. And since it's a fully dynamic interface, | |
43 | # it doesn't pull in other gunk. | 46 | # it doesn't pull in other gunk. | |
44 | SRCS+= vnode_if.c | 47 | SRCS+= vnode_if.c | |
45 | 48 | |||
46 | # sys/dev | 49 | # sys/dev | |
47 | SRCS+= clock_subr.c | 50 | SRCS+= clock_subr.c | |
48 | 51 | |||
49 | # sys/lib/libkern | 52 | # sys/lib/libkern | |
50 | SRCS+= __assert.c scanc.c skpc.c | 53 | SRCS+= __assert.c scanc.c skpc.c | |
51 | 54 | |||
52 | # src/common | 55 | # src/common | |
53 | SRCS+= snprintb.c rb.c | 56 | SRCS+= snprintb.c rb.c heapsort.c | |
54 | 57 | |||
55 | # uncomment these lines if you want to use the real kmem code | 58 | # uncomment these lines if you want to use the real kmem code | |
56 | #CPPFLAGS+= -DRUMP_USE_REAL_KMEM | 59 | #CPPFLAGS+= -DRUMP_USE_REAL_KMEM | |
57 | #SRCS+= subr_kmem.c subr_vmem.c | 60 | #SRCS+= subr_kmem.c subr_vmem.c | |
58 | 61 | |||
59 | .if ${MACHINE_ARCH} == "vax" | 62 | .if ${MACHINE_ARCH} == "vax" | |
60 | .PATH: ${RUMPTOP}/../lib/libkern/arch/vax | 63 | .PATH: ${RUMPTOP}/../lib/libkern/arch/vax | |
61 | SRCS+= blkset.S | 64 | SRCS+= blkset.S | |
62 | .endif | 65 | .endif | |
63 | 66 | |||
64 | # no shlib_version because this is automatically in sync with lib/librump | 67 | # no shlib_version because this is automatically in sync with lib/librump | |
65 | SHLIB_MAJOR= 0 | 68 | SHLIB_MAJOR= 0 | |
66 | SHLIB_MINOR= 0 | 69 | SHLIB_MINOR= 0 | |
67 | 70 | |||
68 | CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern | 71 | CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern | |
69 | CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt -DMAXUSERS=32 | 72 | CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern/opt -DMAXUSERS=32 | |
70 | CPPFLAGS+= -I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpvfs | 73 | CPPFLAGS+= -I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpvfs | |
71 | CFLAGS+= -Wno-pointer-sign | 74 | CFLAGS+= -Wno-pointer-sign | |
72 | 75 | |||
76 | # | |||
77 | # If archdir exists, it is required to provide: | |||
78 | # 1) kobj_reloc() and kobj_machdep() | |||
79 | # 2) ...? | |||
80 | # 3) PROFIT! | |||
81 | # | |||
73 | ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH} | 82 | ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH} | |
74 | .if exists(${ARCHDIR}) | 83 | .if exists(${ARCHDIR}) | |
75 | .include "${ARCHDIR}/Makefile.inc" | 84 | .include "${ARCHDIR}/Makefile.inc" | |
76 | .PATH: ${ARCHDIR} | 85 | .PATH: ${ARCHDIR} | |
86 | .else | |||
87 | SRCS+= kobj_stubs.c | |||
77 | .endif | 88 | .endif | |
78 | 89 | |||
79 | .include <bsd.lib.mk> | 90 | .include <bsd.lib.mk> | |
80 | .include <bsd.klinks.mk> | 91 | .include <bsd.klinks.mk> |
--- src/sys/rump/librump/rumpkern/emul.c 2008/12/30 00:36:38 1.65
+++ src/sys/rump/librump/rumpkern/emul.c 2009/01/01 19:07:43 1.66
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: emul.c,v 1.65 2008/12/30 00:36:38 pooka Exp $ */ | 1 | /* $NetBSD: emul.c,v 1.66 2009/01/01 19:07:43 pooka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Development of this software was supported by Google Summer of Code. | 6 | * Development of this software was supported by Google Summer of Code. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -18,75 +18,79 @@ | @@ -18,75 +18,79 @@ | |||
18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | 27 | * SUCH DAMAGE. | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | #include <sys/cdefs.h> | 30 | #include <sys/cdefs.h> | |
31 | __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.65 2008/12/30 00:36:38 pooka Exp $"); | 31 | __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.66 2009/01/01 19:07:43 pooka Exp $"); | |
32 | 32 | |||
33 | #define malloc(a,b,c) __wrap_malloc(a,b,c) | 33 | #define malloc(a,b,c) __wrap_malloc(a,b,c) | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/malloc.h> | 36 | #include <sys/malloc.h> | |
37 | #include <sys/null.h> | 37 | #include <sys/null.h> | |
38 | #include <sys/vnode.h> | 38 | #include <sys/vnode.h> | |
39 | #include <sys/stat.h> | 39 | #include <sys/stat.h> | |
40 | #include <sys/select.h> | 40 | #include <sys/select.h> | |
41 | #include <sys/syslog.h> | 41 | #include <sys/syslog.h> | |
42 | #include <sys/namei.h> | 42 | #include <sys/namei.h> | |
43 | #include <sys/kauth.h> | 43 | #include <sys/kauth.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/device.h> | 45 | #include <sys/device.h> | |
46 | #include <sys/queue.h> | 46 | #include <sys/queue.h> | |
47 | #include <sys/file.h> | 47 | #include <sys/file.h> | |
48 | #include <sys/filedesc.h> | 48 | #include <sys/filedesc.h> | |
49 | #include <sys/kthread.h> | 49 | #include <sys/kthread.h> | |
50 | #include <sys/cpu.h> | 50 | #include <sys/cpu.h> | |
51 | #include <sys/kmem.h> | 51 | #include <sys/kmem.h> | |
52 | #include <sys/poll.h> | 52 | #include <sys/poll.h> | |
53 | #include <sys/tprintf.h> | |||
54 | #include <sys/timetc.h> | 53 | #include <sys/timetc.h> | |
54 | #include <sys/tprintf.h> | |||
55 | #include <sys/module.h> | |||
55 | 56 | |||
56 | #include <machine/bswap.h> | 57 | #include <machine/bswap.h> | |
57 | #include <machine/stdarg.h> | 58 | #include <machine/stdarg.h> | |
58 | 59 | |||
59 | #include <rump/rumpuser.h> | 60 | #include <rump/rumpuser.h> | |
60 | 61 | |||
61 | #include <uvm/uvm_map.h> | 62 | #include <uvm/uvm_map.h> | |
62 | 63 | |||
63 | #include "rump_private.h" | 64 | #include "rump_private.h" | |
64 | 65 | |||
65 | time_t time_second = 1; | 66 | time_t time_second = 1; | |
66 | 67 | |||
67 | kmutex_t *proc_lock; | 68 | kmutex_t *proc_lock; | |
68 | struct lwp lwp0; | 69 | struct lwp lwp0; | |
69 | struct vnode *rootvp; | 70 | struct vnode *rootvp; | |
70 | struct device *root_device; | 71 | struct device *root_device; | |
71 | dev_t rootdev; | 72 | dev_t rootdev; | |
72 | int physmem = 256*256; /* 256 * 1024*1024 / 4k, PAGE_SIZE not always set */ | 73 | int physmem = 256*256; /* 256 * 1024*1024 / 4k, PAGE_SIZE not always set */ | |
73 | int doing_shutdown; | 74 | int doing_shutdown; | |
74 | int ncpu = 1; | 75 | int ncpu = 1; | |
75 | const int schedppq = 1; | 76 | const int schedppq = 1; | |
76 | int hardclock_ticks; | 77 | int hardclock_ticks; | |
77 | bool mp_online = false; | 78 | bool mp_online = false; | |
78 | struct vm_map *mb_map; | 79 | struct vm_map *mb_map; | |
79 | struct timeval boottime; | 80 | struct timeval boottime; | |
81 | struct emul emul_netbsd; | |||
82 | int cold = 1; | |||
83 | int boothowto; | |||
80 | 84 | |||
81 | char hostname[MAXHOSTNAMELEN]; | 85 | char hostname[MAXHOSTNAMELEN]; | |
82 | size_t hostnamelen; | 86 | size_t hostnamelen; | |
83 | 87 | |||
84 | u_long bufmem_valimit; | 88 | u_long bufmem_valimit; | |
85 | u_long bufmem_hiwater; | 89 | u_long bufmem_hiwater; | |
86 | u_long bufmem_lowater; | 90 | u_long bufmem_lowater; | |
87 | u_long bufmem; | 91 | u_long bufmem; | |
88 | u_int nbuf; | 92 | u_int nbuf; | |
89 | 93 | |||
90 | const char *panicstr; | 94 | const char *panicstr; | |
91 | const char ostype[] = "NetBSD"; | 95 | const char ostype[] = "NetBSD"; | |
92 | const char osrelease[] = "999"; /* paradroid 4evah */ | 96 | const char osrelease[] = "999"; /* paradroid 4evah */ | |
@@ -669,13 +673,23 @@ uint16_t | @@ -669,13 +673,23 @@ uint16_t | |||
669 | bswap16(uint16_t v) | 673 | bswap16(uint16_t v) | |
670 | { | 674 | { | |
671 | 675 | |||
672 | return __bswap16(v); | 676 | return __bswap16(v); | |
673 | } | 677 | } | |
674 | 678 | |||
675 | uint32_t | 679 | uint32_t | |
676 | bswap32(uint32_t v) | 680 | bswap32(uint32_t v) | |
677 | { | 681 | { | |
678 | 682 | |||
679 | return __bswap32(v); | 683 | return __bswap32(v); | |
680 | } | 684 | } | |
681 | #endif /* __BSWAP_RENAME */ | 685 | #endif /* __BSWAP_RENAME */ | |
686 | ||||
687 | void | |||
688 | module_init_md() | |||
689 | { | |||
690 | ||||
691 | /* | |||
692 | * Nothing for now. However, we should load the librump | |||
693 | * symbol table. | |||
694 | */ | |||
695 | } |
--- src/sys/rump/librump/rumpkern/Attic/misc_stub.c 2008/12/18 00:24:12 1.16
+++ src/sys/rump/librump/rumpkern/Attic/misc_stub.c 2009/01/01 19:07:43 1.17
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: misc_stub.c,v 1.16 2008/12/18 00:24:12 pooka Exp $ */ | 1 | /* $NetBSD: misc_stub.c,v 1.17 2009/01/01 19:07:43 pooka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Development of this software was supported by Google Summer of Code. | 6 | * Development of this software was supported by Google Summer of Code. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -18,36 +18,37 @@ | @@ -18,36 +18,37 @@ | |||
18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | 27 | * SUCH DAMAGE. | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | #include <sys/cdefs.h> | 30 | #include <sys/cdefs.h> | |
31 | __KERNEL_RCSID(0, "$NetBSD: misc_stub.c,v 1.16 2008/12/18 00:24:12 pooka Exp $"); | 31 | __KERNEL_RCSID(0, "$NetBSD: misc_stub.c,v 1.17 2009/01/01 19:07:43 pooka Exp $"); | |
32 | 32 | |||
33 | #include <sys/param.h> | 33 | #include <sys/param.h> | |
34 | #include <sys/cpu.h> | |||
35 | #include <sys/evcnt.h> | |||
34 | #include <sys/event.h> | 36 | #include <sys/event.h> | |
35 | #include <sys/sched.h> | 37 | #include <sys/sched.h> | |
36 | #include <sys/sysctl.h> | 38 | #include <sys/sysctl.h> | |
37 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
38 | #include <sys/syscallvar.h> | 40 | #include <sys/syscallvar.h> | |
39 | #include <sys/cpu.h> | 41 | #include <sys/xcall.h> | |
40 | #include <sys/evcnt.h> | |||
41 | 42 | |||
42 | #ifdef __sparc__ | 43 | #ifdef __sparc__ | |
43 | /* | 44 | /* | |
44 | * XXX Least common denominator - smallest sparc pagesize. | 45 | * XXX Least common denominator - smallest sparc pagesize. | |
45 | * Could just be declared, pooka says rump doesn't use ioctl. | 46 | * Could just be declared, pooka says rump doesn't use ioctl. | |
46 | */ | 47 | */ | |
47 | int nbpg = 4096; | 48 | int nbpg = 4096; | |
48 | #endif | 49 | #endif | |
49 | 50 | |||
50 | void | 51 | void | |
51 | yield(void) | 52 | yield(void) | |
52 | { | 53 | { | |
53 | 54 | |||
@@ -97,13 +98,27 @@ evcnt_detach(struct evcnt *ev) | @@ -97,13 +98,27 @@ evcnt_detach(struct evcnt *ev) | |||
97 | int | 98 | int | |
98 | syscall_establish(const struct emul *em, const struct syscall_package *sp) | 99 | syscall_establish(const struct emul *em, const struct syscall_package *sp) | |
99 | { | 100 | { | |
100 | 101 | |||
101 | return 0; | 102 | return 0; | |
102 | } | 103 | } | |
103 | 104 | |||
104 | int | 105 | int | |
105 | syscall_disestablish(const struct emul *em, const struct syscall_package *sp) | 106 | syscall_disestablish(const struct emul *em, const struct syscall_package *sp) | |
106 | { | 107 | { | |
107 | 108 | |||
108 | return 0; | 109 | return 0; | |
109 | } | 110 | } | |
111 | ||||
112 | /* crosscalls not done, no other hardware CPUs */ | |||
113 | uint64_t | |||
114 | xc_broadcast(u_int flags, xcfunc_t func, void *arg1, void *arg2) | |||
115 | { | |||
116 | ||||
117 | return -1; | |||
118 | } | |||
119 | ||||
120 | void | |||
121 | xc_wait(uint64_t where) | |||
122 | { | |||
123 | ||||
124 | } |
--- src/sys/rump/librump/rumpkern/rump.c 2008/12/29 17:45:55 1.79
+++ src/sys/rump/librump/rumpkern/rump.c 2009/01/01 19:07:43 1.80
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rump.c,v 1.79 2008/12/29 17:45:55 pooka Exp $ */ | 1 | /* $NetBSD: rump.c,v 1.80 2009/01/01 19:07:43 pooka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Development of this software was supported by Google Summer of Code. | 6 | * Development of this software was supported by Google Summer of Code. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -18,37 +18,38 @@ | @@ -18,37 +18,38 @@ | |||
18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
27 | * SUCH DAMAGE. | 27 | * SUCH DAMAGE. | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | #include <sys/cdefs.h> | 30 | #include <sys/cdefs.h> | |
31 | __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.79 2008/12/29 17:45:55 pooka Exp $"); | 31 | __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.80 2009/01/01 19:07:43 pooka Exp $"); | |
32 | 32 | |||
33 | #include <sys/param.h> | 33 | #include <sys/param.h> | |
34 | #include <sys/atomic.h> | 34 | #include <sys/atomic.h> | |
35 | #include <sys/buf.h> | 35 | #include <sys/buf.h> | |
36 | #include <sys/callout.h> | 36 | #include <sys/callout.h> | |
37 | #include <sys/conf.h> | 37 | #include <sys/conf.h> | |
38 | #include <sys/cpu.h> | 38 | #include <sys/cpu.h> | |
39 | #include <sys/filedesc.h> | 39 | #include <sys/filedesc.h> | |
40 | #include <sys/iostat.h> | 40 | #include <sys/iostat.h> | |
41 | #include <sys/kauth.h> | 41 | #include <sys/kauth.h> | |
42 | #include <sys/kernel.h> | |||
42 | #include <sys/kmem.h> | 43 | #include <sys/kmem.h> | |
43 | #include <sys/module.h> | 44 | #include <sys/module.h> | |
44 | #include <sys/once.h> | 45 | #include <sys/once.h> | |
45 | #include <sys/percpu.h> | 46 | #include <sys/percpu.h> | |
46 | #include <sys/queue.h> | 47 | #include <sys/queue.h> | |
47 | #include <sys/resourcevar.h> | 48 | #include <sys/resourcevar.h> | |
48 | #include <sys/select.h> | 49 | #include <sys/select.h> | |
49 | #include <sys/uidinfo.h> | 50 | #include <sys/uidinfo.h> | |
50 | #include <sys/sysctl.h> | 51 | #include <sys/sysctl.h> | |
51 | 52 | |||
52 | #include <rump/rumpuser.h> | 53 | #include <rump/rumpuser.h> | |
53 | 54 | |||
54 | #include "rump_private.h" | 55 | #include "rump_private.h" | |
@@ -101,28 +102,26 @@ pvfsinit_nop(struct proc *p) | @@ -101,28 +102,26 @@ pvfsinit_nop(struct proc *p) | |||
101 | static void | 102 | static void | |
102 | pvfsrele_nop(struct proc *p) | 103 | pvfsrele_nop(struct proc *p) | |
103 | { | 104 | { | |
104 | 105 | |||
105 | return; | 106 | return; | |
106 | } | 107 | } | |
107 | 108 | |||
108 | rump_proc_vfs_init_fn rump_proc_vfs_init = pvfsinit_nop; | 109 | rump_proc_vfs_init_fn rump_proc_vfs_init = pvfsinit_nop; | |
109 | rump_proc_vfs_release_fn rump_proc_vfs_release = pvfsrele_nop; | 110 | rump_proc_vfs_release_fn rump_proc_vfs_release = pvfsrele_nop; | |
110 | 111 | |||
111 | int | 112 | int | |
112 | _rump_init(int rump_version) | 113 | _rump_init(int rump_version) | |
113 | { | 114 | { | |
114 | extern char hostname[]; | |||
115 | extern size_t hostnamelen; | |||
116 | char buf[256]; | 115 | char buf[256]; | |
117 | struct proc *p; | 116 | struct proc *p; | |
118 | struct lwp *l; | 117 | struct lwp *l; | |
119 | int error; | 118 | int error; | |
120 | 119 | |||
121 | /* XXX */ | 120 | /* XXX */ | |
122 | if (rump_inited) | 121 | if (rump_inited) | |
123 | return 0; | 122 | return 0; | |
124 | rump_inited = 1; | 123 | rump_inited = 1; | |
125 | 124 | |||
126 | if (rump_version != RUMP_VERSION) { | 125 | if (rump_version != RUMP_VERSION) { | |
127 | printf("rump version mismatch, %d vs. %d\n", | 126 | printf("rump version mismatch, %d vs. %d\n", | |
128 | rump_version, RUMP_VERSION); | 127 | rump_version, RUMP_VERSION); | |
@@ -168,26 +167,27 @@ _rump_init(int rump_version) | @@ -168,26 +167,27 @@ _rump_init(int rump_version) | |||
168 | 167 | |||
169 | rumpuser_thrinit(); | 168 | rumpuser_thrinit(); | |
170 | callout_startup(); | 169 | callout_startup(); | |
171 | callout_init_cpu(&rump_cpu); | 170 | callout_init_cpu(&rump_cpu); | |
172 | 171 | |||
173 | once_init(); | 172 | once_init(); | |
174 | iostat_init(); | 173 | iostat_init(); | |
175 | uid_init(); | 174 | uid_init(); | |
176 | percpu_init(); | 175 | percpu_init(); | |
177 | fd_sys_init(); | 176 | fd_sys_init(); | |
178 | module_init(); | 177 | module_init(); | |
179 | sysctl_init(); | 178 | sysctl_init(); | |
180 | softint_init(&rump_cpu); | 179 | softint_init(&rump_cpu); | |
180 | cold = 0; | |||
181 | devsw_init(); | 181 | devsw_init(); | |
182 | 182 | |||
183 | /* these do nothing if not present */ | 183 | /* these do nothing if not present */ | |
184 | rump_vfs_init(); | 184 | rump_vfs_init(); | |
185 | rump_net_init(); | 185 | rump_net_init(); | |
186 | 186 | |||
187 | /* aieeeedondest */ | 187 | /* aieeeedondest */ | |
188 | if (rump_threads) { | 188 | if (rump_threads) { | |
189 | if (workqueue_create(&uvm.aiodone_queue, "aiodoned", | 189 | if (workqueue_create(&uvm.aiodone_queue, "aiodoned", | |
190 | rump_aiodone_worker, NULL, 0, 0, 0)) | 190 | rump_aiodone_worker, NULL, 0, 0, 0)) | |
191 | panic("aiodoned"); | 191 | panic("aiodoned"); | |
192 | } | 192 | } | |
193 | 193 |
--- src/sys/rump/librump/rumpkern/arch/i386/Makefile.inc 2009/01/01 16:50:30 1.2
+++ src/sys/rump/librump/rumpkern/arch/i386/Makefile.inc 2009/01/01 19:07:43 1.3
@@ -1,4 +1,7 @@ | @@ -1,4 +1,7 @@ | |||
1 | # $NetBSD: Makefile.inc,v 1.2 2009/01/01 16:50:30 pooka Exp $ | 1 | # $NetBSD: Makefile.inc,v 1.3 2009/01/01 19:07:43 pooka Exp $ | |
2 | # | 2 | # | |
3 | 3 | |||
4 | SRCS+= rumpcpu.c rumpspl.c | 4 | SRCS+= rumpcpu.c rumpspl.c | |
5 | ||||
6 | .PATH: ${RUMPTOP}/../arch/i386/i386 | |||
7 | SRCS+= kobj_machdep.c |
--- src/sys/rump/librump/rumpkern/arch/i386/Attic/rumpcpu.c 2009/01/01 16:50:30 1.1
+++ src/sys/rump/librump/rumpkern/arch/i386/Attic/rumpcpu.c 2009/01/01 19:07:43 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: rumpcpu.c,v 1.1 2009/01/01 16:50:30 pooka Exp $ */ | 1 | /* $NetBSD: rumpcpu.c,v 1.2 2009/01/01 19:07:43 pooka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2008 Antti Kantee. All Rights Reserved. | 4 | * Copyright (c) 2008 Antti Kantee. All Rights Reserved. | |
5 | * | 5 | * | |
6 | * Development of this software was supported by the | 6 | * Development of this software was supported by the | |
7 | * Finnish Cultural Foundation. | 7 | * Finnish Cultural Foundation. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -19,36 +19,48 @@ | @@ -19,36 +19,48 @@ | |||
19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 24 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
28 | * SUCH DAMAGE. | 28 | * SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: rumpcpu.c,v 1.1 2009/01/01 16:50:30 pooka Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: rumpcpu.c,v 1.2 2009/01/01 19:07:43 pooka Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | 35 | |||
36 | #include <machine/cpu.h> | 36 | #include <machine/cpu.h> | |
37 | 37 | |||
38 | #include "rump_private.h" | 38 | #include "rump_private.h" | |
39 | 39 | |||
40 | struct cpu_info *cpu_info_list = &rump_cpu; | 40 | struct cpu_info *cpu_info_list = &rump_cpu; | |
41 | 41 | |||
42 | struct cpu_info * | 42 | struct cpu_info * | |
43 | x86_curcpu() | 43 | x86_curcpu() | |
44 | { | 44 | { | |
45 | 45 | |||
46 | return &rump_cpu; | 46 | return &rump_cpu; | |
47 | } | 47 | } | |
48 | 48 | |||
49 | struct lwp * | 49 | struct lwp * | |
50 | x86_curlwp() | 50 | x86_curlwp() | |
51 | { | 51 | { | |
52 | 52 | |||
53 | return rump_get_curlwp(); | 53 | return rump_get_curlwp(); | |
54 | } | 54 | } | |
55 | ||||
56 | void | |||
57 | wbinvd() | |||
58 | { | |||
59 | ||||
60 | /* | |||
61 | * Used by kobj_machdep(). | |||
62 | * | |||
63 | * But, we Best not execute this since we're not Ring0 *. | |||
64 | * Honestly, I don't know why it's required even in the kernel. | |||
65 | */ | |||
66 | } |
--- src/sys/rump/librump/rumpkern/arch/x86_64/Makefile.inc 2009/01/01 16:50:30 1.2
+++ src/sys/rump/librump/rumpkern/arch/x86_64/Makefile.inc 2009/01/01 19:07:43 1.3
@@ -1,5 +1,8 @@ | @@ -1,5 +1,8 @@ | |||
1 | # $NetBSD: Makefile.inc,v 1.2 2009/01/01 16:50:30 pooka Exp $ | 1 | # $NetBSD: Makefile.inc,v 1.3 2009/01/01 19:07:43 pooka Exp $ | |
2 | # | 2 | # | |
3 | 3 | |||
4 | .PATH: ${ARCHDIR}/../i386 | 4 | .PATH: ${ARCHDIR}/../i386 | |
5 | SRCS+= rumpcpu.c rumpspl.c | 5 | SRCS+= rumpcpu.c rumpspl.c | |
6 | ||||
7 | .PATH: ${RUMPTOP}/../amd64/amd64 | |||
8 | SRCS+= kobj_machdep.c |