From 60bd8d9418fa630098f13a129bc9bbd62b42833e Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 9 Nov 2022 15:58:00 +0100 Subject: [PATCH] Kernel: Add an explanatory comment to the end of _start() --- kernel/src/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/src/main.cpp b/kernel/src/main.cpp index da7024ef..7ff4b2aa 100644 --- a/kernel/src/main.cpp +++ b/kernel/src/main.cpp @@ -78,5 +78,10 @@ extern "C" void _start() Interrupts::enable(); - while (1) halt(); + while (1) + halt(); // As soon as the first timer interrupt arrives, this idle loop is gone, since the main function is not + // registered as a task and thus the scheduler will never schedule this again. We still have to do + // something while waiting for a timer interrupt to arrive, though. In fact, in most cases, calling + // halt() once would be enough, since that function halts the CPU until the next interrupt (most likely + // the timer one) arrives. But we have to guarantee this function never returns. } \ No newline at end of file