我正在Minix 3.1.8中修改调度程序,想知道系统调用sys_schedule()在CPU中的作用。有人可以解释吗?
sys_schedule.c
PUBLIC int sys_schedule(endpoint_t proc_ep,unsigned priority,unsigned quantum)
{
message m;
m.SCHEDULING_ENDPOINT = proc_ep;
m.SCHEDULING_PRIORITY = priority;
m.SCHEDULING_QUANTUM = quantum;
return(_kernel_call(SYS_SCHEDULE,&m));
}
com.h
#define KERNEL_CALL 0x600 /* base for kernel calls to SYSTEM */
# define SYS_SCHEDULE (KERNEL_CALL + 3) /* sys_schedule() */
kernel_call.c
PUBLIC int _kernel_call(int syscallnr,message *msgptr)
{
msgptr->m_type = syscallnr;
_do_kernel_call(msgptr);
return(msgptr->m_type);
}
ipc.h
_PROTOTYPE( int _do_kernel_call,(message *m_ptr) );
_ipc.S
ENTRY(_do_kernel_call)
/* pass the message pointer to kernel in the %eax register */
movl 4(%esp),%eax
int $KERVEC
ret