. 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)
This commit is contained in:
Ben Gras 2008-12-11 14:15:23 +00:00
parent afef5e0711
commit c4fb567bd5
5 changed files with 23 additions and 8 deletions

View File

@ -14,7 +14,7 @@
#define SQUARE_WAVE 0x36 /* ccaammmb, a = access, m = mode, b = BCD */ #define SQUARE_WAVE 0x36 /* ccaammmb, a = access, m = mode, b = BCD */
/* 11x11, 11 = LSB then MSB, x11 = sq wave */ /* 11x11, 11 = LSB then MSB, x11 = sq wave */
#define TIMER_FREQ 1193182 /* clock frequency for timer in PC and AT */ #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 * * arch_init_clock *

View File

@ -280,7 +280,7 @@ PRIVATE void load_update(void)
* be made of the load average over variable periods, in the * be made of the load average over variable periods, in the
* user library (see getloadavg(3)). * 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) { if(slot != kloadinfo.proc_last_slot) {
kloadinfo.proc_load_history[slot] = 0; kloadinfo.proc_load_history[slot] = 0;
kloadinfo.proc_last_slot = slot; kloadinfo.proc_last_slot = slot;

View File

@ -37,6 +37,8 @@ PUBLIC void main()
reg_t ktsb; /* kernel task stack base */ reg_t ktsb; /* kernel task stack base */
struct exec e_hdr; /* for a copy of an a.out header */ 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 /* 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 * for proc_addr() and proc_nr() macros. Do the same for the table with
* privilege structures for the system processes. * privilege structures for the system processes.
@ -154,6 +156,13 @@ PUBLIC void main()
rp->p_reg.sp -= sizeof(reg_t); 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. */ /* Set ready. The HARDWARE task is never ready. */
if (rp->p_nr == HARDWARE) RTS_SET(rp, NO_PRIORITY); if (rp->p_nr == HARDWARE) RTS_SET(rp, NO_PRIORITY);
RTS_UNSET(rp, SLOT_FREE); /* remove SLOT_FREE and schedule */ RTS_UNSET(rp, SLOT_FREE); /* remove SLOT_FREE and schedule */
@ -210,7 +219,7 @@ int how;
*/ */
kprintf("MINIX will now be shut down ...\n"); kprintf("MINIX will now be shut down ...\n");
tmr_arg(&shutdown_timer)->ta_int = how; 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);
} }
/*===========================================================================* /*===========================================================================*

View File

@ -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, "ega") == 0) machine.vdu_ega = TRUE;
if (strcmp(value, "vga") == 0) machine.vdu_vga = 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), /* Return to assembler code to switch to protected mode (if 286),
* reload selectors and call main(). * reload selectors and call main().
*/ */

View File

@ -26,7 +26,7 @@ register message *m_ptr; /* pointer to request message */
*/ */
size_t length; size_t length;
vir_bytes src_vir; vir_bytes src_vir;
int proc_nr, nr_e, nr, hz; int proc_nr, nr_e, nr;
struct proc *caller; struct proc *caller;
phys_bytes ph; phys_bytes ph;
@ -50,9 +50,8 @@ register message *m_ptr; /* pointer to request message */
break; break;
} }
case GET_HZ: { case GET_HZ: {
length = sizeof(hz); length = sizeof(system_hz);
src_vir = (vir_bytes) &hz; src_vir = (vir_bytes) &system_hz;
hz = HZ;
break; break;
} }
case GET_IMAGE: { case GET_IMAGE: {
@ -99,7 +98,7 @@ register message *m_ptr; /* pointer to request message */
case GET_WHOAMI: { case GET_WHOAMI: {
int len; int len;
/* GET_WHOAMI uses m3 and only uses the message contents for info. */ /* 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; len = MIN(sizeof(m_ptr->GIWHO_NAME), sizeof(caller->p_name))-1;
strncpy(m_ptr->GIWHO_NAME, caller->p_name, len); strncpy(m_ptr->GIWHO_NAME, caller->p_name, len);
m_ptr->GIWHO_NAME[len] = '\0'; m_ptr->GIWHO_NAME[len] = '\0';