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.
This commit is contained in:
parent
728f0f0c49
commit
ebba20a65d
4 changed files with 10 additions and 52 deletions
|
@ -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 <timers.h> 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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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) );
|
||||
|
|
|
@ -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" },
|
||||
|
|
Loading…
Reference in a new issue