Page 1 of 1

A big problem with a crazy kernel

Posted: Sat Jul 18, 2020 7:12 am
by AdiLAN
Hi, I have a big problem with my kernel, namely the kernel goes crazy keeps restarting qemu and I don't know why this is happening at all.
Here I leave a link to my project, inside is the latest compilation of the system along with a gif showing the crazy behavior of the kernel and source code.
https://mega.nz/folder/jhg1naiR#qH9oybvrGjYvIue2zho5jg
And one more problem underneath, I hope some of you help me fix these bugs.

Re: A big problem with a crazy kernel

Posted: Mon Jul 20, 2020 11:18 pm
by Octocontrabass
AdiLAN wrote:Hi, I have a big problem with my kernel, namely the kernel goes crazy keeps restarting qemu and I don't know why this is happening at all.
Usually that means your kernel is causing a fault of some kind, and your exception handlers (if you have them) are not set up correctly, so the CPU faults three times in a row and reboots.

You can add "-no-reboot" to your QEMU command line to stop it from rebooting.

You can add "-d int" to your QEMU command line to log the fault (among many other things). The information in the log will tell you where to look to find the problem.

Once you fix the rebooting issue, you can use a debugger to step through your printAt() function to see why it's not printing the way it should be.

Re: A big problem with a crazy kernel

Posted: Mon Jul 20, 2020 11:28 pm
by nullplan
In the code you posted, I see nothing to prevent the kernel from returning from its main function. Where does it return to? Is there anything to stop the CPU at that place? You can just add

Code: Select all

for (;;) asm("hlt");
as last line to prevent the kernel from returning.