From: Ben Gras Date: Thu, 11 Dec 2008 14:15:23 +0000 (+0000) Subject: . replace HZ by runtime system_hz (sysenv variable 'hz') X-Git-Tag: v3.1.4~209 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/verify-sign/verify.pl?a=commitdiff_plain;h=c4fb567bd522b9670138298959a8424e45cbf12c;p=minix.git . replace HZ by runtime system_hz (sysenv variable 'hz') . new flag PROC_FULLVM in table indicating process wants full address space (this is then created and managed by VM) --- diff --git a/kernel/arch/i386/clock.c b/kernel/arch/i386/clock.c index 6c7f5060d..530236ff3 100755 --- a/kernel/arch/i386/clock.c +++ b/kernel/arch/i386/clock.c @@ -14,7 +14,7 @@ #define SQUARE_WAVE 0x36 /* ccaammmb, a = access, m = mode, b = BCD */ /* 11x11, 11 = LSB then MSB, x11 = sq wave */ #define TIMER_FREQ 1193182 /* clock frequency for timer in PC and AT */ -#define TIMER_COUNT (TIMER_FREQ/HZ) /* initial value for counter*/ +#define TIMER_COUNT (TIMER_FREQ/system_hz) /* initial value for counter*/ /*===========================================================================* * arch_init_clock * diff --git a/kernel/clock.c b/kernel/clock.c index 7124a8588..9d8e56807 100755 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -280,7 +280,7 @@ PRIVATE void load_update(void) * be made of the load average over variable periods, in the * user library (see getloadavg(3)). */ - slot = (realtime / HZ / _LOAD_UNIT_SECS) % _LOAD_HISTORY; + slot = (realtime / system_hz / _LOAD_UNIT_SECS) % _LOAD_HISTORY; if(slot != kloadinfo.proc_last_slot) { kloadinfo.proc_load_history[slot] = 0; kloadinfo.proc_last_slot = slot; diff --git a/kernel/main.c b/kernel/main.c index 00aa32d14..800ce28a4 100755 --- a/kernel/main.c +++ b/kernel/main.c @@ -37,6 +37,8 @@ PUBLIC void main() reg_t ktsb; /* kernel task stack base */ struct exec e_hdr; /* for a copy of an a.out header */ + do_serial_debug=0; + /* Clear the process table. Anounce each slot as empty and set up mappings * for proc_addr() and proc_nr() macros. Do the same for the table with * privilege structures for the system processes. @@ -153,6 +155,13 @@ PUBLIC void main() rp->p_memmap[S].mem_len) << CLICK_SHIFT; rp->p_reg.sp -= sizeof(reg_t); } + + /* If this process has its own page table, VM will set the + * PT up and manage it. VM will signal the kernel when it has + * done this; until then, don't let it run. + */ + if(priv(rp)->s_flags & PROC_FULLVM) + RTS_SET(rp, VMINHIBIT); /* Set ready. The HARDWARE task is never ready. */ if (rp->p_nr == HARDWARE) RTS_SET(rp, NO_PRIORITY); @@ -210,7 +219,7 @@ int how; */ kprintf("MINIX will now be shut down ...\n"); tmr_arg(&shutdown_timer)->ta_int = how; - set_timer(&shutdown_timer, get_uptime() + 5*HZ, minix_shutdown); + set_timer(&shutdown_timer, get_uptime() + system_hz, minix_shutdown); } /*===========================================================================* diff --git a/kernel/start.c b/kernel/start.c index 36b27d585..b2cb09a43 100755 --- a/kernel/start.c +++ b/kernel/start.c @@ -65,6 +65,13 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */ if (strcmp(value, "ega") == 0) machine.vdu_ega = TRUE; if (strcmp(value, "vga") == 0) machine.vdu_vga = machine.vdu_ega = TRUE; + /* Get clock tick frequency. */ + value = get_value(params_buffer, "hz"); + if(value) + system_hz = atoi(value); + if(!value || system_hz < 2 || system_hz > 50000) /* sanity check */ + system_hz = DEFAULT_HZ; + /* Return to assembler code to switch to protected mode (if 286), * reload selectors and call main(). */ diff --git a/kernel/system/do_getinfo.c b/kernel/system/do_getinfo.c index 433e49fc0..6f01e0582 100644 --- a/kernel/system/do_getinfo.c +++ b/kernel/system/do_getinfo.c @@ -26,7 +26,7 @@ register message *m_ptr; /* pointer to request message */ */ size_t length; vir_bytes src_vir; - int proc_nr, nr_e, nr, hz; + int proc_nr, nr_e, nr; struct proc *caller; phys_bytes ph; @@ -50,9 +50,8 @@ register message *m_ptr; /* pointer to request message */ break; } case GET_HZ: { - length = sizeof(hz); - src_vir = (vir_bytes) &hz; - hz = HZ; + length = sizeof(system_hz); + src_vir = (vir_bytes) &system_hz; break; } case GET_IMAGE: { @@ -99,7 +98,7 @@ register message *m_ptr; /* pointer to request message */ case GET_WHOAMI: { int len; /* GET_WHOAMI uses m3 and only uses the message contents for info. */ - m_ptr->GIWHO_EP = who_e; + m_ptr->GIWHO_EP = caller->p_endpoint; len = MIN(sizeof(m_ptr->GIWHO_NAME), sizeof(caller->p_name))-1; strncpy(m_ptr->GIWHO_NAME, caller->p_name, len); m_ptr->GIWHO_NAME[len] = '\0';