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!
[Solved] Strange bug once kernel size grows
-
- Posts: 2
- Joined: Mon Nov 19, 2018 8:47 pm
[Solved] Strange bug once kernel size grows
Last edited by SnowWalkerJ on Mon Nov 19, 2018 10:39 pm, edited 1 time in total.
Re: Strange bug once kernel size grows
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.
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();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
-
- Posts: 2
- Joined: Mon Nov 19, 2018 8:47 pm
Re: Strange bug once kernel size grows
Thank you! You saved me!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.
It turns out that the 'number of sectors' param was set too small when loading the kernel.
You just pointed it out!