Subject: NetBSD/usermode
To: None <tech-kern@NetBSD.org>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: tech-kern
Date: 12/28/2007 05:34:16
Heyas folks --

I'd like some feedback before I decide if I should commit a pet project 
I have been working on over the past few days.

What I've done is created a port of NetBSD which runs as a userspace 
application and has full access to libc. It's not quite single user yet, 
but it's getting pretty close.

Here's the code for review, tested so far only on amd64:

   http://www.invisible.ca/~jmcneill/netbsd/usermode-20071228.tar.gz

Please note that for the time being, you will need to copy 
common/lib/libc/arch/<targetport> -> common/lib/libc/arch/usermode to 
let this build.

It can boot up to the point where vfs_mountroot is called, but for some 
reason at this point bufpool_page_alloc is returning NULL so the 
scheduler is stuck spinning between softclk and idle lwps.

There is a dmesg for the curious at the end of this email.

Cheers,
Jared


$ gdb -q ./netbsd.gdb 

(gdb) run
Starting program: 
/export/home/jmcneill/branches/HEAD/src/sys/arch/usermode/compile/GENERIC/netbsd.gdb 

NetBSD/usermode startup
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
     2006, 2007
     The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
     The Regents of the University of California.  All rights reserved.

NetBSD 4.99.45 (GENERIC) #0: Fri Dec 28 05:25:34 EST 2007
	jmcneill@black.invisible.ca:/export/home/jmcneill/branches/HEAD/src/sys/arch/usermode/compile/GENERIC
total memory = 128 MB
avail memory = 123 MB
mainbus0 (root)
cpu0 at mainbus0
clock0 at mainbus0
ttycons0 at mainbus0: console
md0: internal 5000 KB image area
root on md0a dumps on md0b
^C
Program received signal SIGINT, Interrupt.
0x000000000047fdc2 in sched_curcpu_runnable_p ()
     at ../../../../kern/sched_4bsd.c:527
527			bits |= global_queue.rq_count;
(gdb) bt
#0  0x000000000047fdc2 in sched_curcpu_runnable_p ()
     at ../../../../kern/sched_4bsd.c:527
#1  0x000000000046620c in idle_loop (dummy=<value optimized out>)
     at ../../../../kern/kern_idle.c:71
#2  0x00007f7ffdb51600 in swapcontext () from /usr/lib/libc.so.12
#3  0x0000000000000000 in ?? ()
(gdb)