Wed Mar 18 17:56:15 2009 UTC ()
Support kqueue in the rump virtual kernel.


(pooka)
diff -r1.40 -r1.41 src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -r1.80 -r1.81 src/sys/rump/librump/rumpkern/emul.c
diff -r1.18 -r1.19 src/sys/rump/librump/rumpkern/misc_stub.c

cvs diff -r1.40 -r1.41 src/sys/rump/librump/rumpkern/Makefile.rumpkern (switch to unified diff)

--- src/sys/rump/librump/rumpkern/Makefile.rumpkern 2009/01/30 02:30:03 1.40
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern 2009/03/18 17:56:15 1.41
@@ -1,105 +1,105 @@ @@ -1,105 +1,105 @@
1# $NetBSD: Makefile.rumpkern,v 1.40 2009/01/30 02:30:03 pooka Exp $ 1# $NetBSD: Makefile.rumpkern,v 1.41 2009/03/18 17:56:15 pooka Exp $
2# 2#
3 3
4.include "${RUMPTOP}/Makefile.rump" 4.include "${RUMPTOP}/Makefile.rump"
5 5
6LIB= rump 6LIB= rump
7 7
8.PATH: ${RUMPTOP}/librump/rumpkern \ 8.PATH: ${RUMPTOP}/librump/rumpkern \
9 ${RUMPTOP}/../kern \ 9 ${RUMPTOP}/../kern \
10 ${RUMPTOP}/../conf \ 10 ${RUMPTOP}/../conf \
11 ${RUMPTOP}/../dev 11 ${RUMPTOP}/../dev
12 12
13# 13#
14# Source modules, first the ones specifically implemented for librump. 14# Source modules, first the ones specifically implemented for librump.
15#  15#
16SRCS= rump.c emul.c intr.c locks.c ltsleep.c percpu.c pool.c sleepq.c vm.c 16SRCS= rump.c emul.c intr.c locks.c ltsleep.c percpu.c pool.c sleepq.c vm.c
17 17
18# stubs 18# stubs
19# 19#
20SRCS+= misc_stub.c pmap_stub.c 20SRCS+= misc_stub.c pmap_stub.c
21 21
22# autogenerated 22# autogenerated
23# 23#
24SRCS+= rump_syscalls.c 24SRCS+= rump_syscalls.c
25 25
26# 26#
27# Rest are from the std kernel sources. 27# Rest are from the std kernel sources.
28# 28#
29# sys/kern 29# sys/kern
30SRCS+= kern_auth.c kern_descrip.c kern_ksyms.c kern_malloc_stdtype.c \ 30SRCS+= kern_auth.c kern_descrip.c kern_event.c kern_ksyms.c \
31 kern_module.c kern_rate.c kern_stub.c kern_sysctl.c \ 31 kern_malloc_stdtype.c kern_module.c kern_rate.c kern_stub.c \
32 kern_timeout.c kern_uidinfo.c param.c sys_descrip.c \ 32 kern_sysctl.c kern_timeout.c kern_uidinfo.c param.c \
33 sys_generic.c 33 sys_descrip.c sys_generic.c
34 34
35# sys/kern subr (misc) 35# sys/kern subr (misc)
36SRCS+= subr_devsw.c subr_callback.c subr_hash.c subr_iostat.c \ 36SRCS+= subr_devsw.c subr_callback.c subr_hash.c subr_iostat.c \
37 subr_kobj.c subr_log.c subr_once.c subr_prf.c \ 37 subr_kobj.c subr_log.c subr_once.c subr_prf.c \
38 subr_specificdata.c subr_time.c subr_workqueue.c 38 subr_specificdata.c subr_time.c subr_workqueue.c
39 39
40# the funny bit. this doesn't really belong here, but helps with the 40# the funny bit. this doesn't really belong here, but helps with the
41# needs of kern_descrip.c. And since it's a fully dynamic interface, 41# needs of kern_descrip.c. And since it's a fully dynamic interface,
42# it doesn't pull in other gunk. 42# it doesn't pull in other gunk.
43SRCS+= vnode_if.c 43SRCS+= vnode_if.c
44 44
45# sys/dev 45# sys/dev
46SRCS+= clock_subr.c 46SRCS+= clock_subr.c
47 47
48# Comment these if you want to use malloc(3) directly instead of 48# Comment these if you want to use malloc(3) directly instead of
49# the kernel allocators. It's a few percent faster, but doesn't 49# the kernel allocators. It's a few percent faster, but doesn't
50# emulate all kernel corner cases as well. 50# emulate all kernel corner cases as well.
51#CPPFLAGS+= -DRUMP_USE_REAL_ALLOCATORS 51#CPPFLAGS+= -DRUMP_USE_REAL_ALLOCATORS
52#SRCS+= subr_kmem.c subr_pool.c subr_vmem.c 52#SRCS+= subr_kmem.c subr_pool.c subr_vmem.c
53 53
54# no shlib_version because this is automatically in sync with lib/librump 54# no shlib_version because this is automatically in sync with lib/librump
55SHLIB_MAJOR= 0 55SHLIB_MAJOR= 0
56SHLIB_MINOR= 0 56SHLIB_MINOR= 0
57 57
58CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern 58CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern
59CPPFLAGS+= -I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpvfs 59CPPFLAGS+= -I${RUMPTOP}/librump/rumpnet -I${RUMPTOP}/librump/rumpvfs
60CFLAGS+= -Wno-pointer-sign 60CFLAGS+= -Wno-pointer-sign
61AFLAGS+= -D_LOCORE -Wa,-fatal-warnings 61AFLAGS+= -D_LOCORE -Wa,-fatal-warnings
62 62
63# 63#
64# If archdir exists, it is required to provide: 64# If archdir exists, it is required to provide:
65# 1) kobj_reloc() and kobj_machdep() 65# 1) kobj_reloc() and kobj_machdep()
66# 2) ...? 66# 2) ...?
67# 3) PROFIT! 67# 3) PROFIT!
68# 68#
69 69
70# 70#
71# Check if we are building compat. In compat mode we need to provide 71# Check if we are building compat. In compat mode we need to provide
72# the kernel of our compat target (amd64->i386 & sparc64->sparc), so 72# the kernel of our compat target (amd64->i386 & sparc64->sparc), so
73# take MD stuff from the right arch. 73# take MD stuff from the right arch.
74# 74#
75.ifdef LD32DIR 75.ifdef LD32DIR
76ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${LD32DIR} 76ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${LD32DIR}
77LIBKERN_ARCH= ${LD32DIR} 77LIBKERN_ARCH= ${LD32DIR}
78.else 78.else
79ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH} 79ARCHDIR= ${RUMPTOP}/librump/rumpkern/arch/${MACHINE_ARCH}
80.endif 80.endif
81.if exists(${ARCHDIR}) 81.if exists(${ARCHDIR})
82.include "${ARCHDIR}/Makefile.inc" 82.include "${ARCHDIR}/Makefile.inc"
83.PATH: ${ARCHDIR} 83.PATH: ${ARCHDIR}
84.else 84.else
85SRCS+= kobj_stubs.c 85SRCS+= kobj_stubs.c
86.endif 86.endif
87 87
88# include libkern source files 88# include libkern source files
89KERNDIR=${RUMPTOP}/../lib/libkern 89KERNDIR=${RUMPTOP}/../lib/libkern
90.include "${RUMPTOP}/../lib/libkern/Makefile.libkern" 90.include "${RUMPTOP}/../lib/libkern/Makefile.libkern"
91 91
92# Some architectures require a little special massage with atomic 92# Some architectures require a little special massage with atomic
93# compare-and-swap. This is because the kernel version is using 93# compare-and-swap. This is because the kernel version is using
94# instructions or routines unavailable to us in userspace. We 94# instructions or routines unavailable to us in userspace. We
95# use effectively the multiprocessor version of the userspace ops. 95# use effectively the multiprocessor version of the userspace ops.
96# 96#
97.if ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "hppa" \ 97.if ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "hppa" \
98 || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \ 98 || ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
99 || ${MACHINE_CPU} == "vax" 99 || ${MACHINE_CPU} == "vax"
100CPPFLAGS+= -I${RUMPTOP}/../../common/lib/libc/atomic 100CPPFLAGS+= -I${RUMPTOP}/../../common/lib/libc/atomic
101SRCS+= atomic_cas_generic.c 101SRCS+= atomic_cas_generic.c
102.endif 102.endif
103 103
104.include <bsd.lib.mk> 104.include <bsd.lib.mk>
105.include <bsd.klinks.mk> 105.include <bsd.klinks.mk>

