From 36a3989842bf813bd807a0be6ba6f6ebee684872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Fri, 22 Nov 2024 16:14:25 +0100 Subject: [PATCH] Add a 'wfi' instruction on the main loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The actual work is done somewhere else, there is no need to constantly run the main thread. Signed-off-by: Miquel Sabaté Solà --- kernel/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/main.c b/kernel/main.c index 9cdb61e..ec8fabd 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -32,6 +32,9 @@ __noreturn __kernel void start_kernel(void *dtb) seconds_elapsed = 0; setup_interrupts(); - for (;;) - ; + for (;;) { + // Put the machine on low power consumption since we are not doing + // anything fancy here. + asm volatile("wfi"); + } }