I'm modifying a scheduler in Minix 3.1.8 and wondering what the system call sys_schedule() does in CPU. Could someone explain?
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