revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-pc / exec / exec_idle.c
blob8da4bbc803911929ddd6030e666d36406233fd10
1 /*
2 Copyright © 2015-2018, 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 IdleTask(struct ExecBase *SysBase)
19 struct Task *thisTask = FindTask(NULL);
20 struct IntETask *taskIntEtask;
21 int cpunum = KrnGetCPUNumber();
22 ULONG lastcount = 0, current;
24 bug("[IDLE:%03d] %s task started\n", cpunum, thisTask->tc_Node.ln_Name);
29 /* forever */
31 // Call sleep function (which enables interrupts, sleeps CPU until interrupt comes and then returns)
32 krnSysCallChangePMState(0x90);
34 // After SLEEP_FUNCTION returned nothing was rescheduled. Reschedule now...
35 Reschedule();
38 if ((taskIntEtask = GetIntETask(thisTask)) != NULL)
40 current = taskIntEtask->iet_CpuTime.tv_sec;
41 if (current != lastcount)
43 lastcount = current;
44 bug("[IDLE:%03d] CPU has idled for %d seconds\n", cpunum, lastcount);
47 else
49 bug("[IDLE:%03d] Failed to get IntETask\n", cpunum);
52 } while(1);