kernel - Refactor the kernel message buffer code
* Add a separate tracking index for /dev/klog (syslog) so it does not eat
the base index for the in-memory buffer.
* Change the way the FIFO indexes work. The indexes are no longer stored
as modulo size values. Instead they are simply adjusted without a modulo,
making calculations easier.
* When the FIFO is full we now add around ~1KB of slop to reduce instances
where SMP collisions implode the buffer. This also required adjusting
the kern.msgbuf sysctl to avoid dumping the 'slop' area (it used to just
dump the entire buffer).
* Adjust dmesg to operate more consistently, and to modulo the indices when
making calculations.
* The dmesg -a option now dumps the <num> prefix for syslog / console output
messages. Before it tried to strip them out, which created problems in
distinguishing kprintf()d output from syslog output.
* Adjust the console tty support thread (which copies the dmesg buffer to the
console) as well as /dev/klog to use the new index methodology.
* It is now possible for the indexes to wrap the buffer multiple times
(between e.g. bufl and bufx), and it obviously makes no sense to try to
dump the overwritten data over and over again, so if indexes get totally
out of whack we reset bufr and bufl as needed to the size of the buffer.