cvs diff -r1.80 -r1.81 src/sys/rump/librump/rumpkern/emul.c (switch to unified diff)

--- src/sys/rump/librump/rumpkern/emul.c 2009/03/18 10:22:44 1.80
+++ src/sys/rump/librump/rumpkern/emul.c 2009/03/18 17:56:15 1.81
@@ -1,712 +1,742 @@ @@ -1,712 +1,742 @@
1/* $NetBSD: emul.c,v 1.80 2009/03/18 10:22:44 cegger Exp $ */ 1/* $NetBSD: emul.c,v 1.81 2009/03/18 17:56:15 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
15 * documentation and/or other materials provided with the distribution. 15 * documentation and/or other materials provided with the distribution.
16 * 16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
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.80 2009/03/18 10:22:44 cegger Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.81 2009/03/18 17:56:15 pooka Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/malloc.h> 34#include <sys/malloc.h>
35#include <sys/null.h> 35#include <sys/null.h>
36#include <sys/vnode.h> 36#include <sys/vnode.h>
37#include <sys/stat.h> 37#include <sys/stat.h>
38#include <sys/select.h> 38#include <sys/select.h>
39#include <sys/syslog.h> 39#include <sys/syslog.h>
40#include <sys/namei.h> 40#include <sys/namei.h>
41#include <sys/kauth.h> 41#include <sys/kauth.h>
42#include <sys/conf.h> 42#include <sys/conf.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/queue.h> 44#include <sys/queue.h>
45#include <sys/file.h> 45#include <sys/file.h>
46#include <sys/filedesc.h> 46#include <sys/filedesc.h>
47#include <sys/kthread.h> 47#include <sys/kthread.h>
48#include <sys/cpu.h> 48#include <sys/cpu.h>
49#include <sys/kmem.h> 49#include <sys/kmem.h>
50#include <sys/poll.h> 50#include <sys/poll.h>
51#include <sys/timetc.h> 51#include <sys/timetc.h>
52#include <sys/tprintf.h> 52#include <sys/tprintf.h>
53#include <sys/module.h> 53#include <sys/module.h>
54#include <sys/tty.h> 54#include <sys/tty.h>
55#include <sys/reboot.h> 55#include <sys/reboot.h>
56 56
57#include <dev/cons.h> 57#include <dev/cons.h>
58 58
59#include <machine/stdarg.h> 59#include <machine/stdarg.h>
60 60
61#include <rump/rumpuser.h> 61#include <rump/rumpuser.h>
62 62
63#include <uvm/uvm_map.h> 63#include <uvm/uvm_map.h>
64 64
65#include "rump_private.h" 65#include "rump_private.h"
66 66
67time_t time_second = 1; 67time_t time_second = 1;
68 68
69kmutex_t *proc_lock; 69kmutex_t *proc_lock;
70struct lwp lwp0; 70struct lwp lwp0;
71struct vnode *rootvp; 71struct vnode *rootvp;
72struct device *root_device; 72struct device *root_device;
73dev_t rootdev; 73dev_t rootdev;
74int physmem = 256*256; /* 256 * 1024*1024 / 4k, PAGE_SIZE not always set */ 74int physmem = 256*256; /* 256 * 1024*1024 / 4k, PAGE_SIZE not always set */
75int doing_shutdown; 75int doing_shutdown;
76int ncpu = 1; 76int ncpu = 1;
77const int schedppq = 1; 77const int schedppq = 1;
78int hardclock_ticks; 78int hardclock_ticks;
79bool mp_online = false; 79bool mp_online = false;
80struct vm_map *mb_map; 80struct vm_map *mb_map;
81struct timeval boottime; 81struct timeval boottime;
82struct emul emul_netbsd; 82struct emul emul_netbsd;
83int cold = 1; 83int cold = 1;
84int boothowto; 84int boothowto;
85struct tty *constty; 85struct tty *constty;
86 86
87char hostname[MAXHOSTNAMELEN]; 87char hostname[MAXHOSTNAMELEN];
88size_t hostnamelen; 88size_t hostnamelen;
89 89
90u_long bufmem_valimit; 90u_long bufmem_valimit;
91u_long bufmem_hiwater; 91u_long bufmem_hiwater;
92u_long bufmem_lowater; 92u_long bufmem_lowater;
93u_long bufmem; 93u_long bufmem;
94u_int nbuf; 94u_int nbuf;
95 95
96const char *panicstr; 96const char *panicstr;
97const char ostype[] = "NetBSD"; 97const char ostype[] = "NetBSD";
98const char osrelease[] = "999"; /* paradroid 4evah */ 98const char osrelease[] = "999"; /* paradroid 4evah */
99const char kernel_ident[] = "RUMP-ROAST"; 99const char kernel_ident[] = "RUMP-ROAST";
100const char *domainname; 100const char *domainname;
101int domainnamelen; 101int domainnamelen;
102 102
103const struct filterops seltrue_filtops; 103const struct filterops seltrue_filtops;
 104const struct filterops sig_filtops;
