Saturday, December 22, 2007

Pointers, and Structures, and Strings... Oh My...

Ye machine language is an unforgiving beast, aye, she is...



Its true folks, the demo-shell is finally getting off the ground. As you can see, I've added a couple commands. There are still a couple of very small bugs - but the majority have been hammered out.

Some things to remember when you are coding an OS:

1) Your code is what you code. An infinite loop is always an infinite loop. Even if you don't know you coded one, and can't figure out why your kernel "locks up" - and then revert all changes and try again - if you code an infinite loop twice, then you code an infinite loop twice.

2) Pointers are not toys. They are pointy. If you play with some (instead of others), (like writing allocation node consolidation code to prevent memory fragmentation), the ones you aren't paying attention to, will twist together and stab you from behind. You cannot have tunnel vision when playing with pointers, they are unforgiving.

But basically, I've journeyed along the the managed-brick road, and come out with a demo-shell that people can start playing with. In fact, if you download SharpOS from our Subversion repository's trunk right now, and compile and boot it, you will see the demo-shell in action.

There is one bug I'm still trying to figure out. The first command or two, in the linked list of commands, always seems a bit corrupt. Sometimes the first command in the list is completely swallowed into the void. And other times, the list will have two seemingly corrupt commands off the top, with the complete list of expected commands tacked on the end. I've double checked all of my initialization code, and linked-list management code, and I haven't figured it out yet.

More commands, (and obviously a bug-fix or two), are still on the way...

1 comment:

Will said...

Awesome work Bruce! So maybe we're gonna forge that release we were thinking about? Cooool!

As for the corruption, if you are not sure where those bytes are changing, you can add another field to that structure called magic and set it to a certain value when you create the data. you can then do checks periodically to see if the data is corrupted yet. Just my 2c :)