minix/fslib.h minix/ioctl.h minix/ipc.h minix/ipcconst.h \
minix/keymap.h minix/minlib.h minix/mq.h \
minix/netdriver.h minix/partition.h minix/paths.h \
- minix/portio.h minix/profile.h minix/queryparam.h \
+ minix/portio.h minix/priv.h minix/profile.h minix/queryparam.h \
minix/rs.h minix/safecopies.h minix/sched.h minix/sef.h minix/sound.h \
minix/spin.h minix/sys_config.h minix/sysinfo.h minix/syslib.h \
minix/sysutil.h minix/timers.h minix/tty.h minix/type.h minix/types.h \
#define SYS_STATE_CLEAR_IPC_REFS 1 /* clear IPC references */
/* Subfunctions for SYS_SCHEDCTL */
-#define SCHEDCTL_FLAGS m1_i1 /* flags for setting the scheduler */
+#define SCHEDCTL_FLAGS m9_l1 /* flags for setting the scheduler */
# define SCHEDCTL_FLAG_KERNEL 1 /* mark kernel scheduler and remove
* RTS_NO_QUANTUM; otherwise caller is
* marked scheduler
*/
-#define SCHEDCTL_ENDPOINT m1_i2 /* endpt of process to be scheduled */
+#define SCHEDCTL_ENDPOINT m9_l2 /* endpt of process to be scheduled */
+#define SCHEDCTL_QUANTUM m9_l3 /* current scheduling quantum */
+#define SCHEDCTL_PRIORITY m9_s4 /* current scheduling priority */
/*===========================================================================*
* Messages for the Reincarnation Server *
/* This feature enable the counting of system calls in PM and FS */
#define ENABLE_SYSCALL_STATS 0
+/* Max. number of I/O ranges that can be assigned to a process */
+#define NR_IO_RANGE 64
+
+/* Max. number of device memory ranges that can be assigned to a process */
+#define NR_MEM_RANGE 20
+
+/* Max. number of IRQs that can be assigned to a process */
+#define NR_IRQ 8
+
+/* Scheduling priorities. Values must start at zero (highest
+ * priority) and increment.
+ */
+#define NR_SCHED_QUEUES 16 /* MUST equal minimum priority + 1 */
+#define TASK_Q 0 /* highest, used for kernel tasks */
+#define MAX_USER_Q 0 /* highest priority for user processes */
+#define USER_Q ((MIN_USER_Q - MAX_USER_Q) / 2 + MAX_USER_Q) /* default
+ (should correspond to nice 0) */
+#define MIN_USER_Q (NR_SCHED_QUEUES - 1) /* minimum priority for user
+ processes */
+/* default scheduling quanta */
+#define USER_QUANTUM 200
+
/*===========================================================================*
* There are no user-settable parameters after this line *
*===========================================================================*/
--- /dev/null
+/* Privilege-related definitions. */
+
+#ifndef _MINIX_PRIV_H
+#define _MINIX_PRIV_H
+
+#include <minix/com.h>
+#include <minix/config.h>
+
+/* scheduler */
+#define SRV_SCH KERNEL /* system services */
+#define DSRV_SCH SCHED_PROC_NR /* dynamic system services */
+#define USR_SCH NONE /* user processes */
+
+/* scheduling priority queue. */
+#define SRV_Q USER_Q /* system services */
+#define DSRV_Q USER_Q /* dynamic system services */
+#define USR_Q USER_Q /* user processes */
+
+/* scheduling quantum. */
+#define SRV_QT USER_QUANTUM /* system services */
+#define DSRV_QT USER_QUANTUM /* dynamic system services */
+#define USR_QT USER_QUANTUM /* user processes */
+
+#endif /* _MINIX_PRIV_H */
_PROTOTYPE( int sys_trace, (int req, endpoint_t proc_ep, long addr, long *data_p));
_PROTOTYPE( int sys_schedule, (endpoint_t proc_ep, unsigned priority, unsigned quantum));
-_PROTOTYPE( int sys_schedctl, (unsigned flags, endpoint_t proc_ep));
+_PROTOTYPE( int sys_schedctl, (unsigned flags, endpoint_t proc_ep,
+ unsigned priority, unsigned quantum));
/* Shorthands for sys_runctl() system call. */
#define sys_stop(proc_ep) sys_runctl(proc_ep, RC_STOP, 0)
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 */
DEBUGEXTRA(("initializing %s... ", ip->proc_name));
rp = proc_addr(ip->proc_nr); /* get process pointer */
ip->endpoint = rp->p_endpoint; /* ipc endpoint */
- rp->p_scheduler = NULL; /* no user space scheduler */
- rp->p_priority = ip->priority; /* current priority */
- rp->p_quantum_size_ms = ip->quantum; /* quantum size */
make_zero64(rp->p_cpu_time_left);
strncpy(rp->p_name, ip->proc_name, P_NAME_LEN); /* set process name */
kcalls = RSYS_KC; /* allowed kernel calls */
priv(rp)->s_sig_mgr = RSYS_SM; /* signal manager */
priv(rp)->s_bak_sig_mgr = NONE; /* backup signal manager */
+ rp->p_priority = SRV_Q; /* priority queue */
+ rp->p_quantum_size_ms = SRV_QT; /* quantum size */
}
/* Priviliges for ordinary process. */
else {
*/
#include <minix/com.h>
#include <minix/const.h>
+#include <minix/priv.h>
#include "const.h"
#include "type.h"
-/* Max. number of I/O ranges that can be assigned to a process */
-#define NR_IO_RANGE 64
-
-/* Max. number of device memory ranges that can be assigned to a process */
-#define NR_MEM_RANGE 20
-
-/* Max. number of IRQs that can be assigned to a process */
-#define NR_IRQ 8
-
struct priv {
proc_nr_t s_proc_nr; /* number of associated process */
sys_id_t s_id; /* index of this system structure */
#define RSYS_SM SELF /* root system proc */
#define DEF_SYS_SM ROOT_SYS_PROC_NR /* default sys proc */
-/* scheduler */
-#define KERN_SCH KERNEL /* scheduled by kernel */
-#define USER_SCH SCHED_PROC_NR /* scheduled in userland */
-
#endif /* PRIV_H */
* regs are significant (initialized)*/
#define MF_SENDING_FROM_KERNEL 0x2000 /* message of this process is from kernel */
-/* Scheduling priorities for p_priority. Values must start at zero (highest
- * priority) and increment. Priorities of the processes in the boot image
- * can be set in table.c.
- */
-#define NR_SCHED_QUEUES 16 /* MUST equal minimum priority + 1 */
-#define TASK_Q 0 /* highest, used for kernel tasks */
-#define MAX_USER_Q 0 /* highest priority for user processes */
-#define USER_Q ((MIN_USER_Q - MAX_USER_Q) / 2 + MAX_USER_Q) /* default
- (should correspond to nice 0) */
-#define MIN_USER_Q (NR_SCHED_QUEUES - 1) /* minimum priority for user
- processes */
-/* default scheduling quanta */
-#define USER_QUANTUM 200
-#define DRIV_QUANTUM 50
-#define SERV_QUANTUM 500
-
/* Magic process table addresses. */
#define BEG_PROC_ADDR (&proc[0])
#define BEG_USER_ADDR (&proc[NR_TASKS])
_PROTOTYPE( void clear_ipc_refs, (struct proc *rc, int caller_ret) );
_PROTOTYPE( phys_bytes umap_bios, (vir_bytes vir_addr, vir_bytes bytes));
_PROTOTYPE( void kernel_call_resume, (struct proc *p));
+_PROTOTYPE( int sched_proc, (struct proc *rp,
+ unsigned priority, unsigned quantum));
/* system/do_newmap.c */
_PROTOTYPE( int newmap, (struct proc * caller, struct proc *rp,
* umap_bios: map virtual address in BIOS_SEG to physical
* get_randomness: accumulate randomness in a buffer
* clear_endpoint: remove a process' ability to send and receive messages
+ * sched_proc: schedule a process
*
* Changes:
* Nov 22, 2009 get_priv supports static priv ids (Cristiano Giuffrida)
#include "system.h"
#include "proc.h"
#include "vm.h"
+#include "kernel/clock.h"
#include <stdlib.h>
#include <assert.h>
#include <signal.h>
caller->p_misc_flags &= ~MF_KCALL_RESUME;
kernel_call_finish(caller, &caller->p_vmrequest.saved.reqmsg, result);
}
+
+/*===========================================================================*
+ * sched_proc *
+ *===========================================================================*/
+PUBLIC int sched_proc(struct proc *rp, unsigned priority, unsigned quantum)
+{
+ /* Make sure the priority number given is within the allowed range.*/
+ if (priority < TASK_Q || priority > NR_SCHED_QUEUES)
+ return EINVAL;
+
+ /* Make sure the quantum given is within the allowed range.*/
+ if(quantum <= 0)
+ return EINVAL;
+
+ /* In some cases, we might be rescheduling a runnable process. In such
+ * a case (i.e. if we are updating the priority) we set the NO_QUANTUM
+ * flag before the generic unset to dequeue/enqueue the process
+ */
+ if (proc_is_runnable(rp))
+ RTS_SET(rp, RTS_NO_QUANTUM);
+
+ /* Clear the scheduling bit and enqueue the process */
+ rp->p_priority = priority;
+ rp->p_quantum_size_ms = quantum;
+ rp->p_cpu_time_left = ms_2_cpu_time(quantum);
+
+ RTS_UNSET(rp, RTS_NO_QUANTUM);
+
+ return OK;
+}
+
{
struct proc *p;
unsigned flags;
+ unsigned priority, quantum;
int proc_nr;
-
- /* Only system processes can change process schedulers */
- if (! (priv(caller)->s_flags & SYS_PROC))
- return(EPERM);
+ int r;
/* check parameter validity */
flags = (unsigned) m_ptr->SCHEDCTL_FLAGS;
if ((flags & SCHEDCTL_FLAG_KERNEL) == SCHEDCTL_FLAG_KERNEL) {
/* the kernel becomes the scheduler and starts
- * scheduling the process; RTS_NO_QUANTUM which was
- * previously set by sys_fork is removed
+ * scheduling the process.
*/
+ priority = (unsigned) m_ptr->SCHEDCTL_PRIORITY;
+ quantum = (unsigned) m_ptr->SCHEDCTL_QUANTUM;
+
+ /* Try to schedule the process. */
+ if((r = sched_proc(p, priority, quantum) != OK))
+ return r;
p->p_scheduler = NULL;
- RTS_UNSET(p, RTS_NO_QUANTUM);
} else {
/* the caller becomes the scheduler */
p->p_scheduler = caller;
{
struct proc *p;
int proc_nr;
+ unsigned priority, quantum;
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
return EINVAL;
if (caller != p->p_scheduler)
return(EPERM);
- /* Make sure the priority number given is within the allowed range.*/
- if (m_ptr->SCHEDULING_PRIORITY < TASK_Q ||
- m_ptr->SCHEDULING_PRIORITY > NR_SCHED_QUEUES)
- return(EINVAL);
-
- /* In some cases, we might be rescheduling a runnable process. In such
- * a case (i.e. if we are updating the priority) we set the NO_QUANTUM
- * flag before the generic unset to dequeue/enqueue the process
- */
- if (proc_is_runnable(p))
- RTS_SET(p, RTS_NO_QUANTUM);
-
- /* Clear the scheduling bit and enqueue the process */
- p->p_priority = m_ptr->SCHEDULING_PRIORITY;
- p->p_quantum_size_ms = m_ptr->SCHEDULING_QUANTUM;
- p->p_cpu_time_left = ms_2_cpu_time(m_ptr->SCHEDULING_QUANTUM);
-
- RTS_UNSET(p, RTS_NO_QUANTUM);
-
- return(OK);
+ /* Try to schedule the process. */
+ priority = (unsigned) m_ptr->SCHEDULING_PRIORITY;
+ quantum = (unsigned) m_ptr->SCHEDULING_QUANTUM;
+ return sched_proc(p, priority, quantum);
}
*/
PUBLIC struct boot_image image[] = {
-/* process nr, flags, ms, queue, stack, name */
-{IDLE, 0, 0, 0, IDL_S, "idle" },
-{CLOCK, 0, 0, 0, IDL_S, "clock" },
-{SYSTEM, 0, 0, 0, IDL_S, "system"},
-{HARDWARE, 0, 0, 0, HRD_S, "kernel"},
-
-{DS_PROC_NR, BVM_F, DRIV_QUANTUM, 4, 0, "ds" },
-{RS_PROC_NR, 0, DRIV_QUANTUM, 4, 0, "rs" },
-
-{PM_PROC_NR, OVM_F, SERV_QUANTUM, 4, 0, "pm" },
-{SCHED_PROC_NR,OVM_F, SERV_QUANTUM, 4, 0, "sched" },
-{VFS_PROC_NR, OVM_F, SERV_QUANTUM, 5, 0, "vfs" },
-{MEM_PROC_NR, BVM_F, DRIV_QUANTUM, 3, 0, "memory"},
-{LOG_PROC_NR, BVM_F, DRIV_QUANTUM, 2, 0, "log" },
-{TTY_PROC_NR, BVM_F, DRIV_QUANTUM, 1, 0, "tty" },
-{MFS_PROC_NR, BVM_F, SERV_QUANTUM, 5, 0, "mfs" },
-{VM_PROC_NR, 0, SERV_QUANTUM, 2, 0, "vm" },
-{PFS_PROC_NR, BVM_F, SERV_QUANTUM, 5, 0, "pfs" },
-{INIT_PROC_NR, BVM_F, USER_QUANTUM, USER_Q, 0, "init" },
+/* process nr, flags, stack, name */
+{IDLE, 0, IDL_S, "idle" },
+{CLOCK, 0, IDL_S, "clock" },
+{SYSTEM, 0, IDL_S, "system"},
+{HARDWARE, 0, HRD_S, "kernel"},
+
+{DS_PROC_NR, BVM_F, 0, "ds" },
+{RS_PROC_NR, 0, 0, "rs" },
+
+{PM_PROC_NR, OVM_F, 0, "pm" },
+{SCHED_PROC_NR,OVM_F, 0, "sched" },
+{VFS_PROC_NR, OVM_F, 0, "vfs" },
+{MEM_PROC_NR, BVM_F, 0, "memory"},
+{LOG_PROC_NR, BVM_F, 0, "log" },
+{TTY_PROC_NR, BVM_F, 0, "tty" },
+{MFS_PROC_NR, BVM_F, 0, "mfs" },
+{VM_PROC_NR, 0, 0, "vm" },
+{PFS_PROC_NR, BVM_F, 0, "pfs" },
+{INIT_PROC_NR, BVM_F, 0, "init" },
};
/* Verify the size of the system image table at compile time. Also verify that
struct boot_image {
proc_nr_t proc_nr; /* process number to use */
int flags; /* process flags */
- unsigned quantum; /* time quantum in ms */
- int priority; /* scheduling priority */
int stksize; /* stack size for tasks */
char proc_name[P_NAME_LEN]; /* name in process table */
endpoint_t endpoint; /* endpoint number when started */
*quantum = DECODE(nice, QUANTUM_SHIFT, QUANTUM_BITS);
} else {
/* old ABI, not useful so just take defaults */
- *scheduler = USER_SCH;
+ *scheduler = SCHED_PROC_NR;
*priority = USER_Q;
*quantum = USER_QUANTUM;
}
int rv;
message m;
- assert(_ENDPOINT_P(scheduler_e) >= 0);
+ /* No scheduler given? We are done. */
+ if(scheduler_e == NONE) {
+ return OK;
+ }
+
assert(_ENDPOINT_P(schedulee_e) >= 0);
assert(_ENDPOINT_P(parent_e) >= 0);
assert(maxprio >= 0);
assert(maxprio < NR_SCHED_QUEUES);
assert(quantum > 0);
assert(newscheduler_e);
-
+
+ /* The KERNEL must schedule this process. */
+ if(scheduler_e == KERNEL) {
+ if ((rv = sys_schedctl(SCHEDCTL_FLAG_KERNEL,
+ schedulee_e, maxprio, quantum)) != OK) {
+ return rv;
+ }
+ *newscheduler_e = scheduler_e;
+ return OK;
+ }
+
+ /* A user-space scheduler must schedule this process. */
m.SCHEDULING_ENDPOINT = schedulee_e;
m.SCHEDULING_PARENT = parent_e;
m.SCHEDULING_MAXPRIO = (int) maxprio;
#include "syslib.h"
-PUBLIC int sys_schedctl(unsigned flags, endpoint_t proc_ep)
+PUBLIC int sys_schedctl(unsigned flags, endpoint_t proc_ep, unsigned priority,
+ unsigned quantum)
{
message m;
m.SCHEDCTL_FLAGS = (int) flags;
m.SCHEDCTL_ENDPOINT = proc_ep;
+ m.SCHEDCTL_PRIORITY = priority;
+ m.SCHEDCTL_QUANTUM = quantum;
return(_kernel_call(SYS_SCHEDCTL, &m));
}
return;
}
printf("Image table dump showing all processes included in system image.\n");
- printf("---name- -nr- flags -qs- -queue- -stack-\n");
+ printf("---name- -nr- flags -stack-\n");
for (m=0; m<NR_BOOT_PROCS; m++) {
ip = &image[m];
- printf("%8s %4d %5s %4d %7d %7d\n",
+ printf("%8s %4d %5s %7d\n",
ip->proc_name, ip->proc_nr,
- boot_flags_str(ip->flags), ip->quantum, ip->priority, ip->stksize);
+ boot_flags_str(ip->flags), ip->stksize);
}
printf("\n");
}
/* Set process details found in the image table. */
rmp = &mproc[ip->proc_nr];
strncpy(rmp->mp_name, ip->proc_name, PROC_NAME_LEN);
- rmp->mp_nice = get_nice_value(ip->priority);
(void) sigemptyset(&rmp->mp_ignore);
(void) sigemptyset(&rmp->mp_sigmask);
(void) sigemptyset(&rmp->mp_catch);
/* Set scheduling info */
rmp->mp_scheduler = KERNEL;
+ rmp->mp_nice = get_nice_value(USR_Q);
}
else { /* system process */
if(ip->proc_nr == RS_PROC_NR) {
/* RS schedules this process */
rmp->mp_scheduler = NONE;
+ rmp->mp_nice = get_nice_value(SRV_Q);
}
/* Get kernel endpoint identifier. */
#define SRV_DF (DRV_FORCED) /* system services */
#define DSRV_DF (SRV_DF) /* dynamic system services */
+/* Shorthands. */
+#define SRV_OR_USR(rp, X, Y) (rp->r_priv.s_flags & SYS_PROC ? X : Y)
+
/* Reply flags. */
#define RS_DONTREPLY 0
#define RS_REPLY 1
#include "type.h"
#include "glo.h"
+EXTERN _PROTOTYPE( int do_sef_lu_request, (message *m_ptr) );
{
/* Initialize the reincarnation server. */
struct boot_image *ip;
- int s,i,j, usersched;
+ int s,i,j;
int nr_image_srvs, nr_image_priv_srvs, nr_uncaught_init_srvs;
struct rproc *rp;
struct rproc *replica_rp;
struct boot_image_priv *boot_image_priv;
struct boot_image_sys *boot_image_sys;
struct boot_image_dev *boot_image_dev;
- message m;
int pid, replica_pid;
endpoint_t replica_endpoint;
fill_call_mask(boot_image_priv->vm_calls, NR_VM_CALLS,
rpub->vm_call_mask, VM_RQ_BASE, TRUE);
+ /* Scheduling parameters. */
+ rp->r_scheduler = SRV_OR_USR(rp, SRV_SCH, USR_SCH);
+ rp->r_priority = SRV_OR_USR(rp, SRV_Q, USR_Q);
+ rp->r_quantum = SRV_OR_USR(rp, SRV_QT, USR_QT);
+
/* Get some settings from the boot image table. */
- rp->r_scheduler = boot_image_priv->sched;
- rp->r_priority = ip->priority;
- rp->r_quantum = ip->quantum;
rpub->endpoint = ip->endpoint;
/* Set some defaults. */
rpub->in_use = TRUE;
}
- /* - Step 2: allow every system service in the boot image to run.
- * first start kernel-scheduled servers, including the PM and the
- * scheduler which are needed to be able to start the
- * user-space-scheduled processes
- */
+ /* - Step 2: allow every system service in the boot image to run. */
nr_uncaught_init_srvs = 0;
- for (usersched=0; usersched <= 1; usersched++) {
for (i=0; boot_image_priv_table[i].endpoint != NULL_BOOT_NR; i++) {
boot_image_priv = &boot_image_priv_table[i];
continue;
}
- /* Kernel-scheduled processes first */
- if ((boot_image_priv->sched == KERNEL) ? usersched : !usersched) {
- continue;
- }
-
/* Lookup the corresponding slot in the system process table. */
rp = &rproc[boot_image_priv - boot_image_priv_table];
rpub = rp->r_pub;
catch_boot_init_ready(ANY);
nr_uncaught_init_srvs--;
}
- }
/* - Step 4: all the system services in the boot image are now running.
* Complete the initialization of the system process table in collaboration
/* Definition of the boot image priv table. The order of entries in this table
* reflects the order boot system services are made runnable and initialized
- * at boot time, except for the fact that kernel-scheduled services are
- * handled before user-scheduled ones.
+ * at boot time.
*/
PUBLIC struct boot_image_priv boot_image_priv_table[] = {
-/*endpoint, label, flags, traps, ipcto, sigmgr, sched, kcalls, vmcalls */
-{RS_PROC_NR, "rs", RSYS_F, RSYS_T, RSYS_M, RSYS_SM, KERN_SCH, rs_kc, rs_vmc },
-{VM_PROC_NR, "vm", VM_F, SRV_T, SRV_M, SRV_SM, KERN_SCH, vm_kc, vm_vmc },
-{PM_PROC_NR, "pm", SRV_F, SRV_T, SRV_M, SRV_SM, KERN_SCH, pm_kc, pm_vmc },
-{SCHED_PROC_NR,"sched", SRV_F, SRV_T, SRV_M, SRV_SM, KERN_SCH, sched_kc, sched_vmc },
-{VFS_PROC_NR, "vfs", SRV_F, SRV_T, SRV_M, SRV_SM, KERN_SCH, vfs_kc, vfs_vmc },
-{DS_PROC_NR, "ds", SRV_F, SRV_T, SRV_M, SRV_SM, KERN_SCH, ds_kc, ds_vmc },
-{TTY_PROC_NR, "tty", SRV_F, SRV_T, SRV_M, SRV_SM, USER_SCH, tty_kc, tty_vmc },
-{MEM_PROC_NR, "memory", SRV_F, SRV_T, SRV_M, SRV_SM, KERN_SCH, mem_kc, mem_vmc },
-{LOG_PROC_NR, "log", SRV_F, SRV_T, SRV_M, SRV_SM, USER_SCH, log_kc, log_vmc },
-{MFS_PROC_NR,"fs_imgrd", SRV_F, SRV_T, SRV_M, SRV_SM, KERN_SCH, mfs_kc, mfs_vmc },
-{PFS_PROC_NR, "pfs", SRV_F, SRV_T, SRV_M, SRV_SM, USER_SCH, pfs_kc, pfs_vmc },
-{INIT_PROC_NR, "init", RUSR_F, RUSR_T, RUSR_M, RUSR_SM, NONE, rusr_kc, rusr_vmc },
-{NULL_BOOT_NR, "", 0, 0, 0, 0, 0, no_kc, no_vmc }
+/*endpoint, label, flags, traps, ipcto, sigmgr, kcalls, vmcalls */
+{RS_PROC_NR, "rs", RSYS_F, RSYS_T, RSYS_M, RSYS_SM, rs_kc, rs_vmc },
+{VM_PROC_NR, "vm", VM_F, SRV_T, SRV_M, SRV_SM, vm_kc, vm_vmc },
+{PM_PROC_NR, "pm", SRV_F, SRV_T, SRV_M, SRV_SM, pm_kc, pm_vmc },
+{SCHED_PROC_NR,"sched", SRV_F, SRV_T, SRV_M, SRV_SM, sched_kc, sched_vmc },
+{VFS_PROC_NR, "vfs", SRV_F, SRV_T, SRV_M, SRV_SM, vfs_kc, vfs_vmc },
+{DS_PROC_NR, "ds", SRV_F, SRV_T, SRV_M, SRV_SM, ds_kc, ds_vmc },
+{TTY_PROC_NR, "tty", SRV_F, SRV_T, SRV_M, SRV_SM, tty_kc, tty_vmc },
+{MEM_PROC_NR, "memory", SRV_F, SRV_T, SRV_M, SRV_SM, mem_kc, mem_vmc },
+{LOG_PROC_NR, "log", SRV_F, SRV_T, SRV_M, SRV_SM, log_kc, log_vmc },
+{MFS_PROC_NR,"fs_imgrd", SRV_F, SRV_T, SRV_M, SRV_SM, mfs_kc, mfs_vmc },
+{PFS_PROC_NR, "pfs", SRV_F, SRV_T, SRV_M, SRV_SM, pfs_kc, pfs_vmc },
+{INIT_PROC_NR, "init", RUSR_F, RUSR_T, RUSR_M, RUSR_SM, rusr_kc, rusr_vmc },
+{NULL_BOOT_NR, "", 0, 0, 0, 0, no_kc, no_vmc }
};
/* Definition of the boot image sys table. */
short trap_mask; /* allowed system call traps */
int ipc_to; /* send mask protection */
endpoint_t sig_mgr; /* signal manager */
- endpoint_t sched; /* scheduler */
int *k_calls; /* allowed kernel calls */
int *vm_calls; /* allowed vm calls */
};
*===========================================================================*/
PUBLIC int sched_init_proc(struct rproc *rp)
{
- int s;
-
- switch (rp->r_scheduler) {
-
- case NONE:
- /* don't touch user processes, PM deals with them */
- assert(!(rp->r_priv.s_flags & SYS_PROC));
- break;
-
- case KERNEL:
- /* Confirm kernel scheduler to remove RTS_NO_QUANTUM */
- assert(rp->r_priv.s_flags & SYS_PROC);
- if ((s = sys_schedctl(SCHEDCTL_FLAG_KERNEL,
- rp->r_pub->endpoint)) != OK) {
- panic("unable to kernel-schedule service: %d", s);
- }
- break;
-
- default:
- /* tell scheduler to schedule this one */
- assert(rp->r_priv.s_flags & SYS_PROC);
- if ((s = sched_start(rp->r_scheduler, rp->r_pub->endpoint,
- RS_PROC_NR, rp->r_priority, rp->r_quantum,
- &rp->r_scheduler)) != OK) {
- return s;
- }
- break;
- }
-
- return OK;
+ int s;
+ int is_usr_proc;
+
+ /* Make sure user processes have no scheduler. PM deals with them. */
+ is_usr_proc = !(rp->r_priv.s_flags & SYS_PROC);
+ if(is_usr_proc) assert(rp->r_scheduler == NONE);
+ if(!is_usr_proc) assert(rp->r_scheduler != NONE);
+
+ /* Start scheduling for the given process. */
+ if ((s = sched_start(rp->r_scheduler, rp->r_pub->endpoint,
+ RS_PROC_NR, rp->r_priority, rp->r_quantum,
+ &rp->r_scheduler)) != OK) {
+ return s;
+ }
+
+ return s;
}
/*===========================================================================*
/* Take over scheduling the process. The kernel reply message populates
* the processes current priority and its time slice */
- if ((rv = sys_schedctl(0, rmp->endpoint)) != OK) {
+ if ((rv = sys_schedctl(0, rmp->endpoint, 0, 0)) != OK) {
printf("Sched: Error taking over scheduling for %d, kernel said %d\n",
rmp->endpoint, rv);
return rv;