104 105
105#define DEVSW_SIZE 255 106#define DEVSW_SIZE 255
106const struct bdevsw *bdevsw0[DEVSW_SIZE]; /* XXX storage size */ 107const struct bdevsw *bdevsw0[DEVSW_SIZE]; /* XXX storage size */
107const struct bdevsw **bdevsw = bdevsw0; 108const struct bdevsw **bdevsw = bdevsw0;
108const int sys_cdevsws = DEVSW_SIZE; 109const int sys_cdevsws = DEVSW_SIZE;
109int max_cdevsws = DEVSW_SIZE; 110int max_cdevsws = DEVSW_SIZE;
110 111
111const struct cdevsw *cdevsw0[DEVSW_SIZE]; /* XXX storage size */ 112const struct cdevsw *cdevsw0[DEVSW_SIZE]; /* XXX storage size */
112const struct cdevsw **cdevsw = cdevsw0; 113const struct cdevsw **cdevsw = cdevsw0;
113const int sys_bdevsws = DEVSW_SIZE; 114const int sys_bdevsws = DEVSW_SIZE;
114int max_bdevsws = DEVSW_SIZE; 115int max_bdevsws = DEVSW_SIZE;
115 116
116struct devsw_conv devsw_conv0; 117struct devsw_conv devsw_conv0;
117struct devsw_conv *devsw_conv = &devsw_conv0; 118struct devsw_conv *devsw_conv = &devsw_conv0;
118int max_devsw_convs = 0; 119int max_devsw_convs = 0;
119int mem_no = 2; 120int mem_no = 2;
120 121
121kmutex_t tty_lock; 122kmutex_t tty_lock;
122 123
123int 124int
124copyin(const void *uaddr, void *kaddr, size_t len) 125copyin(const void *uaddr, void *kaddr, size_t len)
125{ 126{
126 127
127 memcpy(kaddr, uaddr, len); 128 memcpy(kaddr, uaddr, len);
128 return 0; 129 return 0;
129} 130}
130 131
131int 132int
132copyout(const void *kaddr, void *uaddr, size_t len) 133copyout(const void *kaddr, void *uaddr, size_t len)
133{ 134{
134 135
135 memcpy(uaddr, kaddr, len); 136 memcpy(uaddr, kaddr, len);
136 return 0; 137 return 0;
137} 138}
138 139
139int 140int
140copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done) 141copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done)
141{ 142{
142 143
143 return copyinstr(kfaddr, kdaddr, len, done); 144 return copyinstr(kfaddr, kdaddr, len, done);
144} 145}
145 146
146int 147int
147copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) 148copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done)
148{ 149{
149 150
150 strlcpy(kaddr, uaddr, len); 151 strlcpy(kaddr, uaddr, len);
151 if (done) 152 if (done)
152 *done = strlen(kaddr)+1; /* includes termination */ 153 *done = strlen(kaddr)+1; /* includes termination */
153 return 0; 154 return 0;
154} 155}
155 156
156int 157int
 158copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done)
 159{
 160
 161 strlcpy(uaddr, kaddr, len);
 162 if (done)
 163 *done = strlen(uaddr)+1; /* includes termination */
 164 return 0;
 165}
 166
 167int
