Add a profile device.

This is the Plan 9 profile device, it's quite basic
but it's better than nothing. We can continue to use
this interface but we should try to get something
better underneath.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Add the Plan 9 kprof device.

The Plan 9 kprof device takes samples at 1ms intervals.
It maintains an array that is the size of kernel text / 8.
At each timer interrupt, it adds 1 to the array[pc/8].
In this way, we get a profile, accurate to 1 ms, of where
the kernel spends its time.

Unlike Plan 9, the output format of this is text.
Each text record is 48 bytes; 30 bytes of name,
1 byte of space, 16 bytes of PC, and a newline.

To try this, you can, e.g.,
bind -a '#K' /net # we can't use /dev yet.
echo start > /net/kpctl
do something
echo stop > /net/kpctl
cat /net/kpdata > /somefile

Bugs:
- we need to atomic_inc the buf entries, not just add 1
- we only do this on one core; we need to start timers on all

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Re-add the bsd library

We need it for netperf. I'm not in the mood to try to change
an autoconfig-based chamber of horrors at this point in my life.
Far easier to make a compatibility shim, and that alone should tell
you all you need to know about what's wrong with open source software
nowadays.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Add more info to the kprof and fix a big

In real use, turns out we want that PC. We don't want to
merge the common functions from the kernel either.
We may even decide to stop the >> 3 on the PC, depending.
Memory is cheap.

Fix a bug that came up because of dealing with snprintf behavior,
long story.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
pthread_test can easily be built for linux

Note the use of misc-compat.h.  Feel free to add things there for other
tests.
pthread_switch: fast user-level context switch

This is just an example of what you can do.  Be a little careful if you
use this in another 2LS, since it short-circuits the rest of
uthread_yield.  I think it is okay as is, but future uthread changes
could cause trouble.  If we really need this behavior, I could build it
in to uthread.c.

Also, this adds an interface to pthreads, such that you can create a
thread, but not start running it yet.  Careful with that, too.
Removed IRQ routing test

Was getting sick of those #warnings during compile.
Adds kill to the monitor

Got tired of procinfo kill PID.  Too much typing.  =)
Monitor access to semaphore debugging info

db sem for print_all_sem_info().  Easier than kfuncing.  Feel free to
add other useful things to db.

Also, this adds that much needed newline to print_all_sem_info().  How
many people have looked at that output and not cursed its unreadability?
Fixes ifconfig issues

On my machine, cs doesn't produce #s/cs before ifconfig tries to mount
it.

Also, cs debugging is pretty loud.  We can turn it on easily if we need
to debug.
Removes ping warnings, tries to use cs

CS doesn't actually work completely.  It'll hang if you:

ash ifconfig
echo debug > cs
ping www.google.com

It's fine that we don't have DNS yet, but CS shouldn't hang forever.
Monitor command bt, alias for backtrace
Fix trivial bug in kprof -- pc not getting set correctly

I was testing with dd bs=64 etc. etc.
Andrew Gallatin tested with cat.

For me, the pc was always right, since each read was a single
record and the pc was recomputed each time. For larger reads, it would be mostly wrong.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Add a short explanation of the kprof device.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Add Intel 82563 NIC support.

This code courtesy of Erik Quanstrom.
Add early docs on building netperf.

It's a pretty ugly process.
Make changes to the bsd library to get it to built with netperf.

More needs doing. I'm going to remove any use of select from netperf.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Correct the date in the copyright line of ether82563.c

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
Fixes short 9ns dirent reads

Things like 'ps' were failing.  There might have been others.  The read
method would work, but it was possible to squeeze in multiple Ms in the
buffer for a single kdirent read.  End result, we'd miss entries every
so often.  For devproc, we'd miss the second of three processes.

This didn't take as long to figure this out as when it happened to
devmnt, but still took took long.

I put in a check in devdirread which should trip if our minimum is wrong
again.
Moved busybox patches to their own folder.