From: Tomas Hruby Date: Tue, 9 Feb 2010 15:22:43 +0000 (+0000) Subject: No CLOCK task X-Git-Tag: v3.1.7~300 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/invmod.png?a=commitdiff_plain;h=ebba20a65d3354c3b77d1e092b9ffa02862c6649;p=minix.git No CLOCK task - no kernel tasks are runnable - clock initialization moved to the end of main() - the rest of the body of clock_task() is moved to bsp_timer_int_handler() as for now we are going to handle this on the bootstrap cpu. A change later is possible. --- diff --git a/kernel/clock.c b/kernel/clock.c index a3f6e4c9b..7ffe414de 100644 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -42,7 +42,6 @@ /* 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 operate on this. @@ -59,51 +58,10 @@ PRIVATE clock_t next_timeout; /* realtime that next timer expires */ */ 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. @@ -134,7 +92,9 @@ PUBLIC int bsp_timer_int_handler(void) /* 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) diff --git a/kernel/main.c b/kernel/main.c index 0f67f0f96..d1f82a311 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -199,12 +199,8 @@ PUBLIC void main() 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); } @@ -214,6 +210,8 @@ PUBLIC void main() /* System and processes initialization */ system_init(); + /* Initialize timers handling */ + clock_init(); #if SPROFILE sprofiling = 0; /* we're not profiling until instructed to */ diff --git a/kernel/proto.h b/kernel/proto.h index 219333ff9..d856fcce8 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -12,7 +12,7 @@ struct proc; 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) ); diff --git a/kernel/table.c b/kernel/table.c index 760d9328c..04d0f20d9 100644 --- a/kernel/table.c +++ b/kernel/table.c @@ -62,7 +62,7 @@ PUBLIC char *t_stack[TOT_STACK_SPACE / sizeof(char *)]; 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" },