Initial commit.

Working (mostly):
Basic IO
User mode (kinda)
Stacks for each mode
Interrupts
Page-level memory allocation
Standard library
Switched kprintf to printk (which includes a newline by default).
Made the syscalls functions
Changed some names around -- no namespaces in C is really annoying.
PCBs now work. This is the (major) start of multiple processes. It also
paves the way for non-swi interrupt (= timer interrupts).

Also, assembly is easy once you know what to do, but knowing that is hard.

Also, did some cleanup.
Remove garbage assembly file
Got PCB more working. Started with multiple processes.

For some reason, we are corrupting spsr when we switch processes.

Also, made printk and panic more colorful and useful. Added println for users.
Added the EXIT syscall. User procs automatically call it upon return from main() (like C defines).
Multiple processes work fully. We are using a simple round-robin scheduler for now.
Fixed some various assembly bugs (apparently subtracting from sp doesn't release stack space...).

TODO: stride scheduler? Tickets?
Removed old mm code. I started too complex, especially when the rest of the system is pretty fragile
If we want our code back... that's what revision control is for :)


We are currently using a high-water mark algorithm.

Possible changes: linked list style approach?
Cleanup.

Made seperation between kernel and user code more obvious
Made a real makefile...
Fixed a linker error that caused everything to fail.
Malloc works.

Problems:
Userspace is concurrent, and malloc uses static data. Ergo, it's not process safe (virtual mem isn't on yet).
Still need to free mem on cleanup (and make a global memory system that can do something with free memory ;))
Various fixes.

Start of a stdio lib with getline().

The GETC syscall was added, because READ_STDIN is effectively just that anyway. READ_STDIN deprecated for now?

The OS now automatically echos your keyboard input.

vector and the vector string tokenizer now work. A very useful library for say.... a shell?!
Refactored malloc and vector to be usable from both kernel and user-space. This involves passing in a struct for it to keep notes on.

To keep usercode reasonable, I added wrappers around the new functions that do all the fun for you.

Also added debug() for userspace -- it's the equivilent of printk() for the kernel.
Added locking.

We use a very simple lock here -- just an integer and 1 and 0.
However, to work, we needed a yield syscall, which does nothing but give up the CPU, hopefully to someone
who has the lock. [Note: this would be a cool place to play with ticket transfer, etc]

We don't use any test-and-set, cas, etc atomic instructions in the lock functions; this is
safe because we are targetting a uniprocessor system and our scheduling in cooperative. The only
way we can get preempted is by making a syscall or instr/mem errors.

Notably, this makes malloc safe to use from more than one user processes at a time :)
...and fixed the first locking bug of my operating system.
Starting a shell. Since we don't have a fork/exec pair, it's kinda boring right now...

Additionally, attempting to get readline-style commands working (history, etc).

Various changes towards these goals.
A file for the definitions of the "extended chars" (the arrow keys, most notable).

These chars come in as multi-byte sequences (^[92A, etc), but those are a PITA to use
so we're converting them to integer constants that can be detected and handled seperately when
the IO syscalls return.

Additionally, PUTC was readded so that extended chars can easily be passed back into the OS for IO.
shell history works
Added exec(). It works.

Started bc, as another program to run to test exec. Doesn't work yet.

Abstracted the history/keyboard functionality into a readline() function. I figure most programs
just want lines of input, and don't care to take care of the details of history themselves, so they
can just use this function. If they want their own management, they can do it themselves.

Also, I found out stdlib has no atoi function -- annoying.
BC works. Division apparently does not, since I'm building with --disable-builtins.

I guess I should write one, but I may just avoid division for now...
Changed char to void to avoid pointless warnings.