Page 2 of 2

Re: Kernel trouble

Posted: Mon Mar 14, 2011 6:42 pm
by halofreak1990
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.

Re: Kernel trouble

Posted: Mon Mar 14, 2011 9:36 pm
by Mike
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.

Re: Kernel trouble

Posted: Mon Mar 14, 2011 9:51 pm
by halofreak1990
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.

Re: Kernel trouble

Posted: Tue Mar 29, 2011 9:41 pm
by halofreak1990
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?

Re: Kernel trouble

Posted: Sat Apr 02, 2011 6:21 pm
by Mike
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.