using a non-tutorial bootloader?

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
xixpsychoxix
Posts:59
Joined:Tue Oct 13, 2009 8:49 pm
using a non-tutorial bootloader?

Post by xixpsychoxix » Mon Jul 09, 2012 1:16 pm

Hi all! I have decided to try to use a different bootloader than the tutorial one for a couple different reasons, the main one being I want to be able to add different versions of my os to the disk and rather than reimplement all of that I would rather just use code that is in place. I first tried GRUB but there seems to be alot of complications that go along with it. Next I tried Neptune's bootloader which starts up fine but then I get a page fault every time I try to load my os. I was as far in the tutorial as reading text files from the disk (the VFS chapter) and so I thought "maybe it's because of the virtual memory." So I proceeded to build the executable from the demo on physical memory management. I got a page fault there as well but a different blue screen. The first one was just a plain text screen. The second screen I got with the physical memory demo had an M.O.S. logo of a computer monitor at the top. Any ideas as to why my system is not loading for me? Advice is greatly appreciated!


EDIT: I just realized that the page fault that I am getting in the physical demo is in fact an error within the kernel example, not the bootloader! I will try to work that out here. Sorry! Thanks!

EDIT (AGAIN!!!): Ok, so I have narrowed down the problem. It seems that my multiboot information is being passed wrong. Does anyone know how Neptune loader passes the multiboot structure? Does it place it as an argument on the stack or is it contained in ebx?

User avatar
Mike
Site Admin
Posts:465
Joined:Sat Oct 20, 2007 7:58 pm
Contact:

Re: using a non-tutorial bootloader?

Post by Mike » Tue Jul 10, 2012 3:14 am

Hello,

The boot loader passes the address of the multiboot info structure into ebx for the kernel or executive. Of course, the multiboot header must also be present and properly aligned in the first 8k of the image. This is what is required by the standard. If a valid multiboot header is not found, the loader assumes a non-multiboot image and multiboot information is not passed. (We have a utility that can be used to test for a valid header.) Also, the loader assumes that section alignment matches that of disk sector alignment (that is, you have the /align:512 switch), not doing so may result in a page fault. If all of these are true, the loader "should" be able to load your operating system without error.

Please do note that a new version of the boot loader is planned for release soon as well.

xixpsychoxix
Posts:59
Joined:Tue Oct 13, 2009 8:49 pm

Re: using a non-tutorial bootloader?

Post by xixpsychoxix » Tue Jul 10, 2012 1:37 pm

Well now the problem is that I am getting an invalid instruction error? And I am using Visual Studio 2008 professional edition. The switch /align:512 is not recognized by the compiler but im not sure why? When do you think you will be releasing the new bootloader (not to rush you lol)?

halofreak1990
Posts:92
Joined:Thu May 27, 2010 8:54 pm
Location:Netherlands

Re: using a non-tutorial bootloader?

Post by halofreak1990 » Tue Jul 10, 2012 3:00 pm

xixpsychoxix wrote:Well now the problem is that I am getting an invalid instruction error? And I am using Visual Studio 2008 professional edition. The switch /align:512 is not recognized by the compiler but im not sure why?
Where did you try and put the /ALIGN:512 command? It's supposed to be in the LINKER command-line. If you put it in the Compiler command-line, then that might explain the problem you're having.

xixpsychoxix
Posts:59
Joined:Tue Oct 13, 2009 8:49 pm

Re: using a non-tutorial bootloader?

Post by xixpsychoxix » Tue Jul 10, 2012 3:08 pm

It's supposed to be in the LINKER command-line. If you put it in the Compiler command-line, then that might explain the problem you're having.
OOPS!!!

Post Reply