Kernel trouble

For programming questions that do not fit in the other forums.

Moderator: Moderators

Re: Kernel trouble

Postby halofreak1990 » Mon Mar 14, 2011 6:42 pm

Ignore my previous post. The problem was in a chunk of code that was supposed to gather information about the CPU. I removed it, and now it boots a little further.
However, this is where I run back into an old quirk in that my kernel behaves differently in Bochs and on real hardware.
In Bochs, my kernel goes as far as the floppy driver, and then somehow hangs because I send the floppy recalibrate command twice (required to get the heads back to sector0 on real hardware).
And on real hardware, my kernel triple faults when initializing the Physical memory Manager. My exception handlers are either not working properly, or there's something wrong with my code.

*sighs* Maybe I should make this easier on myself and just get the latest tutorial kernel to work on, since that one DOES work.
I can then add in my own code piece by piece and figure out what I've messed up.

Thanks for any help so far, though.
halofreak1990
 
Posts: 92
Joined: Thu May 27, 2010 8:54 pm
Location: Netherlands

Re: Kernel trouble

Postby Mike » Mon Mar 14, 2011 9:36 pm

Hello,

I find it suspicious that the latest chapter would work considering it does not contain the updated VMM software. The PMM is the same in both demos so I suspect it might be this update that causes the compatibility issue with your PC.

Please verify if this assumption is correct by comparing the results of a demo prior and after the ("Do to updates") notice.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com
User avatar
Mike
Site Admin
 
Posts: 463
Joined: Sat Oct 20, 2007 7:58 pm

Re: Kernel trouble

Postby halofreak1990 » Mon Mar 14, 2011 9:51 pm

Mike wrote:Hello,

I find it suspicious that the latest chapter would work considering it does not contain the updated VMM software. The PMM is the same in both demos so I suspect it might be this update that causes the compatibility issue with your PC.

Please verify if this assumption is correct by comparing the results of a demo prior and after the ("Do to updates") notice.

You are absolutely right. In fact, I was using the Chapter 21 Demo to compare with, instead of 23, which has yet to be fixed.
I keep getting the two confused somehow.
halofreak1990
 
Posts: 92
Joined: Thu May 27, 2010 8:54 pm
Location: Netherlands

Re: Kernel trouble

Postby halofreak1990 » Tue Mar 29, 2011 9:41 pm

This is weird. I've been shifting around bits of code in preparation of some additions to the kernel (no change to functions, just moved some to other files).
And I placed a cli/hlt pair in my code after the first call to DebugPrintf, and it runs up to that point. If I remove it, the kernel crashes on the very next function, which is
Code: Select all
pmmngr_init(bootinfo->m_memorySize, 0x100000 + kernelSize*512);
anything before that, though works as it should.

On a side note, the value of bootinfo->m_memorySize is always 64KB less than what is actually present in my test system. I don't expect it to be the source of my trouble, but I decided to mention it anyways.

Also, I found that the kernelSize variable passed to the pmmngr_init and pmmngr_deinit_region is never set, and will always be 0.
Is it somehow set by the bootloader, or do I need to somehow discover the right value and set it myself?
halofreak1990
 
Posts: 92
Joined: Thu May 27, 2010 8:54 pm
Location: Netherlands

Re: Kernel trouble

Postby Mike » Sat Apr 02, 2011 6:21 pm

Hello,

There is a potential bug with regards to the when kernelSize was being initialized. It has been fixed for the Chapter 24 release. kernelSize should be set in kernelEntry because it is obtained from DX which might get trashed.

A better method is to have the kernel obtain its own size directly instead of relying on the bootloader.

With regards to the crash, please provide the register dump from the crash log.
Lead Programmer for BrokenThorn Entertainment, Co.
Website: http://www.brokenthorn.com
Email: webmaster@brokenthorn.com
User avatar
Mike
Site Admin
 
Posts: 463
Joined: Sat Oct 20, 2007 7:58 pm

Previous

Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron