Jason (jcreed) wrote,
Jason
jcreed

Since I took OS way back when they were teaching it on solaris and not on intel, I never had the fun of going through the (not very essential to understanding how OSes but still cute and fun) part of writing a bootloader in assembly and switching to protected mode and hopping over to real kernel code written in C. A little tutorial popped up on HN today as to how to do exactly that, and it was quick and fun to chug through it. I learned (not from the tutorial but from extra-curricular google-sleuthing when my code didn't work right) about having to add -m32 to my gcc and ld lines to cross-compile 32-bit code on a 64-bit machine, and also -fno-asynchronous-unwind-tables to prevent it from creating an .eh_frame section. Anyway I got up to the point of having my "kernel" be a successful write to text-mode video memory via
int _start () {
  char *vid = (char *) 0xb8000;
  vid[0] = 'H';
  vid[1] = 0xf0;
}

(this draws an inverse-video 'H' at the top-left of the screen!) and then I looked up how you set up high-resolution graphics modes and I started... gibbering just a little bit and recalling what H. P. Lovecraft'd said about inability of the human mind to correlate all its contents.
Tags: systems
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 3 comments