proc_init()
- code that initializes proc.c structures removed from main() and placed in proc_init() function
This commit is contained in:
parent
ce4fd0c0fb
commit
2a2a19e542
@ -32,7 +32,6 @@ PUBLIC int main(void)
|
|||||||
/* Start the ball rolling. */
|
/* Start the ball rolling. */
|
||||||
struct boot_image *ip; /* boot image pointer */
|
struct boot_image *ip; /* boot image pointer */
|
||||||
register struct proc *rp; /* process pointer */
|
register struct proc *rp; /* process pointer */
|
||||||
register struct priv *sp; /* privilege structure pointer */
|
|
||||||
register int i, j;
|
register int i, j;
|
||||||
int hdrindex; /* index to array of a.out headers */
|
int hdrindex; /* index to array of a.out headers */
|
||||||
phys_clicks text_base;
|
phys_clicks text_base;
|
||||||
@ -46,26 +45,7 @@ PUBLIC int main(void)
|
|||||||
|
|
||||||
DEBUGEXTRA(("main()\n"));
|
DEBUGEXTRA(("main()\n"));
|
||||||
|
|
||||||
/* Clear the process table. Anounce each slot as empty and set up mappings
|
proc_init();
|
||||||
* for proc_addr() and proc_nr() macros. Do the same for the table with
|
|
||||||
* privilege structures for the system processes.
|
|
||||||
*/
|
|
||||||
for (rp = BEG_PROC_ADDR, i = -NR_TASKS; rp < END_PROC_ADDR; ++rp, ++i) {
|
|
||||||
rp->p_rts_flags = RTS_SLOT_FREE; /* initialize free slot */
|
|
||||||
rp->p_magic = PMAGIC;
|
|
||||||
rp->p_nr = i; /* proc number from ptr */
|
|
||||||
rp->p_endpoint = _ENDPOINT(0, rp->p_nr); /* generation no. 0 */
|
|
||||||
rp->p_scheduler = NULL; /* no user space scheduler */
|
|
||||||
rp->p_priority = 0; /* no priority */
|
|
||||||
rp->p_quantum_size_ms = 0; /* no quantum size */
|
|
||||||
}
|
|
||||||
for (sp = BEG_PRIV_ADDR, i = 0; sp < END_PRIV_ADDR; ++sp, ++i) {
|
|
||||||
sp->s_proc_nr = NONE; /* initialize as free */
|
|
||||||
sp->s_id = (sys_id_t) i; /* priv structure index */
|
|
||||||
ppriv_addr[i] = sp; /* priv ptr from number */
|
|
||||||
sp->s_sig_mgr = NONE; /* clear signal managers */
|
|
||||||
sp->s_bak_sig_mgr = NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up proc table entries for processes in boot image. The stacks of the
|
/* Set up proc table entries for processes in boot image. The stacks of the
|
||||||
* kernel tasks are initialized to an array in data space. The stacks
|
* kernel tasks are initialized to an array in data space. The stacks
|
||||||
|
@ -79,6 +79,34 @@ FORWARD _PROTOTYPE( void enqueue_head, (struct proc *rp));
|
|||||||
break; \
|
break; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PUBLIC void proc_init(void)
|
||||||
|
{
|
||||||
|
struct proc * rp;
|
||||||
|
struct priv *sp;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
for (rp = BEG_PROC_ADDR, i = -NR_TASKS; rp < END_PROC_ADDR; ++rp, ++i) {
|
||||||
|
rp->p_rts_flags = RTS_SLOT_FREE;/* initialize free slot */
|
||||||
|
rp->p_magic = PMAGIC;
|
||||||
|
rp->p_nr = i; /* proc number from ptr */
|
||||||
|
rp->p_endpoint = _ENDPOINT(0, rp->p_nr); /* generation no. 0 */
|
||||||
|
rp->p_scheduler = NULL; /* no user space scheduler */
|
||||||
|
rp->p_priority = 0; /* no priority */
|
||||||
|
rp->p_quantum_size_ms = 0; /* no quantum size */
|
||||||
|
}
|
||||||
|
for (sp = BEG_PRIV_ADDR, i = 0; sp < END_PRIV_ADDR; ++sp, ++i) {
|
||||||
|
sp->s_proc_nr = NONE; /* initialize as free */
|
||||||
|
sp->s_id = (sys_id_t) i; /* priv structure index */
|
||||||
|
ppriv_addr[i] = sp; /* priv ptr from number */
|
||||||
|
sp->s_sig_mgr = NONE; /* clear signal managers */
|
||||||
|
sp->s_bak_sig_mgr = NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* idle *
|
* idle *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
@ -41,6 +41,7 @@ _PROTOTYPE( __dead void minix_shutdown, (struct timer *tp) );
|
|||||||
/* proc.c */
|
/* proc.c */
|
||||||
|
|
||||||
_PROTOTYPE( int do_ipc, (reg_t r1, reg_t r2, reg_t r3) );
|
_PROTOTYPE( int do_ipc, (reg_t r1, reg_t r2, reg_t r3) );
|
||||||
|
_PROTOTYPE( void proc_init, (void) );
|
||||||
_PROTOTYPE( int mini_notify, (const struct proc *src, endpoint_t dst) );
|
_PROTOTYPE( int mini_notify, (const struct proc *src, endpoint_t dst) );
|
||||||
_PROTOTYPE( void enqueue, (struct proc *rp) );
|
_PROTOTYPE( void enqueue, (struct proc *rp) );
|
||||||
_PROTOTYPE( void dequeue, (const struct proc *rp) );
|
_PROTOTYPE( void dequeue, (const struct proc *rp) );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user