Initialize num pipe readerw/writers to 0
printnum() is no longer recursive

When printing a full 64 bit pointer in hex (16 'digit's), printnum()
consumed over 1KB of stack, which can run off the end of the kernel
stack.  We use about 80B per frame.

I'm not concerned about the repeated divisions; the actual output is far
more expensive than that, last I checked.
Pipe open/release should depend on mode not flags
x86: Better emergency codes for core 0

Shift-G still works, though I suggest weaning yourself of that.  Ctrl-G
does the same thing (enters the monitor when the core is able to).  This
is the preferred way to enter the monitor.

Ctrl-Q also enters the monitor, but does so directly from IRQ context.
This can be dangerous, but is better than nothing.

Ctrl-B dumps a backtrace and trapframe of the core.  You could do this
manually after a Ctrl-Q, too.

The core that runs the backtrace or monitor is whatever core received
the IRQ.  This is almost always core 0.  Debugging remote cores can be
done from the monitor on core 0.

These codes require interrupts to be enabled.  I don't have a way to
send nmis to core 0 yet, other than from the monitor on another core.
Spinlock checking is disabled by default

Reversing depth_disabled to checking_enabled.  Now, the extra debugging won't
get turned on til we're ready for it.
Adds a pcpu tracer for spinlocks

Compile with SPINLOCK_DEBUG and TRACE_LOCKS, then access the info from the
monitor with 'trace pcpui'.

This is very spammy, and it'll clobber any other info in the trace, so be
careful using it.  It will also attempt to find the location of the lock, based
on the symtab.  This only works for locks above KLA (o/w, the lock is dynamic).

When building with TRACE_LOCKS, we also disable any of the fancier checks for
the console and printf locks, so that they don't clobber our results.
Otherwise, as you printed lines, you'd be adding to the trace.
Renames the console lock

Interestingly enough, this wasn't the first spinlock ever (hence the poor
name).  The first actual usages were for the output_lock (very similar to the
console lock).  I don't count the smp_boot assembly stuff as a legit use of the
venerable spinlock.
Adds round-down to the nearest power of 2

Can also use the Xen macros, if you're interested (__RD32).
Atomic pipes

Similar to pipe, but for in-kernel transfer and synchronization.  You
can't use them from IRQ context.  See apipe.h for info.
Fixes bug in sys_pipe()

Under some circumstances, a writer could block and then never wake up.
Updates .gitignore

I was sick of seeing the occasional .swo with vi.
The monitor doesn't cache coreid

Certain commands, when run from the monitor, can cause the monitor to
migrate unexpectedly.  We no longer cache the coreid, and we force a
re-read, so that we don't report the old coreid after a migration.
Add plan 9 namespace. Fails on chan.c but we're working on that.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Trivial changes toward compiling.
And further changes.
compiles, does not link
more support functions.
Need to get the devtab ldscript bit done.
Boots, and there is a monitor command (9open) to serve as a model for the rest.
To test, type
9open #Z 0
(#Z being a plan 9 notation for device Z, my regression device)

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Namec works. Waserror is way improved.

It's not quite as easy to use as Plan 9 but waserror is way better.
It also now has a great deal of integrity checking at the cost of a bit more
work on the programmer's part.

And, the 9open test works :-)

Changes to date and issues:
changing incref/decref to krefs (semantics)
removing utf-8
Translating proc structs
The fact that we don't have current-> or up->

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Print the returned fd

9open/sysopen works. There is still some ordinance left should you
open a non-# file, however.

Focusing on read/write next.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Implement read system call

The read system call is by far the harder of the two. It includes directory
reads and that includes union mount reads, with all corner cases included.

The test is:
9open #Z 0
get the returned fd -- in this case, usually 0
Try to read 22 bytes @ 0
9read 0 22 0
Fails. But, doesn't panic or do anything nasty. The waserror stuff is working
very well.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Implement write.

One can now
9open #Z/regressctl 0
9write 0 v 1 0

and watch it explode ... but a fix will happen.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Write works.

I'm going to yank a lot of these debug prints at some point but
they're handy.

Turns out write always worked, I was opening the file readonly and the
kernel objected.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Stitch plan 9 open into sys_open

This seems to be working; the oflags are bog-standard unix. Not sure
how to manage the omode yet.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>