Random restarts #7

Closed
opened 2022-10-08 12:22:53 +00:00 by apio · 2 comments
Owner

Sometimes, on boot, the system randomly restarts after enabling interrupts (I believe).

[0.0] main: Loaded IDT
[0.0] pic: Remapping PIC
[0.0] pic: Remapping master PIC to ISRs 32-39
[0.0] pic: Remapping slave PIC to ISRs 40-47
[0.0] pic: Setting mask of master PIC to 0xfc
[0.0] pic: Setting mask of slave PIC to 0xff
[0.0] main: Prepared PIC
[0.0] pit: Configuring PIT to use divisor 1193 (will tick 1000 times per second)
[0.0] main: Prepared PIT
[0.0] main: Prepared scheduler
[0.0] sched: Adding kernel task: starts at ffffffffffe04a64, tid 2, stack at fffffffff8056ff8, total tasks: 2
[0.0] main: Loading demo: memory eating program
[0.0] sched: Loading user task: bin/memeater
[0.0] elf: Loading loadable segment at address 400000, file size 18720, mem size 18720, permissions r-x
[0.0] elf: Loading loadable segment at address 405920, file size 40, mem size 208, permissions rw-
[0.0] sched: Adding user task: loaded at 4000d0, tid 3, stack at fffffffff805aff8, total tasks: 3
[0.0] main: Prepared scheduler tasks
Booting OS...
 * Detecting CPU

Since this message is the last one printed before enabling interrupts/switching tasks, I believe something is going wrong there. The weird thing is it only happens sometimes, and it doesn't seem to depend on the program loaded, since just after it restarts (in this case) it loaded the same and it went fine.

Additionally, this bug is present since forever.

Sometimes, on boot, the system randomly restarts after enabling interrupts (I believe). ``` [0.0] main: Loaded IDT [0.0] pic: Remapping PIC [0.0] pic: Remapping master PIC to ISRs 32-39 [0.0] pic: Remapping slave PIC to ISRs 40-47 [0.0] pic: Setting mask of master PIC to 0xfc [0.0] pic: Setting mask of slave PIC to 0xff [0.0] main: Prepared PIC [0.0] pit: Configuring PIT to use divisor 1193 (will tick 1000 times per second) [0.0] main: Prepared PIT [0.0] main: Prepared scheduler [0.0] sched: Adding kernel task: starts at ffffffffffe04a64, tid 2, stack at fffffffff8056ff8, total tasks: 2 [0.0] main: Loading demo: memory eating program [0.0] sched: Loading user task: bin/memeater [0.0] elf: Loading loadable segment at address 400000, file size 18720, mem size 18720, permissions r-x [0.0] elf: Loading loadable segment at address 405920, file size 40, mem size 208, permissions rw- [0.0] sched: Adding user task: loaded at 4000d0, tid 3, stack at fffffffff805aff8, total tasks: 3 [0.0] main: Prepared scheduler tasks Booting OS... * Detecting CPU ``` Since this message is the last one printed before enabling interrupts/switching tasks, I believe something is going wrong there. The weird thing is it only happens sometimes, and it doesn't seem to depend on the program loaded, since just after it restarts (in this case) it loaded the same and it went fine. Additionally, this bug is present since forever.
apio added the
bug
label 2022-10-08 12:22:53 +00:00
apio self-assigned this 2022-10-08 12:22:53 +00:00
Author
Owner

I think this is caused by too many interrupts piling up, and when we enable them, they overflow us (probably the stack?) and triple fault.

Not sure about this, but since I changed (in #12, WIP) main.cpp to initialize the PIC just before we enable interrupts, it happens a lot less. Should investigate more though.

I think this is caused by too many interrupts piling up, and when we enable them, they overflow us (probably the stack?) and triple fault. Not sure about this, but since I changed (in #12, WIP) main.cpp to initialize the PIC just before we enable interrupts, it happens a lot less. Should investigate more though.
Author
Owner

This is pretty much solved now.

This is pretty much solved now.
apio closed this issue 2022-10-16 17:10:16 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: apio/Luna#7
No description provided.