For your daily dose of awesome, visit here.
Back to kernel.
Life has been odd lately.
Monday night was coding until 7 AM. Tuesday night was another all-nighter, coding until the checkpoint on Wednesday morning. Then was more coding until Wednesday night, when I tried to get a decent amount of sleep. Still, it wasn’t enough, since I had to get up for work at 7 and ended up leaving early because I was starting to have trouble reading lines of code like “x = 5;”
Also, in the past 2 days, I have received two job offers. One is with a company I really, really like (in California), and will likely take unless something better comes up, or unless I decide to remain in Pittsburgh. I dunno.
Wheee things have been so surreal lately… likely due to the recent lack of sleep.
Here’s looking forward to late November, when I can start getting back to a normal sleep schedule.




Edit: Continuing the trend of not getting enough sleep, it is now almost 2:30 AM and I’m coding. Wheee.
Last night I was up coding until 7 AM. A lot of the time was spent fixing compiler errors, and then tracking down a bug caused by using the wrong variable in one place, causing page table entries to get overridden… causing problems later.
Today, it was my turn to have a huge bug in my code, and mine was a conceptual error (although, to be fair, it was one both of us missed).
We decided to start the first two tasks for the kernel by writing a kernelland fork function, which works much like the user version. The user version copies over all of memory except for kernel memory, creating a new kernel stack for the child and putting only the necessary stuff on there (IRET foo and registers).
I did the same thing for the kernel version, except I don’t copy any memory (since there is nothing in userspace yet). I create a new kstack and copy over only the necessary values… the return address (to return to the previous calling function) and registers.
See the problem yet?
Turns out I forgot to take into account that execution in kernelland uses the kstack… and so maybe continuing execution in kernelland (as we do by using the same return address) would need things on the stack. As a result, we kept getting the strangest errors where memory was being overridden in various ways (since the function we return to expects certain things at esp+16, and expects ebp+4 to have arguments and such). So yeah. That bug took a good 3 hours to track down. Oops.
I had a Google interview today. I feel like I did well at the data structures/coding portion, but I completely bombed the algorithms part. It seriously makes me wonder how I managed to get an A in algo class. Or maybe I’ve just forgotten everything since then. Meh.
Whee… now it’s time to debug userspace exec and fork. Fun fun fun?
Edit: 5:30 AM. Looks like it’s going to be another all-nighter. We really should start working more earlier in the week so we’re not stuck doing a bunch of stuff the night of the deadline.
Edit edit: 6 AM and fork works! Huzzah. Turns out the problem wasn’t at all in my code (which was surprisingly, given the complexity of the mapping of multiple physical pages into and out of a virtual address space, correct the first time) but rather with the TLB keeping around “stale” entries. Oops. Now let’s get exec working (and maybe bed after that).
Edit edit edit: 9 AM. Mission failed. We didn’t manage to get exec working (although it now does return to userland and run for a bit, albeit incorrectly, before being context-switched away and page faulting on its next run). Hopefully we’ll have it done today.

OS is death, but life is good.
I want job offers (or, at least, rejections) :-\

Well, I’ve been coding and working on our kernel since approximately 10 AM yesterday (Sunday). The first checkpoint is in 5 hours, and I think we’re going to make it. Maybe.
Both of us are slowing down quite a bit (it took us like 6 hours to even get our code to compile, since we had compiler errors like hell, and then had a ton of linker errors because we forgot various includes, and by that point it was like 2 AM), but the debugging portion shouldn’t be too terribly deathy. In any case, we are quite code complete for checkpoint 1 (and even a little ahead, maybe, in the sense that we wrote our VM to be somewhat correct instead of just hacking it).
Yay for all-nighters!
Greg has been amazing through the past many hours, making breakfast and then dinner for both me and 8, and then bringing me caffeine so I don’t fall asleep.
Perhaps as a consequence of our 17-hour-straight coding spree, and as our last shreds of sanity fled, there was a break for some Zack bondage, and then some 8 bondage, both with Cat5 cable. There are photos, which will likely be posted behind a friends-locked entry behind a cut on my LJ sometime logical tomorrow (although, I suppose, it’s logical today if I never actually get to sleep).
Wheeee….
The next few days are going to be very interesting.
Pamela’s for delicious breakfast tomorrow morning followed by OS checkpoint followed by (probably) more OS coding. Then is going to bed early, since I have to wake up at around 6 AM on Tuesday to catch a plane to another interview in California.
Edit: It works! We made the checkpoint with an hour to spare. Huzzah! Now to do other stuff, because I’ve been coding for the past 23.5 hours.