Because I wanted to Get :poop: Done, I wasn't too concerned about the
quality of the code. And I always thought "I can just refactor it
later." But, as it turns out, the more junk you throw on a pile, the
harder it is to fix.
Specifically, the issue is global mutable state. By trying to port over
the way that C did it, all of the crates were having their own, global
singleton instance, and they all relied on each other's internals to
make it work. I think we can do better.
As such, this commit removes a bunch of stuff. Namely:
keyboards
interrupts
the pic crate
And changes what's there a bit. For starters, vga's kprintln is now in
the kernel itself.
We also have a new KernelContext struct. This will hold all of the state
for the kernel, and our first bit of state is the vga driver. Instead of
a single, global kernel lock, we'll choose a lock for each bit of
relevant state.
We can even keep it entirely on the stack of kmain, rather than having
it available globally. The only thing that might not work for that is
the panic handler; I'm not sure what to do there. I might just have to
suck it up and make one single global reference and only use it for
that.
Because I wanted to Get :poop: Done, I wasn't too concerned about the quality of the code. And I always thought "I can just refactor it later." But, as it turns out, the more junk you throw on a pile, the harder it is to fix.
Specifically, the issue is global mutable state. By trying to port over the way that C did it, all of the crates were having their own, global singleton instance, and they all relied on each other's internals to make it work. I think we can do better.
As such, this commit removes a bunch of stuff. Namely:
And changes what's there a bit. For starters, vga's kprintln is now in the kernel itself.
We also have a new KernelContext struct. This will hold all of the state for the kernel, and our first bit of state is the vga driver. Instead of a single, global kernel lock, we'll choose a lock for each bit of relevant state.
We can even keep it entirely on the stack of kmain, rather than having it available globally. The only thing that might not work for that is the panic handler; I'm not sure what to do there. I might just have to suck it up and make one single global reference and only use it for that.