*enable* interrupts before waiting for hlt instruction...
[AROS.git] / arch / all-pc / exec / exec_idle.c
blob06d323f3cc719875312ef0063b4f25a7162b6f22
1 /*
2 Copyright � 2015-2017, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
8 #include <proto/exec.h>
10 #define __AROS_KERNEL__
12 #include "exec_intern.h"
14 #include "etask.h"
16 void sleep_function()
18 asm volatile ("sti; hlt;");
21 void IdleTask(struct ExecBase *SysBase)
24 struct Task *thisTask = FindTask(NULL);
25 struct IntETask *taskIntEtask;
26 int cpunum = KrnGetCPUNumber();
27 ULONG lastcount = 0, current;
29 bug("[IDLE:%03d] %s task started\n", cpunum, thisTask->tc_Node.ln_Name);
34 /* forever */
36 Supervisor(sleep_function);
39 if ((taskIntEtask = GetIntETask(thisTask)) != NULL)
41 current = taskIntEtask->iet_CpuTime.tv_secs;
42 if (current != lastcount)
44 lastcount = current;
45 bug("[IDLE:%03d] CPU has idled for %d seconds..\n", cpunum, lastcount);
48 else
50 bug("[IDLE:%03d] Failed to get IntETask\n", cpunum);
53 } while(1);