From 38365ca3598e5aaed6bf3e56a7c172449947f3aa Mon Sep 17 00:00:00 2001 From: jmcneill Date: Sat, 29 Dec 2007 14:38:30 +0000 Subject: [PATCH] Import work-in-progress NetBSD/usermode port. --- sys/arch/usermode/compile/Makefile | 3 + sys/arch/usermode/conf/GENERIC | 51 +++ sys/arch/usermode/conf/Makefile.usermode | 69 ++++ sys/arch/usermode/conf/files.usermode | 41 +++ sys/arch/usermode/conf/majors.usermode | 12 + sys/arch/usermode/conf/std.usermode | 11 + sys/arch/usermode/dev/clock.c | 103 ++++++ sys/arch/usermode/dev/cpu.c | 353 +++++++++++++++++++ sys/arch/usermode/dev/mainbus.c | 92 +++++ sys/arch/usermode/dev/ttycons.c | 118 +++++++ sys/arch/usermode/include/ansi.h | 40 +++ sys/arch/usermode/include/aout_machdep.h | 41 +++ sys/arch/usermode/include/asm.h | 40 +++ sys/arch/usermode/include/bswap.h | 40 +++ sys/arch/usermode/include/byte_swap.h | 40 +++ sys/arch/usermode/include/cdefs.h | 38 ++ sys/arch/usermode/include/cpu.h | 97 +++++ sys/arch/usermode/include/db_machdep.h | 38 ++ sys/arch/usermode/include/disklabel.h | 40 +++ sys/arch/usermode/include/elf_machdep.h | 40 +++ sys/arch/usermode/include/endian.h | 40 +++ sys/arch/usermode/include/endian_machdep.h | 40 +++ sys/arch/usermode/include/int_const.h | 40 +++ sys/arch/usermode/include/int_fmtio.h | 40 +++ sys/arch/usermode/include/int_limits.h | 40 +++ sys/arch/usermode/include/int_mwgwtypes.h | 40 +++ sys/arch/usermode/include/int_types.h | 40 +++ sys/arch/usermode/include/intr.h | 81 +++++ sys/arch/usermode/include/intrdefs.h | 48 +++ sys/arch/usermode/include/limits.h | 40 +++ sys/arch/usermode/include/lock.h | 71 ++++ sys/arch/usermode/include/mainbus.h | 45 +++ sys/arch/usermode/include/mcontext.h | 44 +++ sys/arch/usermode/include/mutex.h | 82 +++++ sys/arch/usermode/include/netbsd32_machdep.h | 40 +++ sys/arch/usermode/include/param.h | 40 +++ sys/arch/usermode/include/pcb.h | 51 +++ sys/arch/usermode/include/pmap.h | 45 +++ sys/arch/usermode/include/proc.h | 44 +++ sys/arch/usermode/include/ptrace.h | 40 +++ sys/arch/usermode/include/reg.h | 44 +++ sys/arch/usermode/include/rwlock.h | 68 ++++ sys/arch/usermode/include/signal.h | 38 ++ sys/arch/usermode/include/stdarg.h | 40 +++ sys/arch/usermode/include/types.h | 70 ++++ sys/arch/usermode/include/vmparam.h | 43 +++ sys/arch/usermode/include/wchar_limits.h | 40 +++ sys/arch/usermode/usermode/copy.c | 114 ++++++ sys/arch/usermode/usermode/genassym.cf | 39 ++ sys/arch/usermode/usermode/machdep.c | 107 ++++++ sys/arch/usermode/usermode/mem.c | 58 +++ sys/arch/usermode/usermode/pmap.c | 272 ++++++++++++++ sys/arch/usermode/usermode/process_machdep.c | 76 ++++ sys/arch/usermode/usermode/sys_machdep.c | 48 +++ sys/arch/usermode/usermode/syscall.c | 53 +++ sys/arch/usermode/usermode/trap.c | 46 +++ sys/arch/usermode/usermode/vm_machdep.c | 52 +++ 57 files changed, 3466 insertions(+) create mode 100644 sys/arch/usermode/compile/Makefile create mode 100644 sys/arch/usermode/conf/GENERIC create mode 100644 sys/arch/usermode/conf/Makefile.usermode create mode 100644 sys/arch/usermode/conf/files.usermode create mode 100644 sys/arch/usermode/conf/majors.usermode create mode 100644 sys/arch/usermode/conf/std.usermode create mode 100644 sys/arch/usermode/dev/clock.c create mode 100644 sys/arch/usermode/dev/cpu.c create mode 100644 sys/arch/usermode/dev/mainbus.c create mode 100644 sys/arch/usermode/dev/ttycons.c create mode 100644 sys/arch/usermode/include/ansi.h create mode 100644 sys/arch/usermode/include/aout_machdep.h create mode 100644 sys/arch/usermode/include/asm.h create mode 100644 sys/arch/usermode/include/bswap.h create mode 100644 sys/arch/usermode/include/byte_swap.h create mode 100644 sys/arch/usermode/include/cdefs.h create mode 100644 sys/arch/usermode/include/cpu.h create mode 100644 sys/arch/usermode/include/db_machdep.h create mode 100644 sys/arch/usermode/include/disklabel.h create mode 100644 sys/arch/usermode/include/elf_machdep.h create mode 100644 sys/arch/usermode/include/endian.h create mode 100644 sys/arch/usermode/include/endian_machdep.h create mode 100644 sys/arch/usermode/include/int_const.h create mode 100644 sys/arch/usermode/include/int_fmtio.h create mode 100644 sys/arch/usermode/include/int_limits.h create mode 100644 sys/arch/usermode/include/int_mwgwtypes.h create mode 100644 sys/arch/usermode/include/int_types.h create mode 100644 sys/arch/usermode/include/intr.h create mode 100644 sys/arch/usermode/include/intrdefs.h create mode 100644 sys/arch/usermode/include/limits.h create mode 100644 sys/arch/usermode/include/lock.h create mode 100644 sys/arch/usermode/include/mainbus.h create mode 100644 sys/arch/usermode/include/mcontext.h create mode 100644 sys/arch/usermode/include/mutex.h create mode 100644 sys/arch/usermode/include/netbsd32_machdep.h create mode 100644 sys/arch/usermode/include/param.h create mode 100644 sys/arch/usermode/include/pcb.h create mode 100644 sys/arch/usermode/include/pmap.h create mode 100644 sys/arch/usermode/include/proc.h create mode 100644 sys/arch/usermode/include/ptrace.h create mode 100644 sys/arch/usermode/include/reg.h create mode 100644 sys/arch/usermode/include/rwlock.h create mode 100644 sys/arch/usermode/include/signal.h create mode 100644 sys/arch/usermode/include/stdarg.h create mode 100644 sys/arch/usermode/include/types.h create mode 100644 sys/arch/usermode/include/vmparam.h create mode 100644 sys/arch/usermode/include/wchar_limits.h create mode 100644 sys/arch/usermode/usermode/copy.c create mode 100644 sys/arch/usermode/usermode/genassym.cf create mode 100644 sys/arch/usermode/usermode/machdep.c create mode 100644 sys/arch/usermode/usermode/mem.c create mode 100644 sys/arch/usermode/usermode/pmap.c create mode 100644 sys/arch/usermode/usermode/process_machdep.c create mode 100644 sys/arch/usermode/usermode/sys_machdep.c create mode 100644 sys/arch/usermode/usermode/syscall.c create mode 100644 sys/arch/usermode/usermode/trap.c create mode 100644 sys/arch/usermode/usermode/vm_machdep.c diff --git a/sys/arch/usermode/compile/Makefile b/sys/arch/usermode/compile/Makefile new file mode 100644 index 000000000000..3fcd426e1770 --- /dev/null +++ b/sys/arch/usermode/compile/Makefile @@ -0,0 +1,3 @@ +# $NetBSD: Makefile,v 1.1 2007/12/29 14:38:30 jmcneill Exp $ + +.include diff --git a/sys/arch/usermode/conf/GENERIC b/sys/arch/usermode/conf/GENERIC new file mode 100644 index 000000000000..603c4e69e2cc --- /dev/null +++ b/sys/arch/usermode/conf/GENERIC @@ -0,0 +1,51 @@ +# $NetBSD: GENERIC,v 1.1 2007/12/29 14:38:30 jmcneill Exp $ + +include "arch/usermode/conf/std.usermode" + +#options INCLUDE_CONFIG_FILE +#ident "GENERIC-$Revision: 1.1 $" +maxusers 32 +makeoptions DEBUG="-g3" +makeoptions COPTS="-O2 -fno-omit-frame-pointer" + +#options MEMSIZE=65536 # amount of memory to allocate (in KB) +options MEMSIZE=131072 + +options RTC_OFFSET=0 +options KTRACE +options USERCONF + +#options DEBUG +#options DIAGNOSTIC +#options LOCKDEBUG + +options NKMEMPAGES=256 + +#options DDB +#options DDB_HISTORY_SIZE=512 + +options COMPAT_BSDPTY + +file-system FFS +file-system FDESC +file-system KERNFS +file-system TMPFS + +options INET +options NFS_BOOT_DHCP +options NFS_BOOT_BOOTPARAM + +config netbsd root on ? type ? + +mainbus0 at root +cpu0 at mainbus? +clock0 at mainbus? +ttycons0 at mainbus? + +pseudo-device loop +pseudo-device md 1 + +options MEMORY_DISK_HOOKS +options MEMORY_DISK_IS_ROOT +options MEMORY_DISK_SERVER=0 +options MEMORY_DISK_ROOT_SIZE=10000 diff --git a/sys/arch/usermode/conf/Makefile.usermode b/sys/arch/usermode/conf/Makefile.usermode new file mode 100644 index 000000000000..6b13d24b63e5 --- /dev/null +++ b/sys/arch/usermode/conf/Makefile.usermode @@ -0,0 +1,69 @@ +# $NetBSD: Makefile.usermode,v 1.1 2007/12/29 14:38:30 jmcneill Exp $ + +MACHINE_ARCH= usermode +USETOOLS?= no +NEED_OWN_INSTALL_TARGET?= no +.include + +SYSTEM_LD= ${CC} -o netbsd ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o + +## +## (1) port identification +## +USERMODE= $S/arch/usermode +GENASSYM_CONF= ${USERMODE}/usermode/genassym.cf + +## +## (2) compile settings +## +DEFCOPTS= -O2 +CPPFLAGS+= -Dusermode -Dmalloc=kernmalloc +AFLAGS+= -x assembler-with-cpp -traditional-cpp + +## +## (3) libkern and compat +## +KERN_AS= obj + +## +## (4) local objects, compile rules, and dependencies +## +MD_OBJS= +MD_CFILES= +MD_SFILES= + +## +## (5) link settings +## + +## +## (6) port specific target dependencies +## + +## +## (7) misc settings +## + +## +## (8) config(8) generated machinery +%INCLUDES + +%OBJS + +%CFILES + +%SFILES + +%LOAD + +%RULES + +## +## (9) port independent kernel machinery +## +.include "$S/conf/Makefile.kern.inc" + +## +## (10) appending make options +## +%MAKEOPTIONSAPPEND diff --git a/sys/arch/usermode/conf/files.usermode b/sys/arch/usermode/conf/files.usermode new file mode 100644 index 000000000000..e250e1a5936f --- /dev/null +++ b/sys/arch/usermode/conf/files.usermode @@ -0,0 +1,41 @@ +# $NetBSD: files.usermode,v 1.1 2007/12/29 14:38:30 jmcneill Exp $ + +maxpartitions 8 +maxusers 8 16 64 + +defparam opt_memsize.h MEMSIZE + +define thunkbus { } + +device mainbus: thunkbus +attach mainbus at root +file arch/usermode/dev/mainbus.c mainbus + +device cpu { } +attach cpu at thunkbus +file arch/usermode/dev/cpu.c cpu + +device clock { } +attach clock at thunkbus +file arch/usermode/dev/clock.c clock + +device ttycons { } : tty +attach ttycons at thunkbus +file arch/usermode/dev/ttycons.c ttycons + +file netinet/in_cksum.c inet +file netinet/in4_cksum.c inet + +file arch/usermode/usermode/copy.c +file arch/usermode/usermode/machdep.c +file arch/usermode/usermode/mem.c +file arch/usermode/usermode/pmap.c +file arch/usermode/usermode/process_machdep.c +file arch/usermode/usermode/sys_machdep.c +file arch/usermode/usermode/syscall.c +file arch/usermode/usermode/trap.c +file arch/usermode/usermode/vm_machdep.c +file dev/cons.c +file dev/md_root.c memory_disk_hooks + +include "arch/usermode/conf/majors.usermode" diff --git a/sys/arch/usermode/conf/majors.usermode b/sys/arch/usermode/conf/majors.usermode new file mode 100644 index 000000000000..83d35c119e88 --- /dev/null +++ b/sys/arch/usermode/conf/majors.usermode @@ -0,0 +1,12 @@ +# $NetBSD: majors.usermode,v 1.1 2007/12/29 14:38:30 jmcneill Exp $ + +device-major cons char 0 +device-major ctty char 1 +device-major mem char 2 +#device-major wd char 3 +device-major swap char 4 block 1 vmswap +device-major pts char 5 pty +device-major ptc char 6 pty +device-major log char 7 +device-major com char 8 com +device-major md char 24 block 17 md diff --git a/sys/arch/usermode/conf/std.usermode b/sys/arch/usermode/conf/std.usermode new file mode 100644 index 000000000000..cdbe51317d06 --- /dev/null +++ b/sys/arch/usermode/conf/std.usermode @@ -0,0 +1,11 @@ +# $NetBSD: std.usermode,v 1.1 2007/12/29 14:38:30 jmcneill Exp $ + +machine usermode +include "conf/std" + +options HZ=100 +options EXEC_ELF32 +options EXEC_ELF64 +options EXEC_SCRIPT + +defflag opt_xen.h DO_NOT_DEFINE diff --git a/sys/arch/usermode/dev/clock.c b/sys/arch/usermode/dev/clock.c new file mode 100644 index 000000000000..227ce0eb5029 --- /dev/null +++ b/sys/arch/usermode/dev/clock.c @@ -0,0 +1,103 @@ +/* $NetBSD: clock.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $"); + +#include +#include +#include +#include +#include + +#include + +static int clock_match(device_t, cfdata_t, void *); +static void clock_attach(device_t, device_t, void *); + +static void clock_intr(int); + +typedef struct clock_softc { + device_t sc_dev; +} clock_softc_t; + +extern int setitimer(int, const struct itimerval *, struct itimerval *); + +CFATTACH_DECL_NEW(clock, sizeof(clock_softc_t), + clock_match, clock_attach, NULL, NULL); + +static int +clock_match(device_t parent, cfdata_t match, void *opaque) +{ + struct thunkbus_attach_args *taa = opaque; + + if (taa->taa_type != THUNKBUS_TYPE_CLOCK) + return 0; + + return 1; +} + +static void +clock_attach(device_t parent, device_t self, void *opaque) +{ + clock_softc_t *sc = device_private(self); + struct itimerval itimer; + + aprint_naive("\n"); + aprint_normal("\n"); + + sc->sc_dev = self; + + (void)signal(SIGALRM, clock_intr); + + itimer.it_interval.tv_sec = 0; + itimer.it_interval.tv_usec = 10000; + itimer.it_value = itimer.it_interval; + (void)setitimer(ITIMER_REAL, &itimer, NULL); +} + +static void +clock_intr(int notused) +{ + extern int usermode_x; + struct clockframe cf; + +#if notyet + /* XXXJDM */ + if (usermode_x > IPL_SOFTCLOCK) + return; +#endif + + hardclock(&cf); +} diff --git a/sys/arch/usermode/dev/cpu.c b/sys/arch/usermode/dev/cpu.c new file mode 100644 index 000000000000..4aceced57384 --- /dev/null +++ b/sys/arch/usermode/dev/cpu.c @@ -0,0 +1,353 @@ +/* $NetBSD: cpu.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + +/* #define CPU_DEBUG */ + +static int cpu_match(device_t, cfdata_t, void *); +static void cpu_attach(device_t, device_t, void *); + +struct cpu_info cpu_info_primary; +char cpu_model[48] = "virtual processor"; + +typedef struct cpu_softc { + device_t sc_dev; + struct cpu_info *sc_ci; +} cpu_softc_t; + +CFATTACH_DECL_NEW(cpu, sizeof(cpu_softc_t), cpu_match, cpu_attach, NULL, NULL); + +static int +cpu_match(device_t parent, cfdata_t match, void *opaque) +{ + struct thunkbus_attach_args *taa = opaque; + + if (taa->taa_type != THUNKBUS_TYPE_CPU) + return 0; + + return 1; +} + +static void +cpu_attach(device_t parent, device_t self, void *opaque) +{ + cpu_softc_t *sc = device_private(self); + + aprint_naive("\n"); + aprint_normal("\n"); + + sc->sc_dev = self; + sc->sc_ci = &cpu_info_primary; + sc->sc_ci->ci_dev = 0; + sc->sc_ci->ci_self = &cpu_info_primary; +#if notyet + sc->sc_ci->ci_curlwp = &lwp0; +#endif +} + +void +cpu_configure(void) +{ + if (config_rootfound("mainbus", NULL) == NULL) + panic("configure: mainbus not configured"); + + spl0(); +} + +void +cpu_reboot(int howto, char *bootstr) +{ + extern void exit(int); + extern void abort(void); + + splhigh(); + + if ((howto & RB_POWERDOWN) == RB_POWERDOWN) + exit(0); + + if (howto & RB_HALT) { + printf("\n"); + printf("The operating system has halted.\n"); + printf("Please press any key to reboot.\n\n"); + cnpollc(1); + cngetc(); + cnpollc(0); + } + + printf("rebooting...\n"); + + /* + * XXXJDM If we've panic'd, make sure we dump a core + */ + abort(); + + /* NOTREACHED */ +} + +void +cpu_need_resched(struct cpu_info *ci, int flags) +{ + ci->ci_want_resched = 1; +} + +void +cpu_need_proftick(struct lwp *l) +{ +} + +lwp_t * +cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning) +{ + extern int errno; + struct pcb *oldpcb = (struct pcb *)(oldlwp ? oldlwp->l_addr : NULL); + struct pcb *newpcb = (struct pcb *)newlwp->l_addr; + struct cpu_info *ci = curcpu(); + +#ifdef CPU_DEBUG + printf("cpu_switchto [%s] -> [%s]\n", + oldlwp ? oldlwp->l_name : "none", + newlwp ? newlwp->l_name : "none"); + if (oldpcb) { + printf(" oldpcb uc_link=%p, uc_stack.ss_sp=%p, " + "uc_stack.ss_size=%d\n", + oldpcb->pcb_ucp.uc_link, + oldpcb->pcb_ucp.uc_stack.ss_sp, + (int)oldpcb->pcb_ucp.uc_stack.ss_size); + } + if (newpcb) { + printf(" newpcb uc_link=%p, uc_stack.ss_sp=%p, " + "uc_stack.ss_size=%d\n", + newpcb->pcb_ucp.uc_link, + newpcb->pcb_ucp.uc_stack.ss_sp, + (int)newpcb->pcb_ucp.uc_stack.ss_size); + } +#endif /* !CPU_DEBUG */ + + ci->ci_stash = oldlwp; + curlwp = newlwp; + if (oldpcb) { + if (swapcontext(&oldpcb->pcb_ucp, &newpcb->pcb_ucp)) + panic("swapcontext failed: %d", errno); + } else { + if (setcontext(&newpcb->pcb_ucp)) + panic("setcontext failed: %d", errno); + } + +#ifdef CPU_DEBUG + printf("cpu_switchto: returning %p (was %p)\n", ci->ci_stash, oldlwp); +#endif + return ci->ci_stash; +} + +void +cpu_dumpconf(void) +{ +#ifdef CPU_DEBUG + printf("cpu_dumpconf\n"); +#endif +} + +void +cpu_signotify(struct lwp *l) +{ +#ifdef CPU_DEBUG + printf("cpu_signotify\n"); +#endif +} + +void +cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags) +{ +#ifdef CPU_DEBUG + printf("cpu_getmcontext\n"); +#endif +} + +int +cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags) +{ +#ifdef CPU_DEBUG + printf("cpu_setmcontext\n"); +#endif + return 0; +} + +void +cpu_idle(void) +{ + extern int usleep(useconds_t); + struct cpu_info *ci = curcpu(); + + if (ci->ci_want_resched) + return; + +#if notyet + usleep(10000); +#endif +} + +void +cpu_lwp_free(struct lwp *l, int proc) +{ +#ifdef CPU_DEBUG + printf("cpu_lwp_free\n"); +#endif +} + +void +cpu_lwp_free2(struct lwp *l) +{ + struct pcb *pcb = (struct pcb *)l->l_addr; + +#ifdef CPU_DEBUG + printf("cpu_lwp_free2\n"); +#endif + + if (pcb == NULL) + return; + + if (pcb->pcb_needfree) { + free(pcb->pcb_ucp.uc_stack.ss_sp, M_TEMP); + pcb->pcb_ucp.uc_stack.ss_sp = NULL; + pcb->pcb_ucp.uc_stack.ss_size = 0; + pcb->pcb_needfree = false; + } +} + +static void +cpu_lwp_trampoline(void (*func)(void *), void *arg) +{ + lwp_startup(curcpu()->ci_stash, curlwp); + + func(arg); +} + +void +cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, + void (*func)(void *), void *arg) +{ + extern int errno; + struct pcb *pcb = (struct pcb *)l2->l_addr; + +#ifdef CPU_DEBUG + printf("cpu_lwp_fork [%s/%p] -> [%s/%p] stack=%p stacksize=%d\n", + l1 ? l1->l_name : "none", l1, + l2 ? l2->l_name : "none", l2, + stack, (int)stacksize); +#endif + + /* XXXJDM */ + if (stack == NULL) { + stack = malloc(PAGE_SIZE, M_TEMP, M_NOWAIT); + stacksize = PAGE_SIZE; + pcb->pcb_needfree = true; + } else + pcb->pcb_needfree = false; + + if (getcontext(&pcb->pcb_ucp)) + panic("getcontext failed: %d", errno); + pcb->pcb_ucp.uc_stack.ss_sp = stack; + pcb->pcb_ucp.uc_stack.ss_size = stacksize; + pcb->pcb_ucp.uc_link = NULL; + pcb->pcb_ucp.uc_flags = _UC_STACK | _UC_CPU; + makecontext(&pcb->pcb_ucp, (void (*)(void))cpu_lwp_trampoline, + 2, func, arg); +} + +void +cpu_initclocks(void) +{ +} + +void +cpu_startup(void) +{ + extern int physmem; + extern struct vm_map *mb_map; + vaddr_t minaddr, maxaddr; + char pbuf[9]; + + printf("%s%s", copyright, version); + format_bytes(pbuf, sizeof(pbuf), ptoa(physmem)); + printf("total memory = %s\n", pbuf); + + minaddr = 0; + mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, + nmbclusters * mclbytes, VM_MAP_INTRSAFE, false, NULL); + + format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free)); + printf("avail memory = %s\n", pbuf); +} + +void +cpu_rootconf(void) +{ + device_t curdev, rdev = NULL; + + TAILQ_FOREACH(curdev, &alldevs, dv_list) + if (strcmp(device_xname(curdev), "md0") == 0) { + rdev = curdev; + break; + } + + setroot(rdev, 0); +} + +bool +cpu_intr_p(void) +{ + printf("cpu_intr_p\n"); + return false; +} diff --git a/sys/arch/usermode/dev/mainbus.c b/sys/arch/usermode/dev/mainbus.c new file mode 100644 index 000000000000..3ec910d92fb6 --- /dev/null +++ b/sys/arch/usermode/dev/mainbus.c @@ -0,0 +1,92 @@ +/* $NetBSD: mainbus.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $"); + +#include +#include +#include +#include +#include + +#include + +#include + +static int mainbus_match(device_t, cfdata_t, void *); +static void mainbus_attach(device_t, device_t, void *); + +static int mainbus_print(void *, const char *); + +typedef struct mainbus_softc { + device_t sc_dev; +} mainbus_softc_t; + +CFATTACH_DECL_NEW(mainbus, sizeof(mainbus_softc_t), + mainbus_match, mainbus_attach, NULL, NULL); + +static int +mainbus_match(device_t parent, cfdata_t match, void *opaque) +{ + + return 1; +} + +static void +mainbus_attach(device_t parent, device_t self, void *opaque) +{ + mainbus_softc_t *sc = device_private(self); + struct thunkbus_attach_args taa; + + aprint_naive("\n"); + aprint_normal("\n"); + + sc->sc_dev = self; + + taa.taa_type = THUNKBUS_TYPE_CPU; + config_found_ia(self, "thunkbus", &taa, mainbus_print); + taa.taa_type = THUNKBUS_TYPE_CLOCK; + config_found_ia(self, "thunkbus", &taa, mainbus_print); + taa.taa_type = THUNKBUS_TYPE_TTYCONS; + config_found_ia(self, "thunkbus", &taa, mainbus_print); +} + +static int +mainbus_print(void *opaque, const char *pnp) +{ + if (pnp) + aprint_normal("%s", pnp); + return UNCONF; +} diff --git a/sys/arch/usermode/dev/ttycons.c b/sys/arch/usermode/dev/ttycons.c new file mode 100644 index 000000000000..6d17be0cccea --- /dev/null +++ b/sys/arch/usermode/dev/ttycons.c @@ -0,0 +1,118 @@ +/* $NetBSD: ttycons.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: ttycons.c,v 1.1 2007/12/29 14:38:31 jmcneill Exp $"); + +#include +#include +#include +#include +#include + +#include + +#include + +static int ttycons_match(device_t, cfdata_t, void *); +static void ttycons_attach(device_t, device_t, void *); + +void ttycons_consinit(void); + +typedef struct ttycons_softc { + device_t sc_dev; +} ttycons_softc_t; + +dev_type_cngetc(ttycons_cngetc); +dev_type_cnputc(ttycons_cnputc); +dev_type_cnpollc(ttycons_cnpollc); + +static struct cnm_state ttycons_cnm_state; +struct consdev ttycons_consdev = { + .cn_getc = ttycons_cngetc, + .cn_putc = ttycons_cnputc, + .cn_pollc = ttycons_cnpollc, +}; + +CFATTACH_DECL_NEW(ttycons, sizeof(ttycons_softc_t), + ttycons_match, ttycons_attach, NULL, NULL); + +static int +ttycons_match(device_t parent, cfdata_t match, void *opaque) +{ + struct thunkbus_attach_args *taa = opaque; + + if (taa->taa_type != THUNKBUS_TYPE_TTYCONS) + return 0; + + return 1; +} + +static void +ttycons_attach(device_t parent, device_t self, void *opaque) +{ + ttycons_softc_t *sc = device_private(self); + + aprint_naive("\n"); + aprint_normal(": console\n"); + + sc->sc_dev = self; +} + +void +ttycons_consinit(void) +{ + cn_tab = &ttycons_consdev; + cn_init_magic(&ttycons_cnm_state); + cn_set_magic("\047\001"); +} + +int +ttycons_cngetc(dev_t dev) +{ + extern int getchar(void); + return getchar(); +} + +void +ttycons_cnputc(dev_t dev, int c) +{ + extern void putchar(int); + putchar(c); +} + +void +ttycons_cnpollc(dev_t dev, int on) +{ +} diff --git a/sys/arch/usermode/include/ansi.h b/sys/arch/usermode/include/ansi.h new file mode 100644 index 000000000000..31518fb5d47d --- /dev/null +++ b/sys/arch/usermode/include/ansi.h @@ -0,0 +1,40 @@ +/* $NetBSD: ansi.h,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_ANSI_H +#define _ARCH_USERMODE_INCLUDE_ANSI_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_ANSI_H */ diff --git a/sys/arch/usermode/include/aout_machdep.h b/sys/arch/usermode/include/aout_machdep.h new file mode 100644 index 000000000000..5d270ae98fd4 --- /dev/null +++ b/sys/arch/usermode/include/aout_machdep.h @@ -0,0 +1,41 @@ +/* $NetBSD: aout_machdep.h,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_AOUT_MACHDEP_H +#define _ARCH_USERMODE_INCLUDE_AOUT_MACHDEP_H + +/* Ugh, why is this needed? */ +#define AOUT_LDPGSZ 4096 + +#endif /* !_ARCH_USERMODE_INCLUDE_AOUT_MACHDEP_H */ diff --git a/sys/arch/usermode/include/asm.h b/sys/arch/usermode/include/asm.h new file mode 100644 index 000000000000..d46483997497 --- /dev/null +++ b/sys/arch/usermode/include/asm.h @@ -0,0 +1,40 @@ +/* $NetBSD: asm.h,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_ASM_H +#define _ARCH_USERMODE_INCLUDE_ASM_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_ASM_H */ diff --git a/sys/arch/usermode/include/bswap.h b/sys/arch/usermode/include/bswap.h new file mode 100644 index 000000000000..c0775a93e5ca --- /dev/null +++ b/sys/arch/usermode/include/bswap.h @@ -0,0 +1,40 @@ +/* $NetBSD: bswap.h,v 1.1 2007/12/29 14:38:31 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_BSWAP_H +#define _ARCH_USERMODE_INCLUDE_BSWAP_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_BSWAP_H */ diff --git a/sys/arch/usermode/include/byte_swap.h b/sys/arch/usermode/include/byte_swap.h new file mode 100644 index 000000000000..a91aae9ba9c6 --- /dev/null +++ b/sys/arch/usermode/include/byte_swap.h @@ -0,0 +1,40 @@ +/* $NetBSD: byte_swap.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_BYTE_SWAP_H +#define _ARCH_USERMODE_INCLUDE_BYTE_SWAP_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_BYTE_SWAP_H */ diff --git a/sys/arch/usermode/include/cdefs.h b/sys/arch/usermode/include/cdefs.h new file mode 100644 index 000000000000..8dd1ccfab466 --- /dev/null +++ b/sys/arch/usermode/include/cdefs.h @@ -0,0 +1,38 @@ +/* $NetBSD: cdefs.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_CDEFS_H +#define _ARCH_USERMODE_INCLUDE_CDEFS_H + +#endif /* !_ARCH_USERMODE_INCLUDE_CDEFS_H */ diff --git a/sys/arch/usermode/include/cpu.h b/sys/arch/usermode/include/cpu.h new file mode 100644 index 000000000000..ac351fbd77c5 --- /dev/null +++ b/sys/arch/usermode/include/cpu.h @@ -0,0 +1,97 @@ +/* $NetBSD: cpu.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_CPU_H +#define _ARCH_USERMODE_INCLUDE_CPU_H + +#include +#include + +#include + +extern void cpu_signotify(struct lwp *); +extern void cpu_need_proftick(struct lwp *); + +struct cpu_info { + device_t ci_dev; + struct cpu_info *ci_self; + struct cpu_info *ci_next; + struct cpu_data ci_data; + u_int ci_cpuid; + int ci_want_resched; + volatile int ci_mtx_count; + volatile int ci_mtx_oldspl; +#if notyet + lwp_t *ci_curlwp; +#endif + lwp_t *ci_stash; +}; + +__inline static struct cpu_info * __attribute__((__unused__)) +usermode_curcpu(void) +{ + extern struct cpu_info cpu_info_primary; + + return &cpu_info_primary; +} + +__inline static void +usermode_delay(unsigned int ms) +{ + extern int usleep(useconds_t); + + usleep(ms); +} + +#define curcpu() usermode_curcpu() +#define cpu_number() 0 + +#define cpu_proc_fork(p1, p2) + +#define delay(ms) usermode_delay(ms) +#define DELAY(ms) usermode_delay(ms) + +/* XXXJDM */ +struct clockframe { + uint8_t cf_dummy; +}; + +#define CLKF_USERMODE(frame) 0 +#define CLKF_PC(frame) 0 +#define CLKF_INTR(frame) 0 + +#define cpu_swapin(l) +#define cpu_swapout(l) + +#endif /* !_ARCH_USERMODE_INCLUDE_CPU_H */ diff --git a/sys/arch/usermode/include/db_machdep.h b/sys/arch/usermode/include/db_machdep.h new file mode 100644 index 000000000000..f673a791362b --- /dev/null +++ b/sys/arch/usermode/include/db_machdep.h @@ -0,0 +1,38 @@ +/* $NetBSD: db_machdep.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_DB_MACHDEP_H +#define _ARCH_USERMODE_INCLUDE_DB_MACHDEP_H + +#endif /* !_ARCH_USERMODE_INCLUDE_DB_MACHDEP_H */ diff --git a/sys/arch/usermode/include/disklabel.h b/sys/arch/usermode/include/disklabel.h new file mode 100644 index 000000000000..5986595c68f5 --- /dev/null +++ b/sys/arch/usermode/include/disklabel.h @@ -0,0 +1,40 @@ +/* $NetBSD: disklabel.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_DISKLABEL_H +#define _ARCH_USERMODE_INCLUDE_DISKLABEL_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_DISKLABEL_H */ diff --git a/sys/arch/usermode/include/elf_machdep.h b/sys/arch/usermode/include/elf_machdep.h new file mode 100644 index 000000000000..8032d29d63c8 --- /dev/null +++ b/sys/arch/usermode/include/elf_machdep.h @@ -0,0 +1,40 @@ +/* $NetBSD: elf_machdep.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_ELF_MACHDEP_H +#define _ARCH_USERMODE_INCLUDE_ELF_MACHDEP_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_ELF_MACHDEP_H */ diff --git a/sys/arch/usermode/include/endian.h b/sys/arch/usermode/include/endian.h new file mode 100644 index 000000000000..08a656d52d7c --- /dev/null +++ b/sys/arch/usermode/include/endian.h @@ -0,0 +1,40 @@ +/* $NetBSD: endian.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_ENDIAN_H +#define _ARCH_USERMODE_INCLUDE_ENDIAN_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_ENDIAN_H */ diff --git a/sys/arch/usermode/include/endian_machdep.h b/sys/arch/usermode/include/endian_machdep.h new file mode 100644 index 000000000000..f3e8c6dceffc --- /dev/null +++ b/sys/arch/usermode/include/endian_machdep.h @@ -0,0 +1,40 @@ +/* $NetBSD: endian_machdep.h,v 1.1 2007/12/29 14:38:32 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_ENDIAN_MACHDEP_H +#define _ARCH_USERMODE_INCLUDE_ENDIAN_MACHDEP_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_ENDIAN_MACHDEP_H */ diff --git a/sys/arch/usermode/include/int_const.h b/sys/arch/usermode/include/int_const.h new file mode 100644 index 000000000000..730c36c939c9 --- /dev/null +++ b/sys/arch/usermode/include/int_const.h @@ -0,0 +1,40 @@ +/* $NetBSD: int_const.h,v 1.1 2007/12/29 14:38:33 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_INT_CONST_H +#define _ARCH_USERMODE_INCLUDE_INT_CONST_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_INT_CONST_H */ diff --git a/sys/arch/usermode/include/int_fmtio.h b/sys/arch/usermode/include/int_fmtio.h new file mode 100644 index 000000000000..4c3889d7efec --- /dev/null +++ b/sys/arch/usermode/include/int_fmtio.h @@ -0,0 +1,40 @@ +/* $NetBSD: int_fmtio.h,v 1.1 2007/12/29 14:38:33 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_INT_FMTIO_H +#define _ARCH_USERMODE_INCLUDE_INT_FMTIO_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_INT_FMTIO_H */ diff --git a/sys/arch/usermode/include/int_limits.h b/sys/arch/usermode/include/int_limits.h new file mode 100644 index 000000000000..bcdc6137c816 --- /dev/null +++ b/sys/arch/usermode/include/int_limits.h @@ -0,0 +1,40 @@ +/* $NetBSD: int_limits.h,v 1.1 2007/12/29 14:38:33 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_INT_LIMITS_H +#define _ARCH_USERMODE_INCLUDE_INT_LIMITS_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_INT_LIMITS_H */ diff --git a/sys/arch/usermode/include/int_mwgwtypes.h b/sys/arch/usermode/include/int_mwgwtypes.h new file mode 100644 index 000000000000..93768e194739 --- /dev/null +++ b/sys/arch/usermode/include/int_mwgwtypes.h @@ -0,0 +1,40 @@ +/* $NetBSD: int_mwgwtypes.h,v 1.1 2007/12/29 14:38:33 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_INT_MWGWTYPES_H +#define _ARCH_USERMODE_INCLUDE_INT_MWGWTYPES_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_INT_MWGWTYPES_H */ diff --git a/sys/arch/usermode/include/int_types.h b/sys/arch/usermode/include/int_types.h new file mode 100644 index 000000000000..1a02cf405289 --- /dev/null +++ b/sys/arch/usermode/include/int_types.h @@ -0,0 +1,40 @@ +/* $NetBSD: int_types.h,v 1.1 2007/12/29 14:38:33 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_INT_TYPES_H +#define _ARCH_USERMODE_INCLUDE_INT_TYPES_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_INT_TYPES_H */ diff --git a/sys/arch/usermode/include/intr.h b/sys/arch/usermode/include/intr.h new file mode 100644 index 000000000000..1ed78d6e31dc --- /dev/null +++ b/sys/arch/usermode/include/intr.h @@ -0,0 +1,81 @@ +/* $NetBSD: intr.h,v 1.1 2007/12/29 14:38:33 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_INTR_H +#define _ARCH_USERMODE_INCLUDE_INTR_H + +#include + +__inline static int +splraise(int x) +{ + extern int usermode_x; + int oldx = usermode_x; + + usermode_x = x; + + return oldx; +} + +__inline static void +spllower(int x) +{ + extern int usermode_x; + + usermode_x = x; +} + +#define spl0() spllower(IPL_NONE) +#define splx(x) spllower(x) + +typedef uint8_t ipl_t; +typedef struct { + ipl_t _ipl; +} ipl_cookie_t; + +static inline ipl_cookie_t +makeiplcookie(ipl_t ipl) +{ + return (ipl_cookie_t){._ipl = ipl}; +} + +static inline int +splraiseipl(ipl_cookie_t icookie) +{ + return splraise(icookie._ipl); +} + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_INTR_H */ diff --git a/sys/arch/usermode/include/intrdefs.h b/sys/arch/usermode/include/intrdefs.h new file mode 100644 index 000000000000..66f709e5ccf3 --- /dev/null +++ b/sys/arch/usermode/include/intrdefs.h @@ -0,0 +1,48 @@ +/* $NetBSD: intrdefs.h,v 1.1 2007/12/29 14:38:33 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_INTRDEFS_H +#define _ARCH_USERMODE_INCLUDE_INTRDEFS_H + +#define IPL_NONE 0 +#define IPL_SOFTCLOCK 1 +#define IPL_SOFTBIO 2 +#define IPL_SOFTNET 3 +#define IPL_SOFTSERIAL 4 +#define IPL_VM 5 +#define IPL_SCHED 6 +#define IPL_HIGH 7 +#define NIPL 8 + +#endif /* !_ARCH_USERMODE_INCLUDE_INTRDEFS_H */ diff --git a/sys/arch/usermode/include/limits.h b/sys/arch/usermode/include/limits.h new file mode 100644 index 000000000000..9f1d3f4076e5 --- /dev/null +++ b/sys/arch/usermode/include/limits.h @@ -0,0 +1,40 @@ +/* $NetBSD: limits.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_LIMITS_H +#define _ARCH_USERMODE_INCLUDE_LIMITS_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_LIMITS_H */ diff --git a/sys/arch/usermode/include/lock.h b/sys/arch/usermode/include/lock.h new file mode 100644 index 000000000000..86f1d4d64fbf --- /dev/null +++ b/sys/arch/usermode/include/lock.h @@ -0,0 +1,71 @@ +/* $NetBSD: lock.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_LOCK_H +#define _ARCH_USERMODE_INCLUDE_LOCK_H + +__inline static void +__cpu_simple_lock_init(__cpu_simple_lock_t *lockp) +{ +} + +__inline static void +__cpu_simple_lock(__cpu_simple_lock_t *lockp) +{ +} + +__inline static void +__cpu_simple_unlock(__cpu_simple_lock_t *lockp) +{ +} + +__inline static int +__SIMPLELOCK_LOCKED_P(__cpu_simple_lock_t *lockp) +{ + return *lockp == __SIMPLELOCK_LOCKED; +} + +__inline static int +__SIMPLELOCK_UNLOCKED_P(__cpu_simple_lock_t *lockp) +{ + return *lockp == __SIMPLELOCK_UNLOCKED; +} + +__inline static int +__cpu_simple_lock_try(__cpu_simple_lock_t *lockp) +{ + return __SIMPLELOCK_UNLOCKED; +} + +#endif /* !_ARCH_USERMODE_INCLUDE_LOCK_H */ diff --git a/sys/arch/usermode/include/mainbus.h b/sys/arch/usermode/include/mainbus.h new file mode 100644 index 000000000000..a32263567855 --- /dev/null +++ b/sys/arch/usermode/include/mainbus.h @@ -0,0 +1,45 @@ +/* $NetBSD: mainbus.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_MAINBUS_H +#define _ARCH_USERMODE_INCLUDE_MAINBUS_H + +struct thunkbus_attach_args { + int taa_type; +#define THUNKBUS_TYPE_CPU 0 +#define THUNKBUS_TYPE_CLOCK 1 +#define THUNKBUS_TYPE_TTYCONS 2 +}; + +#endif /* !_ARCH_USERMODE_INCLUDE_MAINBUS_H */ diff --git a/sys/arch/usermode/include/mcontext.h b/sys/arch/usermode/include/mcontext.h new file mode 100644 index 000000000000..7dfc69c7d669 --- /dev/null +++ b/sys/arch/usermode/include/mcontext.h @@ -0,0 +1,44 @@ +/* $NetBSD: mcontext.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_MCONTEXT_H +#define _ARCH_USERMODE_INCLUDE_MCONTEXT_H + +typedef struct { +} mcontext_t; + +typedef struct { +} mcontext32_t; + +#endif /* !_ARCH_USERMODE_INCLUDE_MCONTEXT_H */ diff --git a/sys/arch/usermode/include/mutex.h b/sys/arch/usermode/include/mutex.h new file mode 100644 index 000000000000..aa65c012a872 --- /dev/null +++ b/sys/arch/usermode/include/mutex.h @@ -0,0 +1,82 @@ +/* $NetBSD: mutex.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe and Andrew Doran. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _X86_MUTEX_H_ +#define _X86_MUTEX_H_ + +struct kmutex { + union { + volatile uintptr_t mtxa_owner; +#ifdef __MUTEX_PRIVATE + struct { + volatile uint8_t mtxs_dummy; + ipl_cookie_t mtxs_ipl; + __cpu_simple_lock_t mtxs_lock; + volatile uint8_t mtxs_unused; + } s; +#endif + } u; +}; + +#ifdef __MUTEX_PRIVATE + +#define mtx_owner u.mtxa_owner +#define mtx_ipl u.s.mtxs_ipl +#define mtx_lock u.s.mtxs_lock + +#define __HAVE_SIMPLE_MUTEXES 1 + +/* + * MUTEX_RECEIVE: no memory barrier required, as 'ret' implies a load fence. + */ +#define MUTEX_RECEIVE(mtx) /* nothing */ + +/* + * MUTEX_GIVE: no memory barrier required, as _lock_cas() will take care of it. + */ +#define MUTEX_GIVE(mtx) /* nothing */ + +#define MUTEX_CAS(p, o, n) \ + (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) + +unsigned long _atomic_cas_ulong(volatile unsigned long *, + unsigned long, unsigned long); + +#endif /* __MUTEX_PRIVATE */ + +#endif /* _X86_MUTEX_H_ */ diff --git a/sys/arch/usermode/include/netbsd32_machdep.h b/sys/arch/usermode/include/netbsd32_machdep.h new file mode 100644 index 000000000000..73fa356d280d --- /dev/null +++ b/sys/arch/usermode/include/netbsd32_machdep.h @@ -0,0 +1,40 @@ +/* $NetBSD: netbsd32_machdep.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_NETBSD32_MACHDEP_H +#define _ARCH_USERMODE_INCLUDE_NETBSD32_MACHDEP_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_NETBSD32_MACHDEP_H */ diff --git a/sys/arch/usermode/include/param.h b/sys/arch/usermode/include/param.h new file mode 100644 index 000000000000..24d9cbf70f61 --- /dev/null +++ b/sys/arch/usermode/include/param.h @@ -0,0 +1,40 @@ +/* $NetBSD: param.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_PARAM_H +#define _ARCH_USERMODE_INCLUDE_PARAM_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_PARAM_H */ diff --git a/sys/arch/usermode/include/pcb.h b/sys/arch/usermode/include/pcb.h new file mode 100644 index 000000000000..833a70992c82 --- /dev/null +++ b/sys/arch/usermode/include/pcb.h @@ -0,0 +1,51 @@ +/* $NetBSD: pcb.h,v 1.1 2007/12/29 14:38:34 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_PCB_H +#define _ARCH_USERMODE_INCLUDE_PCB_H + +#include +#include + +extern int getcontext(ucontext_t *); +extern int setcontext(const ucontext_t *); +extern void makecontext(ucontext_t *, void (*)(void), int, ...); +extern int swapcontext(ucontext_t *, const ucontext_t *); + +struct pcb { + ucontext_t pcb_ucp; + bool pcb_needfree; +}; + +#endif /* !_ARCH_USERMODE_INCLUDE_PCB_H */ diff --git a/sys/arch/usermode/include/pmap.h b/sys/arch/usermode/include/pmap.h new file mode 100644 index 000000000000..74b99d5ab341 --- /dev/null +++ b/sys/arch/usermode/include/pmap.h @@ -0,0 +1,45 @@ +/* $NetBSD: pmap.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_PMAP_H +#define _ARCH_USERMODE_INCLUDE_PMAP_H + +#define PMAP_GROWKERNEL 1 +#define PMAP_MAP_POOLPAGE(x) (x) +#define PMAP_UNMAP_POOLPAGE(x) (x) + +typedef struct pmap { +} *pmap_t; + +#endif /* !_ARCH_USERMODE_INCLUDE_PMAP_H */ diff --git a/sys/arch/usermode/include/proc.h b/sys/arch/usermode/include/proc.h new file mode 100644 index 000000000000..a951768f4ab6 --- /dev/null +++ b/sys/arch/usermode/include/proc.h @@ -0,0 +1,44 @@ +/* $NetBSD: proc.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_PROC_H +#define _ARCH_USERMODE_INCLUDE_PROC_H + +struct mdlwp { +}; + +struct mdproc { +}; + +#endif /* !_ARCH_USERMODE_INCLUDE_PROC_H */ diff --git a/sys/arch/usermode/include/ptrace.h b/sys/arch/usermode/include/ptrace.h new file mode 100644 index 000000000000..26904d417fd6 --- /dev/null +++ b/sys/arch/usermode/include/ptrace.h @@ -0,0 +1,40 @@ +/* $NetBSD: ptrace.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_PTRACE_H +#define _ARCH_USERMODE_INCLUDE_PTRACE_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_PTRACE_H */ diff --git a/sys/arch/usermode/include/reg.h b/sys/arch/usermode/include/reg.h new file mode 100644 index 000000000000..3db93a2a1e97 --- /dev/null +++ b/sys/arch/usermode/include/reg.h @@ -0,0 +1,44 @@ +/* $NetBSD: reg.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_REG_H +#define _ARCH_USERMODE_INCLUDE_REG_H + +struct reg { +}; + +struct fpreg { +}; + +#endif /* !_ARCH_USERMODE_INCLUDE_REG_H */ diff --git a/sys/arch/usermode/include/rwlock.h b/sys/arch/usermode/include/rwlock.h new file mode 100644 index 000000000000..4e7b65d62063 --- /dev/null +++ b/sys/arch/usermode/include/rwlock.h @@ -0,0 +1,68 @@ +/* $NetBSD: rwlock.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe and Andrew Doran. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _X86_RWLOCK_H_ +#define _X86_RWLOCK_H_ + +struct krwlock { + volatile uintptr_t rw_owner; +}; + +#ifdef __RWLOCK_PRIVATE + +#define __HAVE_SIMPLE_RW_LOCKS 1 + +/* + * RW_RECEIVE: no memory barrier required, as 'ret' implies a load fence. + */ +#define RW_RECEIVE(rw) /* nothing */ + +/* + * RW_GIVE: no memory barrier required, as _lock_cas() will take care of it. + */ +#define RW_GIVE(rw) /* nothing */ + +#define RW_CAS(p, o, n) \ + (_atomic_cas_ulong((volatile unsigned long *)(p), (o), (n)) == (o)) + +unsigned long _atomic_cas_ulong(volatile unsigned long *, + unsigned long, unsigned long); + +#endif /* __RWLOCK_PRIVATE */ + +#endif /* _X86_RWLOCK_H_ */ diff --git a/sys/arch/usermode/include/signal.h b/sys/arch/usermode/include/signal.h new file mode 100644 index 000000000000..d1e94c674a5a --- /dev/null +++ b/sys/arch/usermode/include/signal.h @@ -0,0 +1,38 @@ +/* $NetBSD: signal.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_SIGNAL_H +#define _ARCH_USERMODE_INCLUDE_SIGNAL_H + +#endif /* !_ARCH_USERMODE_INCLUDE_SIGNAL_H */ diff --git a/sys/arch/usermode/include/stdarg.h b/sys/arch/usermode/include/stdarg.h new file mode 100644 index 000000000000..48e3723d1561 --- /dev/null +++ b/sys/arch/usermode/include/stdarg.h @@ -0,0 +1,40 @@ +/* $NetBSD: stdarg.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_STDARG_H +#define _ARCH_USERMODE_INCLUDE_STDARG_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_STDARG_H */ diff --git a/sys/arch/usermode/include/types.h b/sys/arch/usermode/include/types.h new file mode 100644 index 000000000000..687a8ee894aa --- /dev/null +++ b/sys/arch/usermode/include/types.h @@ -0,0 +1,70 @@ +/* $NetBSD: types.h,v 1.1 2007/12/29 14:38:35 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_TYPES_H +#define _ARCH_USERMODE_INCLUDE_TYPES_H + +#include +#include +#include + +#define __HAVE_GENERIC_TODR 1 + +#if defined(_KERNEL) +typedef struct label_t { + long val[8]; +} label_t; +#endif + +#ifdef _LP64 +typedef unsigned long paddr_t; +typedef unsigned long psize_t; +typedef unsigned long vaddr_t; +typedef unsigned long vsize_t; +typedef long int register_t; +#else +typedef unsigned int paddr_t; +typedef unsigned int psize_t; +typedef unsigned int vaddr_t; +typedef unsigned int vsize_t; +typedef int register_t; +#endif + +typedef volatile unsigned char __cpu_simple_lock_t; +#define __CPU_SIMPLE_LOCK_PAD + +#define __SIMPLELOCK_LOCKED 1 +#define __SIMPLELOCK_UNLOCKED 0 + +#endif /* !_ARCH_USERMODE_INCLUDE_TYPES_H */ diff --git a/sys/arch/usermode/include/vmparam.h b/sys/arch/usermode/include/vmparam.h new file mode 100644 index 000000000000..39a7549bc046 --- /dev/null +++ b/sys/arch/usermode/include/vmparam.h @@ -0,0 +1,43 @@ +/* $NetBSD: vmparam.h,v 1.1 2007/12/29 14:38:36 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_VMPARAM_H +#define _ARCH_USERMODE_INCLUDE_VMPARAM_H + +#include + +#undef VM_MIN_KERNEL_ADDRESS +#define VM_MIN_KERNEL_ADDRESS 0 + +#endif /* !_ARCH_USERMODE_INCLUDE_VMPARAM_H */ diff --git a/sys/arch/usermode/include/wchar_limits.h b/sys/arch/usermode/include/wchar_limits.h new file mode 100644 index 000000000000..014730ba17ab --- /dev/null +++ b/sys/arch/usermode/include/wchar_limits.h @@ -0,0 +1,40 @@ +/* $NetBSD: wchar_limits.h,v 1.1 2007/12/29 14:38:36 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ARCH_USERMODE_INCLUDE_WCHAR_LIMITS_H +#define _ARCH_USERMODE_INCLUDE_WCHAR_LIMITS_H + +#include + +#endif /* !_ARCH_USERMODE_INCLUDE_WCHAR_LIMITS_H */ diff --git a/sys/arch/usermode/usermode/copy.c b/sys/arch/usermode/usermode/copy.c new file mode 100644 index 000000000000..b783ca8909ba --- /dev/null +++ b/sys/arch/usermode/usermode/copy.c @@ -0,0 +1,114 @@ +/* $NetBSD: copy.c,v 1.1 2007/12/29 14:38:36 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: copy.c,v 1.1 2007/12/29 14:38:36 jmcneill Exp $"); + +#include +#include + +int +copyin(const void *uaddr, void *kaddr, size_t len) +{ + memcpy(kaddr, uaddr, len); + return 0; +} + +int +copyout(const void *kaddr, void *uaddr, size_t len) +{ + memcpy(uaddr, kaddr, len); + return 0; +} + +int +copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) +{ + strncpy(kaddr, uaddr, len); + if (done) + *done = min(strlen(uaddr), len); + return 0; +} + +int +copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done) +{ + strncpy(uaddr, kaddr, len); + if (done) + *done = min(strlen(kaddr), len); + return 0; +} + +int +copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done) +{ + strncpy(kdaddr, kfaddr, len); + if (done) + *done = min(strlen(kfaddr), len); + return 0; +} + +int +kcopy(const void *src, void *dst, size_t len) +{ + memcpy(dst, src, len); + return 0; +} + +int +fuswintr(const void *base) +{ + return *(const short *)base; +} + +int +suswintr(void *base, short c) +{ + *(short *)base = c; + return 0; +} + +int +subyte(void *base, int c) +{ + *(char *)base = c; + return 0; +} + +int +suword(void *base, long c) +{ + *(long *)base = c; + return 0; +} diff --git a/sys/arch/usermode/usermode/genassym.cf b/sys/arch/usermode/usermode/genassym.cf new file mode 100644 index 000000000000..824c1a57fd8f --- /dev/null +++ b/sys/arch/usermode/usermode/genassym.cf @@ -0,0 +1,39 @@ +# $NetBSD: genassym.cf,v 1.1 2007/12/29 14:38:36 jmcneill Exp $ + +# +# Copyright (c) 2007 Jared D. McNeill +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Jared D. McNeill. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +quote #define __MUTEX_PRIVATE +quote #define __RWLOCK_PRIVATE + +include +include diff --git a/sys/arch/usermode/usermode/machdep.c b/sys/arch/usermode/usermode/machdep.c new file mode 100644 index 000000000000..26081698abac --- /dev/null +++ b/sys/arch/usermode/usermode/machdep.c @@ -0,0 +1,107 @@ +/* $NetBSD: machdep.c,v 1.1 2007/12/29 14:38:36 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2007/12/29 14:38:36 jmcneill Exp $"); + +#include +#include +#include +#include +#include + +#include +#include + +#include "opt_memsize.h" + +char machine[] = "usermode"; +char machine_arch[] = "usermode"; + +paddr_t proc0paddr = 0; +int usermode_x = IPL_NONE; +/* XXX */ +int physmem = MEMSIZE * 1024 / PAGE_SIZE; +struct vm_map *mb_map = NULL; +struct vm_map *exec_map = NULL; + +void start(void); + +void +start(void) +{ + extern void pmap_bootstrap(void); + + printf("NetBSD/usermode startup\n"); + + uvm_setpagesize(); + uvmexp.ncolors = 2; + + pmap_bootstrap(); +} + +void +microtime(struct timeval *tv) +{ +#if notyet + extern void __libc_gettimeofday(struct timeval *); + __libc_gettimeofday(tv); +#endif +} + +void +setstatclockrate(int arg) +{ +} + +void +consinit(void) +{ + extern void ttycons_consinit(void); + + ttycons_consinit(); + + /* XXX we start in main, not start */ + start(); +} + +void +setregs(struct lwp *l, struct exec_package *pack, u_long stack) +{ +} + +void +sendsig(const ksiginfo_t *ksi, const sigset_t *mask) +{ +} diff --git a/sys/arch/usermode/usermode/mem.c b/sys/arch/usermode/usermode/mem.c new file mode 100644 index 000000000000..9046532b977b --- /dev/null +++ b/sys/arch/usermode/usermode/mem.c @@ -0,0 +1,58 @@ +/* $NetBSD: mem.c,v 1.1 2007/12/29 14:38:36 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.1 2007/12/29 14:38:36 jmcneill Exp $"); + +#include +#include +#include +#include +#include +#include +#include + +dev_type_read(memrw); +dev_type_ioctl(mmioctl); + +const struct cdevsw mem_cdevsw = { + nullopen, nullclose, memrw, memrw, mmioctl, + nostop, notty, nopoll, nommap, nokqfilter, D_OTHER +}; + +int +memrw(dev_t dev, struct uio *uio, int flags) +{ + return ENXIO; +} diff --git a/sys/arch/usermode/usermode/pmap.c b/sys/arch/usermode/usermode/pmap.c new file mode 100644 index 000000000000..7ef2dc727dd6 --- /dev/null +++ b/sys/arch/usermode/usermode/pmap.c @@ -0,0 +1,272 @@ +/* $NetBSD: pmap.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $"); + +#include +#include +#include +#include + +#include +#include + +#include "opt_memsize.h" + +struct pmap pmap_kernel_store; +static uint8_t pmap_memory[1024*MEMSIZE] __attribute__((__aligned__)); +static vaddr_t virtual_avail, virtual_end; +static vaddr_t pmap_maxkvaddr; + +void pmap_bootstrap(void); + +void +pmap_bootstrap(void) +{ +#if 0 + vsize_t bufsz; +#endif + + virtual_avail = (vaddr_t)pmap_memory; + virtual_end = virtual_avail + sizeof(pmap_memory); + + uvm_page_physload(atop(virtual_avail), + atop(virtual_end), + atop(virtual_avail + PAGE_SIZE), + atop(virtual_end), + VM_FREELIST_DEFAULT); + + virtual_avail += PAGE_SIZE; + + pmap_maxkvaddr = VM_MIN_KERNEL_ADDRESS; +#if 0 + kmeminit_nkmempages(); + bufsz = buf_memcalc(); + if (buf_setvalimit(bufsz)) + panic("pmap_bootstrap: buf_setvalimit failed\n"); +#endif +} + +void +pmap_init(void) +{ +} + +pmap_t +pmap_kernel(void) +{ + return &pmap_kernel_store; +} + +void +pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp) +{ + *vstartp = virtual_avail; + *vendp = virtual_end; +} + +/* XXXJDM */ +static struct pmap_list { + bool used; + struct pmap pmap; +} pmap_list[128]; + +pmap_t +pmap_create(void) +{ + int i; + + for (i = 0; i < __arraycount(pmap_list); i++) + if (pmap_list[i].used == false) { + pmap_list[i].used = true; + return &pmap_list[i].pmap; + } + + printf("pmap_create: out of space\n"); + return NULL; +} + +void +pmap_destroy(pmap_t pmap) +{ + int i; + + for (i = 0; i < __arraycount(pmap_list); i++) + if (pmap == &pmap_list[i].pmap) { + pmap_list[i].used = false; + break; + } +} + +void +pmap_reference(pmap_t pmap) +{ +} + +long +pmap_resident_count(pmap_t pmap) +{ + printf("pmap_resident_count\n"); + return 1; +} + +long +pmap_wired_count(pmap_t pmap) +{ + printf("pmap_wired_count\n"); + return 1; +} + +int +pmap_enter(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot, int flags) +{ + return 0; +} + +void +pmap_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva) +{ +} + +void +pmap_remove_all(pmap_t pmap) +{ +} + +void +pmap_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) +{ +} + +void +pmap_unwire(pmap_t pmap, vaddr_t va) +{ +} + +bool +pmap_extract(pmap_t pmap, vaddr_t va, paddr_t *pap) +{ + /* XXXJDM */ + *pap = va; + return true; +} + +void +pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) +{ +} + +void +pmap_kremove(vaddr_t va, vsize_t size) +{ +} + +void +pmap_copy(pmap_t dst_map, pmap_t src_map, vaddr_t dst_addr, vsize_t len, + vaddr_t src_addr) +{ +} + +void +pmap_collect(pmap_t pmap) +{ +} + +void +pmap_update(pmap_t pmap) +{ +} + +void +pmap_activate(struct lwp *l) +{ +} + +void +pmap_deactivate(struct lwp *l) +{ +} + +void +pmap_zero_page(paddr_t pa) +{ +} + +void +pmap_copy_page(paddr_t src, paddr_t dst) +{ +} + +void +pmap_page_protect(struct vm_page *pg, vm_prot_t prot) +{ +} + +bool +pmap_clear_modify(struct vm_page *pg) +{ + return true; +} + +bool +pmap_clear_reference(struct vm_page *pg) +{ + return true; +} + +bool +pmap_is_modified(struct vm_page *pg) +{ + return false; +} + +bool +pmap_is_referenced(struct vm_page *pg) +{ + return false; +} + +paddr_t +pmap_phys_address(paddr_t cookie) +{ + return ptoa(cookie); +} + +vaddr_t +pmap_growkernel(vaddr_t maxkvaddr) +{ + pmap_maxkvaddr = maxkvaddr; + return maxkvaddr; +} diff --git a/sys/arch/usermode/usermode/process_machdep.c b/sys/arch/usermode/usermode/process_machdep.c new file mode 100644 index 000000000000..d615a8fd656a --- /dev/null +++ b/sys/arch/usermode/usermode/process_machdep.c @@ -0,0 +1,76 @@ +/* $NetBSD: process_machdep.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $"); + +#include +#include +#include + +int +process_read_regs(struct lwp *l, struct reg *regs) +{ + return 0; +} + +int +process_read_fpregs(struct lwp *l, struct fpreg *regs) +{ + return 0; +} + +int +process_write_regs(struct lwp *l, const struct reg *regs) +{ + return 0; +} + +int +process_write_fpregs(struct lwp *l, const struct fpreg *regs) +{ + return 0; +} + +int +process_sstep(struct lwp *l, int sstep) +{ + return 0; +} + +int +process_set_pc(struct lwp *l, void *addr) +{ + return 0; +} diff --git a/sys/arch/usermode/usermode/sys_machdep.c b/sys/arch/usermode/usermode/sys_machdep.c new file mode 100644 index 000000000000..5a3df4c051b6 --- /dev/null +++ b/sys/arch/usermode/usermode/sys_machdep.c @@ -0,0 +1,48 @@ +/* $NetBSD: sys_machdep.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $"); + +#include +#include +#include +#include +#include + +int +sys_sysarch(struct lwp *l, const struct sys_sysarch_args *uap, register_t *rv) +{ + return EINVAL; +} diff --git a/sys/arch/usermode/usermode/syscall.c b/sys/arch/usermode/usermode/syscall.c new file mode 100644 index 000000000000..160cf40e2bba --- /dev/null +++ b/sys/arch/usermode/usermode/syscall.c @@ -0,0 +1,53 @@ +/* $NetBSD: syscall.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $"); + +#include +#include +#include +#include + +void syscall(void); + +void +child_return(void *arg) +{ +} + +void +syscall(void) +{ +} diff --git a/sys/arch/usermode/usermode/trap.c b/sys/arch/usermode/usermode/trap.c new file mode 100644 index 000000000000..9b2d9a31359d --- /dev/null +++ b/sys/arch/usermode/usermode/trap.c @@ -0,0 +1,46 @@ +/* $NetBSD: trap.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $"); + +#include +#include +#include +#include + +void +startlwp(void *arg) +{ +} diff --git a/sys/arch/usermode/usermode/vm_machdep.c b/sys/arch/usermode/usermode/vm_machdep.c new file mode 100644 index 000000000000..cd32744fb91d --- /dev/null +++ b/sys/arch/usermode/usermode/vm_machdep.c @@ -0,0 +1,52 @@ +/* $NetBSD: vm_machdep.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $ */ + +/*- + * Copyright (c) 2007 Jared D. McNeill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Jared D. McNeill. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.1 2007/12/29 14:38:37 jmcneill Exp $"); + +#include +#include +#include + +#include + +void +vmapbuf(struct buf *bp, vsize_t len) +{ +} + +void +vunmapbuf(struct buf *bp, vsize_t len) +{ +}