157copyin_vmspace(struct vmspace *vm, const void *uaddr, void *kaddr, size_t len) 168copyin_vmspace(struct vmspace *vm, const void *uaddr, void *kaddr, size_t len)
158{ 169{
159 170
160 return copyin(uaddr, kaddr, len); 171 return copyin(uaddr, kaddr, len);
161} 172}
162 173
163int 174int
164copyout_vmspace(struct vmspace *vm, const void *kaddr, void *uaddr, size_t len) 175copyout_vmspace(struct vmspace *vm, const void *kaddr, void *uaddr, size_t len)
165{ 176{
166 177
167 return copyout(kaddr, uaddr, len); 178 return copyout(kaddr, uaddr, len);
168} 179}
169 180
170int 181int
171kcopy(const void *src, void *dst, size_t len) 182kcopy(const void *src, void *dst, size_t len)
172{ 183{
173 184
174 memcpy(dst, src, len); 185 memcpy(dst, src, len);
175 return 0; 186 return 0;
176} 187}
177 188
178int 189int
179uiomove(void *buf, size_t n, struct uio *uio) 190uiomove(void *buf, size_t n, struct uio *uio)
180{ 191{
181 struct iovec *iov; 192 struct iovec *iov;
182 uint8_t *b = buf; 193 uint8_t *b = buf;
183 size_t cnt; 194 size_t cnt;
184 195
185 if (uio->uio_vmspace != UIO_VMSPACE_SYS) 196 if (uio->uio_vmspace != UIO_VMSPACE_SYS)
186 panic("%s: vmspace != UIO_VMSPACE_SYS", __func__); 197 panic("%s: vmspace != UIO_VMSPACE_SYS", __func__);
187 198
188 while (n && uio->uio_resid) { 199 while (n && uio->uio_resid) {
189 iov = uio->uio_iov; 200 iov = uio->uio_iov;
190 cnt = iov->iov_len; 201 cnt = iov->iov_len;
191 if (cnt == 0) { 202 if (cnt == 0) {
192 uio->uio_iov++; 203 uio->uio_iov++;
193 uio->uio_iovcnt--; 204 uio->uio_iovcnt--;
194 continue; 205 continue;
195 } 206 }
196 if (cnt > n) 207 if (cnt > n)
197 cnt = n; 208 cnt = n;
198 209
199 if (uio->uio_rw == UIO_READ) 210 if (uio->uio_rw == UIO_READ)
200 memcpy(iov->iov_base, b, cnt); 211 memcpy(iov->iov_base, b, cnt);
201 else 212 else
202 memcpy(b, iov->iov_base, cnt); 213 memcpy(b, iov->iov_base, cnt);
203 214
204 iov->iov_base = (uint8_t *)iov->iov_base + cnt; 215 iov->iov_base = (uint8_t *)iov->iov_base + cnt;
205 iov->iov_len -= cnt; 216 iov->iov_len -= cnt;
206 b += cnt; 217 b += cnt;
207 uio->uio_resid -= cnt; 218 uio->uio_resid -= cnt;
208 uio->uio_offset += cnt; 219 uio->uio_offset += cnt;
209 n -= cnt; 220 n -= cnt;
210 } 221 }
211 222
212 return 0; 223 return 0;
213} 224}
214 225
215void 226void
216uio_setup_sysspace(struct uio *uio) 227uio_setup_sysspace(struct uio *uio)
217{ 228{
218 229
219 uio->uio_vmspace = UIO_VMSPACE_SYS; 230 uio->uio_vmspace = UIO_VMSPACE_SYS;
220} 231}
221 232
222devclass_t 233devclass_t
223device_class(device_t dev) 234device_class(device_t dev)
224{ 235{
225 236
226 if (dev != root_device) 237 if (dev != root_device)
227 panic("%s: dev != root_device not supported", __func__); 238 panic("%s: dev != root_device not supported", __func__);
228 239
229 return DV_DISK; 240 return DV_DISK;
230} 241}
231 242
232void 243void
233getmicrouptime(struct timeval *tvp) 244getmicrouptime(struct timeval *tvp)
234{ 245{
235 uint64_t sec, nsec; 246 uint64_t sec, nsec;
236 int error; 247 int error;
237 248
238 /* XXX: this is wrong, does not report *uptime* */ 249 /* XXX: this is wrong, does not report *uptime* */
239 rumpuser_gettime(&sec, &nsec, &error); 250 rumpuser_gettime(&sec, &nsec, &error);
240 tvp->tv_sec = sec; 251 tvp->tv_sec = sec;
241 tvp->tv_usec = nsec / 1000; 252 tvp->tv_usec = nsec / 1000;
242} 253}
243 254
244void 255void
245malloc_type_attach(struct malloc_type *type) 256malloc_type_attach(struct malloc_type *type)
246{ 257{
247 258
248 return; 259 return;
249} 260}
250 261
251void 262void
252malloc_type_detach(struct malloc_type *type) 263malloc_type_detach(struct malloc_type *type)
253{ 264{
254 265
255 return; 266 return;
256} 267}
257 268
258void * 269void *
259kern_malloc(unsigned long size, struct malloc_type *type, int flags) 270kern_malloc(unsigned long size, struct malloc_type *type, int flags)
260{ 271{
261 void *rv; 272 void *rv;
262 273
263 rv = rumpuser_malloc(size, (flags & (M_CANFAIL | M_NOWAIT)) != 0); 274 rv = rumpuser_malloc(size, (flags & (M_CANFAIL | M_NOWAIT)) != 0);
264 if (rv && flags & M_ZERO) 275 if (rv && flags & M_ZERO)
265 memset(rv, 0, size); 276 memset(rv, 0, size);
266 277
267 return rv; 278 return rv;
268} 279}
269 280
270void * 281void *
271kern_realloc(void *ptr, unsigned long size, struct malloc_type *type, int flags) 282kern_realloc(void *ptr, unsigned long size, struct malloc_type *type, int flags)
272{ 283{
273 284
274 return rumpuser_malloc(size, (flags & (M_CANFAIL | M_NOWAIT)) != 0); 285 return rumpuser_malloc(size, (flags & (M_CANFAIL | M_NOWAIT)) != 0);
275} 286}
276 287
277void 288void
278kern_free(void *ptr, struct malloc_type *type) 289kern_free(void *ptr, struct malloc_type *type)
279{ 290{
280 291
281 rumpuser_free(ptr); 292 rumpuser_free(ptr);
282} 293}
283 294
284static void 295static void
285gettime(struct timespec *ts) 296gettime(struct timespec *ts)
286{ 297{
287 uint64_t sec, nsec; 298 uint64_t sec, nsec;
288 int error; 299 int error;
289 300
290 rumpuser_gettime(&sec, &nsec, &error); 301 rumpuser_gettime(&sec, &nsec, &error);
291 ts->tv_sec = sec; 302 ts->tv_sec = sec;
292 ts->tv_nsec = nsec; 303 ts->tv_nsec = nsec;
293} 304}
294 305
295void 306void
296nanotime(struct timespec *ts) 307nanotime(struct timespec *ts)
297{ 308{
298 309
299 if (rump_threads) { 310 if (rump_threads) {
300 rump_gettime(ts); 311 rump_gettime(ts);
301 } else { 312 } else {
302 gettime(ts); 313 gettime(ts);
303 } 314 }
304} 315}
305 316
306/* hooray for mick, so what if I do */ 317/* hooray for mick, so what if I do */
307void 318void
308getnanotime(struct timespec *ts) 319getnanotime(struct timespec *ts)
309{ 320{
310 321
311 nanotime(ts); 322 nanotime(ts);
312} 323}
313 324
314void 325void
315microtime(struct timeval *tv) 326microtime(struct timeval *tv)
316{ 327{
317 struct timespec ts; 328 struct timespec ts;
318 329
319 if (rump_threads) { 330 if (rump_threads) {
320 rump_gettime(&ts); 331 rump_gettime(&ts);
321 TIMESPEC_TO_TIMEVAL(tv, &ts); 332 TIMESPEC_TO_TIMEVAL(tv, &ts);
322 } else { 333 } else {
323 gettime(&ts); 334 gettime(&ts);
324 TIMESPEC_TO_TIMEVAL(tv, &ts); 335 TIMESPEC_TO_TIMEVAL(tv, &ts);
325 } 336 }
326} 337}
327 338
328void 339void
329getmicrotime(struct timeval *tv) 340getmicrotime(struct timeval *tv)
330{ 341{
331 342
332 microtime(tv); 343 microtime(tv);
333} 344}
334 345
335struct kthdesc { 346struct kthdesc {
336 void (*f)(void *); 347 void (*f)(void *);
337 void *arg; 348 void *arg;
338 struct lwp *mylwp; 349 struct lwp *mylwp;
339}; 350};
340 351
341static void * 352static void *
342threadbouncer(void *arg) 353threadbouncer(void *arg)
343{ 354{
344 struct kthdesc *k = arg; 355 struct kthdesc *k = arg;
345 void (*f)(void *); 356 void (*f)(void *);
346 void *thrarg; 357 void *thrarg;
347 358
348 f = k->f; 359 f = k->f;
349 thrarg = k->arg; 360 thrarg = k->arg;
350 rumpuser_set_curlwp(k->mylwp); 361 rumpuser_set_curlwp(k->mylwp);
351 kmem_free(k, sizeof(struct kthdesc)); 362 kmem_free(k, sizeof(struct kthdesc));
352 363
353 if ((curlwp->l_pflag & LP_MPSAFE) == 0) 364 if ((curlwp->l_pflag & LP_MPSAFE) == 0)
354 KERNEL_LOCK(1, NULL); 365 KERNEL_LOCK(1, NULL);
355 f(thrarg); 366 f(thrarg);
356 panic("unreachable, should kthread_exit()"); 367 panic("unreachable, should kthread_exit()");
357} 368}
358 369
359int 370int
360kthread_create(pri_t pri, int flags, struct cpu_info *ci, 371kthread_create(pri_t pri, int flags, struct cpu_info *ci,
361 void (*func)(void *), void *arg, lwp_t **newlp, const char *fmt, ...) 372 void (*func)(void *), void *arg, lwp_t **newlp, const char *fmt, ...)
362{ 373{
363 char thrstore[MAXCOMLEN]; 374 char thrstore[MAXCOMLEN];
364 const char *thrname = NULL; 375 const char *thrname = NULL;
365 va_list ap; 376 va_list ap;
366 struct kthdesc *k; 377 struct kthdesc *k;
367 struct lwp *l; 378 struct lwp *l;
368 int rv; 379 int rv;
369 380
370 thrstore[0] = '\0'; 381 thrstore[0] = '\0';
371 if (fmt) { 382 if (fmt) {
372 va_start(ap, fmt); 383 va_start(ap, fmt);
373 vsnprintf(thrstore, sizeof(thrstore), fmt, ap); 384 vsnprintf(thrstore, sizeof(thrstore), fmt, ap);
374 va_end(ap); 385 va_end(ap);
375 thrname = thrstore; 386 thrname = thrstore;
376 } 387 }
377 388
378 /* 389 /*
379 * We don't want a module unload thread. 390 * We don't want a module unload thread.
380 * (XXX: yes, this is a kludge too, and the kernel should 391 * (XXX: yes, this is a kludge too, and the kernel should
381 * have a more flexible method for configuring which threads 392 * have a more flexible method for configuring which threads
382 * we want). 393 * we want).
383 */ 394 */
384 if (strcmp(thrstore, "modunload") == 0) { 395 if (strcmp(thrstore, "modunload") == 0) {
385 return 0; 396 return 0;
386 } 397 }
387 398
388 if (!rump_threads) { 399 if (!rump_threads) {
389 /* fake them */ 400 /* fake them */
390 if (strcmp(thrstore, "vrele") == 0) { 401 if (strcmp(thrstore, "vrele") == 0) {
391 printf("rump warning: threads not enabled, not starting" 402 printf("rump warning: threads not enabled, not starting"
392 " vrele thread\n"); 403 " vrele thread\n");
393 return 0; 404 return 0;
394 } else if (strcmp(thrstore, "cachegc") == 0) { 405 } else if (strcmp(thrstore, "cachegc") == 0) {
395 printf("rump warning: threads not enabled, not starting" 406 printf("rump warning: threads not enabled, not starting"
396 " namecache g/c thread\n"); 407 " namecache g/c thread\n");
397 return 0; 408 return 0;
398 } else if (strcmp(thrstore, "nfssilly") == 0) { 409 } else if (strcmp(thrstore, "nfssilly") == 0) {
399 printf("rump warning: threads not enabled, not enabling" 410 printf("rump warning: threads not enabled, not enabling"
400 " nfs silly rename\n"); 411 " nfs silly rename\n");
401 return 0; 412 return 0;
402 } else 413 } else
403 panic("threads not available, setenv RUMP_THREADS 1"); 414 panic("threads not available, setenv RUMP_THREADS 1");
404 } 415 }
405 416
406 KASSERT(fmt != NULL); 417 KASSERT(fmt != NULL);
407 if (ci != NULL) 418 if (ci != NULL)
408 panic("%s: bounded threads not supported", __func__); 419 panic("%s: bounded threads not supported", __func__);
409 420
410 k = kmem_alloc(sizeof(struct kthdesc), KM_SLEEP); 421 k = kmem_alloc(sizeof(struct kthdesc), KM_SLEEP);
411 k->f = func; 422 k->f = func;
412 k->arg = arg; 423 k->arg = arg;
413 k->mylwp = l = rump_setup_curlwp(0, rump_nextlid(), 0); 424 k->mylwp = l = rump_setup_curlwp(0, rump_nextlid(), 0);
414 if (flags & KTHREAD_MPSAFE) 425 if (flags & KTHREAD_MPSAFE)
415 l->l_pflag |= LP_MPSAFE; 426 l->l_pflag |= LP_MPSAFE;
416 rv = rumpuser_thread_create(threadbouncer, k, thrname); 427 rv = rumpuser_thread_create(threadbouncer, k, thrname);
417 if (rv) 428 if (rv)
418 return rv; 429 return rv;
419 430
420 if (newlp) 431 if (newlp)
421 *newlp = l; 432 *newlp = l;
422 return 0; 433 return 0;
423} 434}
424 435
425void 436void
426kthread_exit(int ecode) 437kthread_exit(int ecode)
427{ 438{
428 439
429 if ((curlwp->l_pflag & LP_MPSAFE) == 0) 440 if ((curlwp->l_pflag & LP_MPSAFE) == 0)
430 KERNEL_UNLOCK_ONE(NULL); 441 KERNEL_UNLOCK_ONE(NULL);
431 rump_clear_curlwp(); 442 rump_clear_curlwp();
432 rumpuser_thread_exit(); 443 rumpuser_thread_exit();
433} 444}
434 445
435struct proc * 446struct proc *
436p_find(pid_t pid, uint flags) 447p_find(pid_t pid, uint flags)
437{ 448{
438 449
439 panic("%s: not implemented", __func__); 450 panic("%s: not implemented", __func__);
440} 451}
441 452
442struct pgrp * 453struct pgrp *
443pg_find(pid_t pid, uint flags) 454pg_find(pid_t pid, uint flags)
444{ 455{
445 456
446 panic("%s: not implemented", __func__); 457 panic("%s: not implemented", __func__);
447} 458}
448 459
449void 460void
450psignal(struct proc *p, int signo) 461psignal(struct proc *p, int signo)
451{ 462{
452 463
453 switch (signo) { 464 switch (signo) {
454 case SIGSYS: 465 case SIGSYS:
455 break; 466 break;
456 default: 467 default:
457 panic("unhandled signal %d", signo); 468 panic("unhandled signal %d", signo);
458 } 469 }
459} 470}
460 471
461void 472void
462kpsignal(struct proc *p, ksiginfo_t *ksi, void *data) 473kpsignal(struct proc *p, ksiginfo_t *ksi, void *data)
463{ 474{
464 475
465 panic("%s: not implemented", __func__); 476 panic("%s: not implemented", __func__);
466} 477}
467 478
468void 479void
469kpgsignal(struct pgrp *pgrp, ksiginfo_t *ksi, void *data, int checkctty) 480kpgsignal(struct pgrp *pgrp, ksiginfo_t *ksi, void *data, int checkctty)
470{ 481{
471 482
472 panic("%s: not implemented", __func__); 483 panic("%s: not implemented", __func__);
473} 484}
474 485
475int 486int
476pgid_in_session(struct proc *p, pid_t pg_id) 487pgid_in_session(struct proc *p, pid_t pg_id)
477{ 488{
478 489
479 panic("%s: not implemented", __func__); 490 panic("%s: not implemented", __func__);
480} 491}
481 492
482int 493int
483sigispending(struct lwp *l, int signo) 494sigispending(struct lwp *l, int signo)
484{ 495{
485 496
486 return 0; 497 return 0;
487} 498}
488 499
489void 500void
490sigpending1(struct lwp *l, sigset_t *ss) 501sigpending1(struct lwp *l, sigset_t *ss)
491{ 502{
492 503
493 panic("%s: not implemented", __func__); 504 panic("%s: not implemented", __func__);
494} 505}
495 506
496void 
497knote_fdclose(int fd) 
498{ 
499 
500 /* since we don't add knotes, we don't have to remove them */ 
501} 
502 
503int 
504seltrue_kqfilter(dev_t dev, struct knote *kn) 
505{ 
506 
507 panic("%s: not implemented", __func__); 
508} 
509 
510int 507int
511kpause(const char *wmesg, bool intr, int timeo, kmutex_t *mtx) 508kpause(const char *wmesg, bool intr, int timeo, kmutex_t *mtx)
512{ 509{
513 extern int hz; 510 extern int hz;
514 int rv, error; 511 int rv, error;
515 uint64_t sec, nsec; 512 uint64_t sec, nsec;
516  513
517 if (mtx) 514 if (mtx)
518 mutex_exit(mtx); 515 mutex_exit(mtx);
519 516
520 sec = timeo / hz; 517 sec = timeo / hz;
521 nsec = (timeo % hz) * (1000000000 / hz); 518 nsec = (timeo % hz) * (1000000000 / hz);
522 rv = rumpuser_nanosleep(&sec, &nsec, &error); 519 rv = rumpuser_nanosleep(&sec, &nsec, &error);
523  520
524 if (mtx) 521 if (mtx)
525 mutex_enter(mtx); 522 mutex_enter(mtx);
526 523
527 if (rv) 524 if (rv)
528 return error; 525 return error;
529 526
530 return 0; 527 return 0;
531} 528}
532 529
533void 530void
534suspendsched(void) 531suspendsched(void)
535{ 532{
536 533
537 panic("%s: not implemented", __func__); 534 panic("%s: not implemented", __func__);
538} 535}
539 536
540u_int 537u_int
541lwp_unsleep(lwp_t *l, bool cleanup) 538lwp_unsleep(lwp_t *l, bool cleanup)
542{ 539{
543 540
544 KASSERT(mutex_owned(l->l_mutex)); 541 KASSERT(mutex_owned(l->l_mutex));
545 542
546 return (*l->l_syncobj->sobj_unsleep)(l, cleanup); 543 return (*l->l_syncobj->sobj_unsleep)(l, cleanup);
547} 544}
548 545
549vaddr_t 546vaddr_t
550calc_cache_size(struct vm_map *map, int pct, int va_pct) 547calc_cache_size(struct vm_map *map, int pct, int va_pct)
551{ 548{
552 paddr_t t; 549 paddr_t t;
553 550
554 t = (paddr_t)physmem * pct / 100 * PAGE_SIZE; 551 t = (paddr_t)physmem * pct / 100 * PAGE_SIZE;
555 if ((vaddr_t)t != t) { 552 if ((vaddr_t)t != t) {
556 panic("%s: needs tweak", __func__); 553 panic("%s: needs tweak", __func__);
557 } 554 }
558 return t; 555 return t;
559} 556}
560 557
561int 558int
562seltrue(dev_t dev, int events, struct lwp *l) 559seltrue(dev_t dev, int events, struct lwp *l)
563{ 560{
564 return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); 561 return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
565} 562}
566 563
567void 564void
568selrecord(lwp_t *selector, struct selinfo *sip) 565selrecord(lwp_t *selector, struct selinfo *sip)
569{ 566{
570} 567}
571 568
572void 569void
573selinit(struct selinfo *sip) 570selinit(struct selinfo *sip)
574{ 571{
575} 572}
576 573
577void 574void
578selnotify(struct selinfo *sip, int events, long knhint) 575selnotify(struct selinfo *sip, int events, long knhint)
579{ 576{
580} 577}
581 578
582void 579void
583seldestroy(struct selinfo *sip) 580seldestroy(struct selinfo *sip)
584{ 581{
585} 582}
586 583
587const char * 584const char *
588device_xname(device_t dv) 585device_xname(device_t dv)
589{ 586{
590 return "bogus0"; 587 return "bogus0";
591} 588}
592 589
593void 590void
594assert_sleepable(void) 591assert_sleepable(void)
595{ 592{
596 593
597 /* always sleepable, although we should improve this */ 594 /* always sleepable, although we should improve this */
598} 595}
599 596
600void 597void
601tc_setclock(const struct timespec *ts) 598tc_setclock(const struct timespec *ts)
602{ 599{
603 600
604 panic("%s: not implemented", __func__); 601 panic("%s: not implemented", __func__);
605} 602}
606 603
607void 604void
608proc_crmod_enter(void) 605proc_crmod_enter(void)
609{ 606{
610 607
611 panic("%s: not implemented", __func__); 608 panic("%s: not implemented", __func__);
612} 609}
613 610
614void 611void
615proc_crmod_leave(kauth_cred_t c1, kauth_cred_t c2, bool sugid) 612proc_crmod_leave(kauth_cred_t c1, kauth_cred_t c2, bool sugid)
616{ 613{
617 614
618 panic("%s: not implemented", __func__); 615 panic("%s: not implemented", __func__);
619} 616}
620 617
621void 618void
622module_init_md(void) 619module_init_md(void)
623{ 620{
624 621
625 /* 622 /*
626 * Nothing for now. However, we should load the librump 623 * Nothing for now. However, we should load the librump
627 * symbol table. 624 * symbol table.
628 */ 625 */
629} 626}
630 627
631/* us and them, after all we're only ordinary seconds */ 628/* us and them, after all we're only ordinary seconds */
632static void 629static void
633rump_delay(unsigned int us) 630rump_delay(unsigned int us)
634{ 631{
635 uint64_t sec, nsec; 632 uint64_t sec, nsec;
636 int error; 633 int error;
637 634
638 sec = us / 1000000; 635 sec = us / 1000000;
639 nsec = (us % 1000000) * 1000; 636 nsec = (us % 1000000) * 1000;
640 637
641 if (__predict_false(sec != 0)) 638 if (__predict_false(sec != 0))
642 printf("WARNING: over 1s delay\n"); 639 printf("WARNING: over 1s delay\n");
643 640
644 rumpuser_nanosleep(&sec, &nsec, &error); 641 rumpuser_nanosleep(&sec, &nsec, &error);
645} 642}
646void (*delay_func)(unsigned int) = rump_delay; 643void (*delay_func)(unsigned int) = rump_delay;
647 644
648void 645void
649kpreempt_disable(void) 646kpreempt_disable(void)
650{ 647{
651 648
652 /* XXX: see below */ 649 /* XXX: see below */
653 KPREEMPT_DISABLE(curlwp); 650 KPREEMPT_DISABLE(curlwp);
654} 651}
655 652
656void 653void
657kpreempt_enable(void) 654kpreempt_enable(void)
658{ 655{
659 656
660 /* try to make sure kpreempt_disable() is only used from panic() */ 657 /* try to make sure kpreempt_disable() is only used from panic() */
661 panic("kpreempt not supported"); 658 panic("kpreempt not supported");
662} 659}
663 660
664void 661void
665sessdelete(struct session *ss) 662sessdelete(struct session *ss)
666{ 663{
667 664
668 panic("sessdelete() impossible, session %p", ss); 665 panic("sessdelete() impossible, session %p", ss);
669} 666}
670 667
671int 668int
672ttycheckoutq(struct tty *tp, int wait) 669ttycheckoutq(struct tty *tp, int wait)
673{ 670{
674 671
675 return 1; 672 return 1;
676} 673}
677 674
678void 675void
679cnputc(int c) 676cnputc(int c)
680{ 677{
681 int error; 678 int error;
682 679
683 rumpuser_putchar(c, &error); 680 rumpuser_putchar(c, &error);
684} 681}
685 682
686void 683void
687cnflush(void) 684cnflush(void)
688{ 685{
689 686
690 /* done */ 687 /* done */
691} 688}
692 689
693int 690int
694tputchar(int c, int flags, struct tty *tp) 691tputchar(int c, int flags, struct tty *tp)
695{ 692{
696 693
697 cnputc(c); 694 cnputc(c);
698 return 0; 695 return 0;
699} 696}
700 697
701void 698void
702cpu_reboot(int howto, char *bootstr) 699cpu_reboot(int howto, char *bootstr)
703{ 700{
704 701
705 rumpuser_panic(); 702 rumpuser_panic();
706} 703}
707 704
708/* XXX: static, but not used except to make spcopy.S link */ 705/* XXX: static, but not used except to make spcopy.S link */
709#ifdef __hppa__ 706#ifdef __hppa__
710#undef curlwp 707#undef curlwp
711struct lwp *curlwp = &lwp0; 708struct lwp *curlwp = &lwp0;
712#endif 709#endif
 710
 711/*
 712 * XXX: from sys_select.c, see that file for license.
 713 * (these will go away really soon in favour of the real sys_select.c)
 714 * ((really, the select code just needs cleanup))
 715 * (((seriously)))
 716 */
 717int
 718inittimeleft(struct timeval *tv, struct timeval *sleeptv)
 719{
 720 if (itimerfix(tv))
 721 return -1;
 722 getmicrouptime(sleeptv);
 723 return 0;
 724}
 725
 726int
 727gettimeleft(struct timeval *tv, struct timeval *sleeptv)
 728{
 729 /*
 730 * We have to recalculate the timeout on every retry.
 731 */
 732 struct timeval slepttv;
 733 /*
 734 * reduce tv by elapsed time
 735 * based on monotonic time scale
 736 */
 737 getmicrouptime(&slepttv);
 738 timeradd(tv, sleeptv, tv);
 739 timersub(tv, &slepttv, tv);
 740 *sleeptv = slepttv;
 741 return tvtohz(tv);
 742}

