2013-09-22

2013-09-22 It says "Hello World!"

After spending quite a bit of time debugging the ELF loading, the test program being loaded into the kernel is able to output to the stdout stream and to have that written to the screen.

I finally managed to debug all the relocation gubbins and track down all the stupid mistakes (which were stupid).  From the forgotten "ret" at the end of "_start" (which made it try to run the program again), to the loop in write() which accidentally printed the characters backwards.  It's all been ironed out

I know it seems as if it's taken a long time to get the Hello World! stage, but the way that it's showing the Hello World is very complete as far as how finished kernels do it.

The Hello World program itself is identical to a Hello World program in C for any other OS.  This conversely means that any program that only outputs text to the screen can be compiled up against my C library and run on my OS now.

With a little bit more work, the kernel is now able to pass command-line arguments to the program, so I can make an Echo program as well.

Of course, the set of programs that only output text to the screen is fairly limited, so my next task is to get the keyboard wired up to stdin in some way so things can be a bit more interactive.

2 comments:

  1. Congratulations! An interesting read as always ;)

    Would you consider writing an article about your build/debug pipeline? In another post you mention your use of Bochs, it would be really interesting to see how you are testing your OS and how you deploy changes.

    ReplyDelete
    Replies
    1. That's a good point, I haven't detailed how all that works. I shall add that to the to-do list. It would be good as well as I haven't seen my particular approach used by any of the other OS projects that I've looked at.

      Delete