/* Function prototype for PRIVATE functions.
*/
-FORWARD _PROTOTYPE( void init_clock, (void) );
FORWARD _PROTOTYPE( void load_update, (void));
/* The CLOCK's timers queue. The functions in <timers.h> operate on this.
*/
PRIVATE clock_t realtime = 0; /* real time clock */
-/*===========================================================================*
- * clock_task *
- *===========================================================================*/
-PUBLIC void clock_task()
-{
-/* Main program of clock task. If the call is not HARD_INT it is an error.
- */
- message m; /* message buffer for both input and output */
- int result; /* result returned by the handler */
-
- init_clock(); /* initialize clock task */
-
- /* Main loop of the clock task. Get work, process it. Never reply. */
- while(TRUE) {
- /* Go get a message. */
- result = receive(ANY, &m);
-
- if(result != OK)
- minix_panic("receive() failed", result);
-
- /* Handle the request. Only clock ticks are expected. */
- if (is_notify(m.m_type)) {
- switch (_ENDPOINT_P(m.m_source)) {
- case HARDWARE:
- tmrs_exptimers(&clock_timers, realtime, NULL);
- next_timeout = (clock_timers == NULL) ?
- TMR_NEVER : clock_timers->tmr_exp_time;
- break;
- default: /* illegal request type */
- kprintf("CLOCK: illegal notify %d from %d.\n",
- m.m_type, m.m_source);
- }
- }
- else {
- /* illegal request type */
- kprintf("CLOCK: illegal request %d from %d.\n",
- m.m_type, m.m_source);
- }
- }
-}
-
/*===========================================================================*
* init_clock *
*===========================================================================*/
-PRIVATE void init_clock()
+PUBLIC void clock_init()
{
/* Set a watchdog timer to periodically balance the scheduling queues.
/* if a timer expired, notify the clock task */
if ((next_timeout <= realtime)) {
- mini_notify(proc_addr(HARDWARE), CLOCK); /* send notification */
+ tmrs_exptimers(&clock_timers, realtime, NULL);
+ next_timeout = (clock_timers == NULL) ?
+ TMR_NEVER : clock_timers->tmr_exp_time;
}
if (do_serial_debug)
if(ip->flags & PROC_FULLVM)
RTS_SET(rp, RTS_VMINHIBIT);
- /* Set ready. The HARDWARE task is never ready. */
- if (rp->p_nr == HARDWARE) RTS_SET(rp, RTS_PROC_STOP);
- /* IDLE task is never put on a run queue as it is never ready to run */
- if (rp->p_nr == IDLE) RTS_SET(rp, RTS_PROC_STOP);
- /* SYSTEM does not run anymore */
- if (rp->p_nr == SYSTEM) RTS_SET(rp, RTS_PROC_STOP);
+ /* None of the kernel tasks run */
+ if (rp->p_nr < 0) RTS_SET(rp, RTS_PROC_STOP);
RTS_UNSET(rp, RTS_SLOT_FREE); /* remove RTS_SLOT_FREE and schedule */
alloc_segments(rp);
}
/* System and processes initialization */
system_init();
+ /* Initialize timers handling */
+ clock_init();
#if SPROFILE
sprofiling = 0; /* we're not profiling until instructed to */
struct timer;
/* clock.c */
-_PROTOTYPE( void clock_task, (void) );
+_PROTOTYPE( void clock_init, (void) );
_PROTOTYPE( clock_t get_uptime, (void) );
_PROTOTYPE( void set_timer, (struct timer *tp, clock_t t, tmr_func_t f) );
_PROTOTYPE( void reset_timer, (struct timer *tp) );
PUBLIC struct boot_image image[] = {
/* process nr, pc, flags, qs, queue, stack, name */
{IDLE, NULL, 0, 0, 0, IDL_S, "idle" },
-{CLOCK,clock_task, 0, 8, TASK_Q, TSK_S, "clock" },
+{CLOCK, NULL, 0, 0, 0, IDL_S, "clock" },
{SYSTEM, NULL, 0, 0, 0, IDL_S, "system"},
{HARDWARE, 0, 0, 8, TASK_Q, HRD_S, "kernel"},
{PM_PROC_NR, 0, 0, 32, 4, 0, "pm" },