cvs diff -r1.18 -r1.19 src/sys/rump/librump/rumpkern/Attic/misc_stub.c (switch to unified diff)

--- src/sys/rump/librump/rumpkern/Attic/misc_stub.c 2009/03/18 10:22:44 1.18
+++ src/sys/rump/librump/rumpkern/Attic/misc_stub.c 2009/03/18 17:56:15 1.19
@@ -1,124 +1,117 @@ @@ -1,124 +1,117 @@
1/* $NetBSD: misc_stub.c,v 1.18 2009/03/18 10:22:44 cegger Exp $ */ 1/* $NetBSD: misc_stub.c,v 1.19 2009/03/18 17:56:15 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
15 * documentation and/or other materials provided with the distribution. 15 * documentation and/or other materials provided with the distribution.
16 * 16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
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.18 2009/03/18 10:22:44 cegger Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: misc_stub.c,v 1.19 2009/03/18 17:56:15 pooka Exp $");
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/cpu.h> 34#include <sys/cpu.h>
35#include <sys/evcnt.h> 35#include <sys/evcnt.h>
36#include <sys/event.h> 36#include <sys/event.h>
37#include <sys/sched.h> 37#include <sys/sched.h>
38#include <sys/sysctl.h> 38#include <sys/sysctl.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/syscallvar.h> 40#include <sys/syscallvar.h>
41#include <sys/xcall.h> 41#include <sys/xcall.h>
42 42
43#ifdef __sparc__ 43#ifdef __sparc__
44 /*  44 /*
45 * XXX Least common denominator - smallest sparc pagesize. 45 * XXX Least common denominator - smallest sparc pagesize.
46 * Could just be declared, pooka says rump doesn't use ioctl. 46 * Could just be declared, pooka says rump doesn't use ioctl.
47 */ 47 */
48int nbpg = 4096; 48int nbpg = 4096;
49#endif 49#endif
50 50
51void 51void
52yield(void) 52yield(void)
53{ 53{
54 54
55 /* 55 /*
56 * Do nothing - doesn't really make sense as we're being 56 * Do nothing - doesn't really make sense as we're being
57 * scheduled anyway. 57 * scheduled anyway.
58 */ 58 */
59 return; 59 return;
60} 60}
61 61
62void 62void
63preempt(void) 63preempt(void)
64{ 64{
65 65
66 /* see yield */ 66 /* see yield */
67 return; 67 return;
68} 68}
69 69
70void 
71knote(struct klist *list, long hint) 
72{ 
73 
74 return; 
75} 
76 
77struct cpu_info * 70struct cpu_info *
78cpu_lookup(u_int index) 71cpu_lookup(u_int index)
79{ 72{
80 extern struct cpu_info rump_cpu; 73 extern struct cpu_info rump_cpu;
81 74
82 return &rump_cpu; 75 return &rump_cpu;
83} 76}
84 77
85void 78void
86evcnt_attach_dynamic(struct evcnt *ev, int type, const struct evcnt *parent, 79evcnt_attach_dynamic(struct evcnt *ev, int type, const struct evcnt *parent,
87 const char *group, const char *name) 80 const char *group, const char *name)
88{ 81{
89 82
90} 83}
91 84
92void 85void
93evcnt_detach(struct evcnt *ev) 86evcnt_detach(struct evcnt *ev)
94{ 87{
95 88
96} 89}
97 90
98int 91int
99syscall_establish(const struct emul *em, const struct syscall_package *sp) 92syscall_establish(const struct emul *em, const struct syscall_package *sp)
100{ 93{
101 94
102 return 0; 95 return 0;
103} 96}
104 97
105int 98int
106syscall_disestablish(const struct emul *em, const struct syscall_package *sp) 99syscall_disestablish(const struct emul *em, const struct syscall_package *sp)
107{ 100{
108 101
109 return 0; 102 return 0;
110} 103}
111 104
112/* crosscalls not done, no other hardware CPUs */ 105/* crosscalls not done, no other hardware CPUs */
113uint64_t 106uint64_t
114xc_broadcast(u_int flags, xcfunc_t func, void *arg1, void *arg2) 107xc_broadcast(u_int flags, xcfunc_t func, void *arg1, void *arg2)
115{ 108{
116 109
117 return -1; 110 return -1;
118} 111}
119 112
120void 113void
121xc_wait(uint64_t where) 114xc_wait(uint64_t where)
122{ 115{
123 116
124} 117}