OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 7:00 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Solved] Strange bug once kernel size grows
PostPosted: Mon Nov 19, 2018 8:55 pm 
Offline

Joined: Mon Nov 19, 2018 8:47 pm
Posts: 2
I am struggling with a strange problem.

Problem:

One day I found my kernel triggers General Protection in the middle of "strftime". If I just delete some unnecessary code, the problem disappears. However, once I add more meaningless and harmless code, it re-appears. It doesn't matter where I add my code. It's like once the size of kernel excess such amount, the problem triggers.

Sometimes it's General Protection; sometimes it's ok but string literals doesn't initialize correctly.

I know this isn't much information. But I am new to this circumstance and I don't know what information to give.


Anyone has any idea what this might be about? Or What I can do to locate the real problem?


Thanks in advance!


Last edited by SnowWalkerJ on Mon Nov 19, 2018 10:39 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Strange bug once kernel size grows
PostPosted: Mon Nov 19, 2018 9:35 pm 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
Hi,

Are you using a custom boot loader? How are you loading the kernel?

There was a similar issue reported long ago on one of our projects which was due to the boot loaders' ReadSector function not being written to support multi-segment reads. After the kernel size exceeded the segment (64k) it would corrupt itself during loading.

_________________
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}


Top
 Profile  
 
 Post subject: Re: Strange bug once kernel size grows
PostPosted: Mon Nov 19, 2018 10:33 pm 
Offline

Joined: Mon Nov 19, 2018 8:47 pm
Posts: 2
neon wrote:
Hi,

Are you using a custom boot loader? How are you loading the kernel?

There was a similar issue reported long ago on one of our projects which was due to the boot loaders' ReadSector function not being written to support multi-segment reads. After the kernel size exceeded the segment (64k) it would corrupt itself during loading.


Thank you! You saved me!

It turns out that the 'number of sectors' param was set too small when loading the kernel.

You just pointed it out!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 82 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group