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.
A big problem with a crazy kernel
A big problem with a crazy kernel
- Attachments
-
- kernel code:
void main(void) {
clearScreen(0x99);
printAt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 0);
} - q0.png (7.82 KiB) Viewed 919 times
-
- kernel code:
void main(void) {
clearScreen(0x99);
printAt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 0);
printAt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 0);
} - q1.png (8.45 KiB) Viewed 919 times
-
- kernel code:
void main(void) {
clearScreen(0x99);
printAt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 0);
printAt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 0);
printAt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 0);
} - q2.png (7.97 KiB) Viewed 919 times
-
- Member
- Posts: 5885
- Joined: Mon Mar 25, 2013 7:01 pm
Re: A big problem with a crazy kernel
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.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.
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
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
as last line to prevent the kernel from returning.
Code: Select all
for (;;) asm("hlt");
Carpe diem!