Removal of the system task

* Userspace change to use the new kernel calls

	- _taskcall(SYSTASK...) changed to _kernel_call(...)

	- int 32 reused for the kernel calls

	- _do_kernel_call() to make the trap to kernel

	- kernel_call() to make the actuall kernel call from C using
	  _do_kernel_call()

	- unlike ipc call the kernel call always succeeds as kernel is
	  always available, however, kernel may return an error

* Kernel side implementation of kernel calls

	- the SYSTEm task does not run, only the proc table entry is
	  preserved

	- every data_copy(SYSTEM is no data_copy(KERNEL

	- "locking" is an empty operation now as everything runs in
	  kernel

	- sys_task() is replaced by kernel_call() which copies the
	  message into kernel, dispatches the call to its handler and
	  finishes by either copying the results back to userspace (if
	  need be) or by suspending the process because of VM

	- suspended processes are later made runnable once the memory
	  issue is resolved, picked up by the scheduler and only at
	  this time the call is resumed (in fact restarted) which does
	  not need to copy the message from userspace as the message
	  is already saved in the process structure.

	- no ned for the vmrestart queue, the scheduler will restart
	  the system calls

	- no special case in do_vmctl(), all requests remove the
	  RTS_VMREQUEST flag
This commit is contained in:
Tomas Hruby 2010-02-09 15:20:09 +00:00
parent 5e57818431
commit 728f0f0c49
84 changed files with 274 additions and 249 deletions

View file

@ -22,8 +22,8 @@
#define OVERFLOW_VECTOR 4 /* from INTO */
/* Fixed system call vector. */
#define SYS_VECTOR 32 /* system calls are made with int SYSVEC */
#define SYS386_VECTOR 33 /* except 386 system calls use this */
#define KERN_CALL_VECTOR 32 /* system calls are made with int SYSVEC */
#define IPC_VECTOR 33 /* interrupt vector for ipc */
#define LEVEL0_VECTOR 34 /* for execution of a function at level 0 */
/* Suitable irq bases for hardware interrupts. Reprogram the 8259(s) from

View file

@ -152,4 +152,6 @@ _PROTOTYPE( int send, (endpoint_t dest, message *m_ptr) );
_PROTOTYPE( int sendnb, (endpoint_t dest, message *m_ptr) );
_PROTOTYPE( int senda, (asynmsg_t *table, size_t count) );
_PROTOTYPE( int _do_kernel_call, (message *m_ptr) );
#endif /* _IPC_H */

View file

@ -30,6 +30,7 @@ struct rs_pci;
* Minix system library. *
*==========================================================================*/
_PROTOTYPE( int _taskcall, (endpoint_t who, int syscallnr, message *msgptr));
_PROTOTYPE( int _kernel_call, (int syscallnr, message *msgptr));
_PROTOTYPE( int sys_abort, (int how, ...));
_PROTOTYPE( int sys_enable_iop, (endpoint_t proc_ep));

View file

@ -407,7 +407,8 @@ PRIVATE struct gate_table_s gate_table_ioapic[] = {
};
PRIVATE struct gate_table_s gate_table_common[] = {
{ ipc_entry, SYS386_VECTOR, USER_PRIVILEGE },
{ ipc_entry, IPC_VECTOR, USER_PRIVILEGE },
{ kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE },
{ level0_call, LEVEL0_VECTOR, TASK_PRIVILEGE },
{ NULL, 0, 0}
};

View file

@ -21,12 +21,12 @@ struct reg86u reg86;
PUBLIC int do_int86(struct proc * caller, message * m_ptr)
{
data_copy(caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86,
SYSTEM, (vir_bytes) &reg86, sizeof(reg86));
KERNEL, (vir_bytes) &reg86, sizeof(reg86));
level0(int86);
/* Copy results back to the caller */
data_copy(SYSTEM, (vir_bytes) &reg86,
data_copy(KERNEL, (vir_bytes) &reg86,
caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86, sizeof(reg86));
/* The BIOS call eats interrupts. Call get_randomness to generate some

View file

@ -243,7 +243,7 @@ PUBLIC void proc_stacktrace(struct proc *whichproc)
#define PRCOPY(pr, pv, v, n) \
(iskernel ? (memcpy((char *) v, (char *) pv, n), OK) : \
data_copy(pr->p_endpoint, pv, SYSTEM, (vir_bytes) (v), n))
data_copy(pr->p_endpoint, pv, KERNEL, (vir_bytes) (v), n))
if(PRCOPY(whichproc, v_bp, &v_hbp, sizeof(v_hbp)) != OK) {
kprintf("(v_bp 0x%lx ?)", v_bp);

View file

@ -377,7 +377,7 @@ hwint15:
hwint_slave(15)
/*
* syscall is only from a process to kernel
* IPC is only from a process to kernel
*/
.balign 16
.globl ipc_entry
@ -411,6 +411,36 @@ ipc_entry:
jmp restart
/*
* kernel call is only from a process to kernel
*/
.balign 16
.globl kernel_call_entry
kernel_call_entry:
SAVE_PROCESS_CTX(0)
/* save the pointer to the current process */
push %ebp
/* for stack trace */
movl $0, %ebp
/*
* pass the syscall arguments from userspace to the handler.
* SAVE_PROCESS_CTX() does not clobber these registers, they are still
* set as the userspace have set them
*/
push %eax
call kernel_call
/* restore the current process pointer and save the return value */
add $8, %esp
jmp restart
.balign 16
/*
* called by the exception interrupt vectors. If the exception does not push

View file

@ -212,7 +212,8 @@ PUBLIC void idt_init(void)
{ alignment_check, ALIGNMENT_CHECK_VECTOR, INTR_PRIVILEGE },
{ machine_check, MACHINE_CHECK_VECTOR, INTR_PRIVILEGE },
{ simd_exception, SIMD_EXCEPTION_VECTOR, INTR_PRIVILEGE },
{ ipc_entry, SYS386_VECTOR, USER_PRIVILEGE },/* 386 system call */
{ ipc_entry, IPC_VECTOR, USER_PRIVILEGE },
{ kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE },
{ level0_call, LEVEL0_VECTOR, TASK_PRIVILEGE },
{ NULL, 0, 0}
};

View file

@ -25,9 +25,9 @@
#define unset_sys_bit(map,bit) \
( MAP_CHUNK(map.chunk,bit) &= ~(1 << CHUNK_OFFSET(bit) )
#define reallock do { int d; d = intr_disabled(); intr_disable(); locklevel++; if(d && locklevel == 1) { minix_panic("reallock while interrupts disabled first time", __LINE__); } } while(0)
#define reallock
#define realunlock do { if(!intr_disabled()) { minix_panic("realunlock while interrupts enabled", __LINE__); } if(locklevel < 1) { minix_panic("realunlock while locklevel below 1", __LINE__); } locklevel--; if(locklevel == 0) { intr_enable(); } } while(0)
#define realunlock
/* Disable/ enable hardware interrupts. The parameters of lock() and unlock()
* are used when debugging is enabled. See debug.h for more information.

View file

@ -145,6 +145,7 @@ miscflagstr(int flags)
FLAG(MF_ASYNMSG);
FLAG(MF_FULLVM);
FLAG(MF_DELIVERMSG);
FLAG(MF_KCALL_RESUME);
return str;
}

View file

@ -26,7 +26,6 @@ EXTERN struct loadinfo kloadinfo; /* status of load average */
/* Process scheduling information and the kernel reentry count. */
EXTERN struct proc *proc_ptr; /* pointer to currently running process */
EXTERN struct proc *bill_ptr; /* process to bill for clock ticks */
EXTERN struct proc *vmrestart; /* first process on vmrestart queue */
EXTERN struct proc *vmrequest; /* first process on vmrequest queue */
EXTERN struct proc *pagefaults; /* first process on pagefault queue */
EXTERN unsigned lost_ticks; /* clock ticks counted outside clock task */

View file

@ -203,6 +203,8 @@ PUBLIC void main()
if (rp->p_nr == HARDWARE) RTS_SET(rp, RTS_PROC_STOP);
/* IDLE task is never put on a run queue as it is never ready to run */
if (rp->p_nr == IDLE) RTS_SET(rp, RTS_PROC_STOP);
/* SYSTEM does not run anymore */
if (rp->p_nr == SYSTEM) RTS_SET(rp, RTS_PROC_STOP);
RTS_UNSET(rp, RTS_SLOT_FREE); /* remove RTS_SLOT_FREE and schedule */
alloc_segments(rp);
}

View file

@ -205,10 +205,14 @@ check_misc_flags:
vmassert(proc_ptr);
vmassert(proc_is_runnable(proc_ptr));
while (proc_ptr->p_misc_flags &
(MF_DELIVERMSG | MF_SC_DEFER | MF_SC_TRACE | MF_SC_ACTIVE)) {
(MF_KCALL_RESUME | MF_DELIVERMSG |
MF_SC_DEFER | MF_SC_TRACE | MF_SC_ACTIVE)) {
vmassert(proc_is_runnable(proc_ptr));
if (proc_ptr->p_misc_flags & MF_DELIVERMSG) {
if (proc_ptr->p_misc_flags & MF_KCALL_RESUME) {
kernel_call_resume(proc_ptr);
}
else if (proc_ptr->p_misc_flags & MF_DELIVERMSG) {
TRACE(VF_SCHEDULING, printf("delivering to %s / %d\n",
proc_ptr->p_name, proc_ptr->p_endpoint););
if(delivermsg(proc_ptr) == VMSUSPEND) {
@ -832,14 +836,14 @@ field, caller->p_name, entry, priv(caller)->s_asynsize, priv(caller)->s_asyntab)
#define A_RETRIEVE(entry, field) \
if(data_copy(caller_ptr->p_endpoint, \
table_v + (entry)*sizeof(asynmsg_t) + offsetof(struct asynmsg,field),\
SYSTEM, (vir_bytes) &tabent.field, \
KERNEL, (vir_bytes) &tabent.field, \
sizeof(tabent.field)) != OK) {\
ASCOMPLAIN(caller_ptr, entry, #field); \
return EFAULT; \
}
#define A_INSERT(entry, field) \
if(data_copy(SYSTEM, (vir_bytes) &tabent.field, \
if(data_copy(KERNEL, (vir_bytes) &tabent.field, \
caller_ptr->p_endpoint, \
table_v + (entry)*sizeof(asynmsg_t) + offsetof(struct asynmsg,field),\
sizeof(tabent.field)) != OK) {\

View file

@ -220,6 +220,12 @@ struct proc {
#define MF_REPLY_PEND 0x001 /* reply to IPC_REQUEST is pending */
#define MF_VIRT_TIMER 0x002 /* process-virtual timer is running */
#define MF_PROF_TIMER 0x004 /* process-virtual profile timer is running */
#define MF_KCALL_RESUME 0x008 /* processing a kernel call was interrupted,
most likely because we need VM to resolve a
problem or a long running copy was preempted.
We need to resume the kernel call execution
now
*/
#define MF_ASYNMSG 0x010 /* Asynchrous message pending */
#define MF_FULLVM 0x020
#define MF_DELIVERMSG 0x040 /* Copy message for him before running */

View file

@ -94,11 +94,11 @@ irq_hook_t *hook;
/* Note: k_reenter is always 0 here. */
/* Store sample (process name and program counter). */
data_copy(SYSTEM, (vir_bytes) proc_ptr->p_name,
data_copy(KERNEL, (vir_bytes) proc_ptr->p_name,
sprof_ep, sprof_data_addr_vir + sprof_info.mem_used,
strlen(proc_ptr->p_name));
data_copy(SYSTEM, (vir_bytes) &proc_ptr->p_reg.pc, sprof_ep,
data_copy(KERNEL, (vir_bytes) &proc_ptr->p_reg.pc, sprof_ep,
(vir_bytes) (sprof_data_addr_vir + sprof_info.mem_used +
sizeof(proc_ptr->p_name)),
(vir_bytes) sizeof(proc_ptr->p_reg.pc));

View file

@ -58,13 +58,14 @@ _PROTOTYPE( void unset_sendto_bit, (struct proc *rc, int id) );
_PROTOTYPE( void send_sig, (int proc_nr, int sig_nr) );
_PROTOTYPE( void cause_sig, (proc_nr_t proc_nr, int sig_nr) );
_PROTOTYPE( void sig_delay_done, (struct proc *rp) );
_PROTOTYPE( void sys_task, (void) );
_PROTOTYPE( void kernel_call, (message *m_user, struct proc * caller) );
_PROTOTYPE( void system_init, (void) );
#define numap_local(proc_nr, vir_addr, bytes) \
umap_local(proc_addr(proc_nr), D, (vir_addr), (bytes))
_PROTOTYPE( phys_bytes umap_grant, (struct proc *, cp_grant_id_t, vir_bytes));
_PROTOTYPE( void clear_endpoint, (struct proc *rc) );
_PROTOTYPE( phys_bytes umap_bios, (vir_bytes vir_addr, vir_bytes bytes));
_PROTOTYPE( void kernel_call_resume, (struct proc *p));
/* system/do_newmap.c */
_PROTOTYPE( int newmap, (struct proc * caller, struct proc *rp,

View file

@ -58,85 +58,92 @@ char *callnames[NR_SYS_CALLS];
callnames[(call_nr-KERNEL_CALL)] = #call_nr; \
call_vec[(call_nr-KERNEL_CALL)] = (handler)
FORWARD _PROTOTYPE( void initialize, (void));
FORWARD _PROTOTYPE( struct proc *vmrestart_check, (message *));
PRIVATE void kernel_call_finish(struct proc * caller, message *msg, int result)
{
if(result == VMSUSPEND) {
/* Special case: message has to be saved for handling
* until VM tells us it's allowed. VM has been notified
* and we must wait for its reply to restart the call.
*/
vmassert(RTS_ISSET(caller, RTS_VMREQUEST));
vmassert(caller->p_vmrequest.type == VMSTYPE_KERNELCALL);
caller->p_vmrequest.saved.reqmsg = *msg;
caller->p_misc_flags |= MF_KCALL_RESUME;
} else {
/*
* call is finished, we could have been suspended because of VM,
* remove the request message
*/
caller->p_vmrequest.saved.reqmsg.m_source = NONE;
if (result != EDONTREPLY) {
/* copy the result as a message to the original user buffer */
msg->m_source = SYSTEM;
msg->m_type = result; /* report status of call */
if (copy_msg_to_user(caller, msg,
(message *)caller->p_delivermsg_vir)) {
kprintf("WARNING wrong user pointer 0x%08x from "
"process %s / %d\n",
caller->p_delivermsg_vir,
caller->p_name,
caller->p_endpoint);
result = EBADREQUEST;
}
}
}
}
PRIVATE int kernel_call_dispatch(struct proc * caller, message *msg)
{
int result = OK;
int call_nr;
call_nr = msg->m_type - KERNEL_CALL;
/* See if the caller made a valid request and try to handle it. */
if (call_nr < 0 || call_nr >= NR_SYS_CALLS) { /* check call number */
kprintf("SYSTEM: illegal request %d from %d.\n",
call_nr,msg->m_source);
result = EBADREQUEST; /* illegal message type */
}
else if (!GET_BIT(priv(caller)->s_k_call_mask, call_nr)) {
result = ECALLDENIED; /* illegal message type */
} else {
/* handle the system call */
result = (*call_vec[call_nr])(caller, msg);
}
return result;
}
/*===========================================================================*
* sys_task *
* kernel_call *
*===========================================================================*/
PUBLIC void sys_task()
/*
* this function checks the basic syscall parameters and if accepted it
* dispatches its handling to the right handler
*/
PUBLIC void kernel_call(message *m_user, struct proc * caller)
{
/* Main entry point of sys_task. Get the message and dispatch on type. */
static message m;
register int result;
register struct proc *caller_ptr;
int s;
int call_nr;
int who_p;
endpoint_t who_e;
int result = OK;
message msg;
while (TRUE) {
struct proc *restarting;
restarting = vmrestart_check(&m);
if(!restarting) {
int r;
/* Get work. Block and wait until a request message arrives. */
if((r=receive(ANY, &m)) != OK)
minix_panic("receive() failed", r);
}
call_nr = m.m_type - KERNEL_CALL;
who_e = m.m_source;
okendpt(who_e, &who_p);
caller_ptr = proc_addr(who_p);
/* See if the caller made a valid request and try to handle it. */
if (call_nr < 0 || call_nr >= NR_SYS_CALLS) { /* check call number */
kprintf("SYSTEM: illegal request %d from %d.\n",
call_nr,m.m_source);
result = EBADREQUEST; /* illegal message type */
}
else if (!GET_BIT(priv(caller_ptr)->s_k_call_mask, call_nr)) {
result = ECALLDENIED; /* illegal message type */
}
else {
/* handle the system call */
result = (*call_vec[call_nr])(caller_ptr, &m);
}
if(result == VMSUSPEND) {
/* Special case: message has to be saved for handling
* until VM tells us it's allowed. VM has been notified
* and we must wait for its reply to restart the call.
*/
vmassert(RTS_ISSET(caller_ptr, RTS_VMREQUEST));
vmassert(caller_ptr->p_vmrequest.type == VMSTYPE_KERNELCALL);
caller_ptr->p_vmrequest.saved.reqmsg = m;
} else if (result != EDONTREPLY) {
/* Send a reply, unless inhibited by a handler function.
* Use the kernel function lock_send() to prevent a system
* call trap.
*/
if(restarting) {
vmassert(!RTS_ISSET(restarting, RTS_VMREQUEST));
#if 0
vmassert(!RTS_ISSET(restarting, RTS_VMREQTARGET));
#endif
}
m.m_type = result; /* report status of call */
if(WILLRECEIVE(caller_ptr, SYSTEM)) {
if (OK != (s=lock_send(m.m_source, &m))) {
kprintf("SYSTEM, reply to %d failed: %d\n",
m.m_source, s);
}
} else {
kprintf("SYSTEM: not replying to %d; not ready\n",
caller_ptr->p_endpoint);
}
}
caller->p_delivermsg_vir = (vir_bytes) m_user;
/*
* the ldt and cr3 of the caller process is loaded because it just've trapped
* into the kernel or was already set in schedcheck() before we resume
* execution of an interrupted kernel call
*/
if (copy_msg_from_user(caller, m_user, &msg) == 0) {
msg.m_source = caller->p_endpoint;
result = kernel_call_dispatch(caller, &msg);
}
else {
kprintf("WARNING wrong user pointer 0x%08x from process %s / %d\n",
m_user, caller->p_name, caller->p_endpoint);
result = EBADREQUEST;
}
kernel_call_finish(caller, &msg, result);
}
/*===========================================================================*
@ -541,52 +548,28 @@ register struct proc *rc; /* slot of process to clean up */
}
/*===========================================================================*
* vmrestart_check *
* kernel_call_resume *
*===========================================================================*/
PRIVATE struct proc *vmrestart_check(message *m)
PUBLIC void kernel_call_resume(struct proc *caller)
{
int type;
struct proc *restarting;
int who_p;
int result;
/* Anyone waiting to be vm-restarted? */
vmassert(!RTS_ISSET(p, RTS_SLOT_FREE));
vmassert(!RTS_ISSET(p, RTS_VMREQUEST));
if(!(restarting = vmrestart))
return NULL;
vmassert(p->p_vmrequest.saved.reqmsg.m_source == p->p_endpoint);
vmassert(!RTS_ISSET(restarting, RTS_SLOT_FREE));
vmassert(RTS_ISSET(restarting, RTS_VMREQUEST));
/*
printf("KERNEL_CALL restart from %s / %d rts 0x%08x misc 0x%08x\n",
caller->p_name, caller->p_endpoint,
caller->p_rts_flags, caller->p_misc_flags);
*/
type = restarting->p_vmrequest.type;
restarting->p_vmrequest.type = VMSTYPE_SYS_NONE;
vmrestart = restarting->p_vmrequest.nextrestart;
switch(type) {
case VMSTYPE_KERNELCALL:
*m = restarting->p_vmrequest.saved.reqmsg;
restarting->p_vmrequest.saved.reqmsg.m_source = NONE;
vmassert(m->m_source == restarting->p_endpoint);
/* Original caller could've disappeared in the meantime. */
if(!isokendpt(m->m_source, &who_p)) {
kprintf("SYSTEM: ignoring call %d from dead %d\n",
m->m_type, m->m_source);
return NULL;
}
{ int i;
i = m->m_type - KERNEL_CALL;
if(i >= 0 && i < NR_SYS_CALLS) {
#if 0
kprintf("SYSTEM: restart %s from %d\n",
callnames[i], m->m_source);
#endif
} else {
minix_panic("call number out of range", i);
}
}
return restarting;
default:
minix_panic("strange restart type", type);
}
minix_panic("fell out of switch", NO_NUM);
return NULL;
/*
* we are resuming the kernel call so we have to remove this flag so it
* can be set again
*/
caller->p_misc_flags &= ~MF_KCALL_RESUME;
result = kernel_call_dispatch(caller, &caller->p_vmrequest.saved.reqmsg);
kernel_call_finish(caller, &caller->p_vmrequest.saved.reqmsg, result);
}

View file

@ -30,9 +30,8 @@ PUBLIC int do_abort(struct proc * caller, message * m_ptr)
int len;
len = MIN(m_ptr->ABRT_MON_LEN, sizeof(paramsbuffer)-1);
if((p=data_copy(m_ptr->ABRT_MON_ENDPT,
(vir_bytes) m_ptr->ABRT_MON_ADDR,
SYSTEM, (vir_bytes) paramsbuffer, len)) != OK) {
if((p=data_copy(m_ptr->ABRT_MON_ENDPT, (vir_bytes) m_ptr->ABRT_MON_ADDR,
KERNEL, (vir_bytes) paramsbuffer, len)) != OK) {
return p;
}
paramsbuffer[len] = '\0';

View file

@ -47,7 +47,7 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
}
/* Set reset flag. */
data_copy(SYSTEM, (vir_bytes) &cprof_ctl_inst.reset,
data_copy(KERNEL, (vir_bytes) &cprof_ctl_inst.reset,
cprof_proc_info[i].endpt, cprof_proc_info[i].ctl_v,
sizeof(cprof_ctl_inst.reset));
}
@ -90,7 +90,7 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
/* Copy control struct from proc to local variable. */
data_copy(cprof_proc_info[i].endpt, cprof_proc_info[i].ctl_v,
SYSTEM, (vir_bytes) &cprof_ctl_inst,
KERNEL, (vir_bytes) &cprof_ctl_inst,
sizeof(cprof_ctl_inst));
/* Calculate memory used. */
@ -108,7 +108,7 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
if (cprof_mem_size < cprof_info.mem_used) cprof_info.mem_used = -1;
/* Copy the info struct to the user process. */
data_copy(SYSTEM, (vir_bytes) &cprof_info,
data_copy(KERNEL, (vir_bytes) &cprof_info,
m_ptr->PROF_ENDPT, (vir_bytes) m_ptr->PROF_CTL_PTR,
sizeof(cprof_info));
@ -120,7 +120,7 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
vir_dst = (vir_bytes) m_ptr->PROF_MEM_PTR;
for (i=0; i<cprof_procs_no; i++) {
len = (phys_bytes) strlen(cprof_proc_info[i].name);
data_copy(SYSTEM, (vir_bytes) cprof_proc_info[i].name,
data_copy(KERNEL, (vir_bytes) cprof_proc_info[i].name,
m_ptr->PROF_ENDPT, vir_dst, len);
vir_dst += CPROF_PROCNAME_LEN;

View file

@ -34,7 +34,7 @@ PUBLIC int do_exec(struct proc * caller, message * m_ptr)
/* Save command name for debugging, ps(1) output, etc. */
if(data_copy(caller->p_endpoint, (vir_bytes) m_ptr->PR_NAME_PTR,
SYSTEM, (vir_bytes) rp->p_name, (phys_bytes) P_NAME_LEN - 1) != OK)
KERNEL, (vir_bytes) rp->p_name, (phys_bytes) P_NAME_LEN - 1) != OK)
strncpy(rp->p_name, "<unset>", P_NAME_LEN);
/* Do architecture-specific exec() stuff. */

View file

@ -184,7 +184,7 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr)
/* Try to make the actual copy for the requested data. */
if (m_ptr->I_VAL_LEN > 0 && length > m_ptr->I_VAL_LEN) return (E2BIG);
r = data_copy_vmcheck(caller, SYSTEM, src_vir, caller->p_endpoint,
r = data_copy_vmcheck(caller, KERNEL, src_vir, caller->p_endpoint,
(vir_bytes) m_ptr->I_VAL_PTR, length);
if(r != OK) return r;

View file

@ -37,7 +37,7 @@ PUBLIC int newmap(struct proc *caller, struct proc *rp, struct mem_map *map_ptr)
int r;
/* Fetch the memory map. */
if((r=data_copy(caller->p_endpoint, (vir_bytes) map_ptr,
SYSTEM, (vir_bytes) rp->p_memmap, sizeof(rp->p_memmap))) != OK) {
KERNEL, (vir_bytes) rp->p_memmap, sizeof(rp->p_memmap))) != OK) {
kprintf("newmap: data_copy failed! (%d)\n", r);
return r;
}

View file

@ -71,7 +71,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
{
/* Copy privilege structure from caller */
if((r=data_copy(caller->p_endpoint, (vir_bytes) m_ptr->CTL_ARG_PTR,
SYSTEM, (vir_bytes) &priv, sizeof(priv))) != OK)
KERNEL, (vir_bytes) &priv, sizeof(priv))) != OK)
return r;
/* See if the caller wants to assign a static privilege id. */
@ -226,7 +226,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
/* Get the I/O range */
data_copy(caller->p_endpoint, (vir_bytes) m_ptr->CTL_ARG_PTR,
SYSTEM, (vir_bytes) &io_range, sizeof(io_range));
KERNEL, (vir_bytes) &io_range, sizeof(io_range));
priv(rp)->s_flags |= CHECK_IO_PORT; /* Check I/O accesses */
i= priv(rp)->s_nr_io_range;
if (i >= NR_IO_RANGE)
@ -248,7 +248,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
/* Get the memory range */
if((r=data_copy(caller->p_endpoint, (vir_bytes) m_ptr->CTL_ARG_PTR,
SYSTEM, (vir_bytes) &mem_range, sizeof(mem_range))) != OK)
KERNEL, (vir_bytes) &mem_range, sizeof(mem_range))) != OK)
return r;
priv(rp)->s_flags |= CHECK_MEM; /* Check memory mappings */
i= priv(rp)->s_nr_mem_range;
@ -270,7 +270,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
return EPERM;
data_copy(caller->p_endpoint, (vir_bytes) m_ptr->CTL_ARG_PTR,
SYSTEM, (vir_bytes) &irq, sizeof(irq));
KERNEL, (vir_bytes) &irq, sizeof(irq));
priv(rp)->s_flags |= CHECK_IRQ; /* Check IRQs */
i= priv(rp)->s_nr_irq;

View file

@ -83,7 +83,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
*/
if((r=data_copy(granter,
priv(granter_proc)->s_grant_table + sizeof(g)*grant,
SYSTEM, (vir_bytes) &g, sizeof(g))) != OK) {
KERNEL, (vir_bytes) &g, sizeof(g))) != OK) {
kprintf(
"verify_grant: grant verify: data_copy failed\n");
return EPERM;
@ -366,7 +366,7 @@ PUBLIC int do_vsafecopy(struct proc * caller, message * m_ptr)
src.proc_nr_e = caller->p_endpoint;
src.offset = (vir_bytes) m_ptr->VSCP_VEC_ADDR;
src.segment = dst.segment = D;
dst.proc_nr_e = SYSTEM;
dst.proc_nr_e = KERNEL;
dst.offset = (vir_bytes) vec;
/* No. of vector elements. */

View file

@ -32,7 +32,7 @@ PUBLIC int do_sigreturn(struct proc * caller, message * m_ptr)
/* Copy in the sigcontext structure. */
if((r=data_copy(m_ptr->SIG_ENDPT, (vir_bytes) m_ptr->SIG_CTXT_PTR,
SYSTEM, (vir_bytes) &sc, sizeof(struct sigcontext))) != OK)
KERNEL, (vir_bytes) &sc, sizeof(struct sigcontext))) != OK)
return r;
/* Restore user bits of psw from sc, maintain system bits from proc. */

View file

@ -37,7 +37,7 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr)
/* Get the sigmsg structure into our address space. */
if((r=data_copy_vmcheck(caller, caller->p_endpoint,
(vir_bytes) m_ptr->SIG_CTXT_PTR, SYSTEM, (vir_bytes) &smsg,
(vir_bytes) m_ptr->SIG_CTXT_PTR, KERNEL, (vir_bytes) &smsg,
(phys_bytes) sizeof(struct sigmsg))) != OK)
return r;
@ -57,7 +57,7 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr)
sc.sc_flags = 0 | rp->p_misc_flags & MF_FPU_INITIALIZED;
/* Copy the sigcontext structure to the user's stack. */
if((r=data_copy_vmcheck(caller, SYSTEM, (vir_bytes) &sc, m_ptr->SIG_ENDPT,
if((r=data_copy_vmcheck(caller, KERNEL, (vir_bytes) &sc, m_ptr->SIG_ENDPT,
(vir_bytes) scp, (vir_bytes) sizeof(struct sigcontext))) != OK)
return r;
@ -106,7 +106,7 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr)
fr.sf_retadr = (void (*)()) smsg.sm_sigreturn;
/* Copy the sigframe structure to the user's stack. */
if((r=data_copy_vmcheck(caller, SYSTEM, (vir_bytes) &fr,
if((r=data_copy_vmcheck(caller, KERNEL, (vir_bytes) &fr,
m_ptr->SIG_ENDPT, (vir_bytes) frp,
(vir_bytes) sizeof(struct sigframe))) != OK)
return r;

View file

@ -79,7 +79,7 @@ PUBLIC int do_sprofile(struct proc * caller, message * m_ptr)
stop_profile_clock();
data_copy(SYSTEM, (vir_bytes) &sprof_info,
data_copy(KERNEL, (vir_bytes) &sprof_info,
sprof_ep, sprof_info_addr_vir, sizeof(sprof_info));
return OK;

View file

@ -27,7 +27,7 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr)
caller->p_endpoint, len);
return EINVAL;
}
if((s=data_copy_vmcheck(caller, caller->p_endpoint, buf, SYSTEM,
if((s=data_copy_vmcheck(caller, caller->p_endpoint, buf, KERNEL,
(vir_bytes) mybuf, len)) != OK) {
kprintf("do_sysctl: diag for %d: len %d: copy failed: %d\n",
caller->p_endpoint, len, s);

View file

@ -54,7 +54,7 @@ PUBLIC int do_trace(struct proc * caller, message * m_ptr)
#define COPYTOPROC(seg, addr, myaddr, length) { \
struct vir_addr fromaddr, toaddr; \
int r; \
fromaddr.proc_nr_e = SYSTEM; \
fromaddr.proc_nr_e = KERNEL; \
toaddr.proc_nr_e = tr_proc_nr_e; \
fromaddr.offset = (myaddr); \
toaddr.offset = (addr); \
@ -71,7 +71,7 @@ PUBLIC int do_trace(struct proc * caller, message * m_ptr)
struct vir_addr fromaddr, toaddr; \
int r; \
fromaddr.proc_nr_e = tr_proc_nr_e; \
toaddr.proc_nr_e = SYSTEM; \
toaddr.proc_nr_e = KERNEL; \
fromaddr.offset = (addr); \
toaddr.offset = (myaddr); \
fromaddr.segment = (seg); \

View file

@ -67,7 +67,7 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr)
/* Copy (port,value)-pairs from user. */
if((r=data_copy(caller->p_endpoint, (vir_bytes) m_ptr->DIO_VEC_ADDR,
SYSTEM, (vir_bytes) vdevio_buf, bytes)) != OK)
KERNEL, (vir_bytes) vdevio_buf, bytes)) != OK)
return r;
privp= priv(caller);
@ -104,19 +104,6 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr)
* the entire switch is wrapped in lock() and unlock() to prevent the I/O
* batch from being interrupted.
*/
#if 0
if(who_e == 71091) {
static int vd = 0;
if(vd++ < 100) {
kprintf("proc %d does vdevio no %d; type %d, direction %s\n",
who_e, vd, io_type, io_in ? "input" : "output");
kprintf("(");
for (i=0; i<vec_size; i++)
kprintf("%2d:0x%x,0x%x ", i, pvb[i].port, pvb[i].value);
kprintf(")\n");
}
}
#endif
lock;
switch (io_type) {
case _DIO_BYTE: /* byte values */
@ -169,7 +156,7 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr)
/* Almost done, copy back results for input requests. */
if (io_in)
if((r=data_copy(SYSTEM, (vir_bytes) vdevio_buf,
if((r=data_copy(KERNEL, (vir_bytes) vdevio_buf,
caller->p_endpoint, (vir_bytes) m_ptr->DIO_VEC_ADDR,
(phys_bytes) bytes)) != OK)
return r;

View file

@ -129,19 +129,19 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
switch(p->p_vmrequest.type) {
case VMSTYPE_KERNELCALL:
/* Put on restart chain. */
p->p_vmrequest.nextrestart = vmrestart;
vmrestart = p;
/*
* we will have to resume execution of the kernel call
* as soon the scheduler picks up this process again
*/
p->p_misc_flags |= MF_KCALL_RESUME;
break;
case VMSTYPE_DELIVERMSG:
vmassert(p->p_misc_flags & MF_DELIVERMSG);
vmassert(p == target);
vmassert(RTS_ISSET(p, RTS_VMREQUEST));
RTS_LOCK_UNSET(p, RTS_VMREQUEST);
break;
case VMSTYPE_MAP:
vmassert(RTS_ISSET(p, RTS_VMREQUEST));
RTS_LOCK_UNSET(p, RTS_VMREQUEST);
break;
default:
#if DEBUG_VMASSERT
@ -152,7 +152,9 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
p->p_vmrequest.type);
}
RTS_LOCK_UNSET(p, RTS_VMREQUEST);
return OK;
case VMCTL_ENABLE_PAGING:
/*
* system task must not get preempted while switching to paging,

View file

@ -63,7 +63,7 @@ PUBLIC struct boot_image image[] = {
/* process nr, pc, flags, qs, queue, stack, name */
{IDLE, NULL, 0, 0, 0, IDL_S, "idle" },
{CLOCK,clock_task, 0, 8, TASK_Q, TSK_S, "clock" },
{SYSTEM, sys_task, 0, 8, TASK_Q, TSK_S, "system"},
{SYSTEM, NULL, 0, 0, 0, IDL_S, "system"},
{HARDWARE, 0, 0, 8, TASK_Q, HRD_S, "kernel"},
{PM_PROC_NR, 0, 0, 32, 4, 0, "pm" },
{FS_PROC_NR, 0, 0, 32, 5, 0, "vfs" },

View file

@ -1,5 +1,5 @@
.sect .text; .sect .rom; .sect .data; .sect .bss
.define __notify, __send, __senda, __sendnb, __receive, __sendrec
.define __notify, __send, __senda, __sendnb, __receive, __sendrec, __do_kernel_call
! See src/kernel/ipc.h for C definitions
SEND = 1
@ -7,7 +7,8 @@ RECEIVE = 2
SENDREC = 3
NOTIFY = 4
SENDNB = 5
SYSVEC = 33 ! trap to kernel
IPCVEC = 33 ! ipc trap to kernel
KERVEC = 32 ! syscall trap to kernel
SRC_DST = 8 ! source/ destination process
MESSAGE = 12 ! message pointer
@ -24,7 +25,7 @@ __send:
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, SEND ! _send(dest, ptr)
int SYSVEC ! trap to the kernel
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
@ -36,7 +37,7 @@ __receive:
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, RECEIVE ! _receive(src, ptr)
int SYSVEC ! trap to the kernel
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
@ -48,7 +49,7 @@ __sendrec:
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, SENDREC ! _sendrec(srcdest, ptr)
int SYSVEC ! trap to the kernel
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
@ -59,7 +60,7 @@ __notify:
push ebx
mov eax, SRC_DST(ebp) ! eax = destination
mov ecx, NOTIFY ! _notify(srcdst)
int SYSVEC ! trap to the kernel
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
@ -71,9 +72,13 @@ __sendnb:
mov eax, SRC_DST(ebp) ! eax = dest-src
mov ebx, MESSAGE(ebp) ! ebx = message pointer
mov ecx, SENDNB ! _sendnb(dest, ptr)
int SYSVEC ! trap to the kernel
int IPCVEC ! trap to the kernel
pop ebx
pop ebp
ret
__do_kernel_call:
! pass the message pointer to kernel in the %eax register
mov eax, 4(esp)
int KERVEC
ret

View file

@ -7,6 +7,7 @@ LIBRARIES=libsys
libsys_FILES=" \
alloc_util.c \
assert.c \
kernel_call.c \
panic.c \
pci_attr_r16.c \
pci_attr_r32.c \

View file

@ -17,5 +17,5 @@ PUBLIC int sys_abort(int how, ...)
}
va_end(ap);
return(_taskcall(SYSTASK, SYS_ABORT, &m));
return(_kernel_call(SYS_ABORT, &m));
}

View file

@ -18,6 +18,6 @@ void *mem_ptr; /* location of allocated memory */
m.PROF_CTL_PTR = ctl_ptr;
m.PROF_MEM_PTR = mem_ptr;
return(_taskcall(SYSTASK, SYS_CPROF, &m));
return(_kernel_call(SYS_CPROF, &m));
}

View file

@ -10,7 +10,7 @@ endpoint_t proc_ep; /* process number */
int result;
m.SIG_ENDPT = proc_ep;
result = _taskcall(SYSTASK, SYS_ENDKSIG, &m);
result = _kernel_call(SYS_ENDKSIG, &m);
return(result);
}

View file

@ -8,7 +8,7 @@ endpoint_t proc_ep; /* number of process to allow I/O */
{
message m_iop;
m_iop.IO_ENDPT = proc_ep;
return _taskcall(SYSTASK, SYS_IOPENABLE, &m_iop);
return _kernel_call(SYS_IOPENABLE, &m_iop);
}

View file

@ -14,5 +14,5 @@ vir_bytes initpc;
m.PR_STACK_PTR = ptr;
m.PR_NAME_PTR = prog_name;
m.PR_IP_PTR = (char *)initpc;
return(_taskcall(SYSTASK, SYS_EXEC, &m));
return(_kernel_call(SYS_EXEC, &m));
}

View file

@ -13,5 +13,5 @@ endpoint_t proc_ep; /* which process has exited */
message m;
m.PR_ENDPT = proc_ep;
return(_taskcall(SYSTASK, SYS_EXIT, &m));
return(_kernel_call(SYS_EXIT, &m));
}

View file

@ -17,7 +17,7 @@ vir_bytes *msgaddr;
m.PR_SLOT = child;
m.PR_MEM_PTR = (char *) map_ptr;
m.PR_FORK_FLAGS = flags;
r = _taskcall(SYSTASK, SYS_FORK, &m);
r = _kernel_call(SYS_FORK, &m);
*child_endpoint = m.PR_ENDPT;
*msgaddr = (vir_bytes) m.PR_FORK_MSGADDR;
return r;

View file

@ -22,7 +22,7 @@ int len2; /* length or process nr */
m.I_VAL_PTR2 = ptr2;
m.I_VAL_LEN2_E = len2;
return(_taskcall(SYSTASK, SYS_GETINFO, &m));
return(_kernel_call(SYS_GETINFO, &m));
}
/*===========================================================================*
@ -39,7 +39,7 @@ PUBLIC int sys_whoami(endpoint_t *who_ep, char *who_name, int len)
if(len < 2)
return EINVAL;
if((r = _taskcall(SYSTASK, SYS_GETINFO, &m)) != OK)
if((r = _kernel_call(SYS_GETINFO, &m)) != OK)
return r;
lenmin = MIN(len, sizeof(m.GIWHO_NAME)) - 1;

View file

@ -10,7 +10,7 @@ sigset_t *k_sig_map; /* return signal map here */
message m;
int result;
result = _taskcall(SYSTASK, SYS_GETKSIG, &m);
result = _kernel_call(SYS_GETKSIG, &m);
*proc_ep = m.SIG_ENDPT;
*k_sig_map = (sigset_t) m.SIG_MAP;
return(result);

View file

@ -14,7 +14,7 @@ int type; /* byte, word, long */
m_io.DIO_REQUEST = _DIO_INPUT | type;
m_io.DIO_PORT = port;
result = _taskcall(SYSTASK, SYS_DEVIO, &m_io);
result = _kernel_call(SYS_DEVIO, &m_io);
*value = m_io.DIO_VALUE;
return(result);
}

View file

@ -11,7 +11,7 @@ struct reg86u *reg86p;
m.m1_p1= (char *)reg86p;
result = _taskcall(SYSTASK, SYS_INT86, &m);
result = _kernel_call(SYS_INT86, &m);
return(result);
}

View file

@ -18,7 +18,7 @@ int *hook_id; /* ID of IRQ hook at kernel */
m_irq.IRQ_POLICY = policy;
m_irq.IRQ_HOOK_ID = *hook_id;
s = _taskcall(SYSTASK, SYS_IRQCTL, &m_irq);
s = _kernel_call(SYS_IRQCTL, &m_irq);
if (req == IRQ_SETPOLICY) *hook_id = m_irq.IRQ_HOOK_ID;
return(s);
}

View file

@ -9,6 +9,6 @@ int signr; /* signal number: 1 - 16 */
m.SIG_ENDPT = proc_ep;
m.SIG_NUMBER = signr;
return(_taskcall(SYSTASK, SYS_KILL, &m));
return(_kernel_call(SYS_KILL, &m));
}

View file

@ -11,6 +11,6 @@ PUBLIC int sys_memset(unsigned long pattern, phys_bytes base, phys_bytes bytes)
mess.MEM_COUNT = bytes;
mess.MEM_PATTERN = pattern;
return(_taskcall(SYSTASK, SYS_MEMSET, &mess));
return(_kernel_call(SYS_MEMSET, &mess));
}

View file

@ -10,5 +10,5 @@ struct mem_map *ptr; /* pointer to new map */
m.PR_ENDPT = proc_ep;
m.PR_MEM_PTR = (char *) ptr;
return(_taskcall(SYSTASK, SYS_NEWMAP, &m));
return(_kernel_call(SYS_NEWMAP, &m));
}

View file

@ -9,5 +9,5 @@ PUBLIC int sys_nice(endpoint_t proc_ep, int prio)
m.PR_ENDPT = proc_ep;
m.PR_PRIORITY = prio;
return(_taskcall(SYSTASK, SYS_NICE, &m));
return(_kernel_call(SYS_NICE, &m));
}

View file

@ -14,6 +14,6 @@ int type; /* byte, word, long */
m_io.DIO_PORT = port;
m_io.DIO_VALUE = value;
return _taskcall(SYSTASK, SYS_DEVIO, &m_io);
return _kernel_call(SYS_DEVIO, &m_io);
}

View file

@ -26,5 +26,5 @@ phys_bytes bytes; /* how many bytes */
copy_mess.CP_DST_SPACE = dst_seg;
copy_mess.CP_DST_ADDR = (long) dst_vir;
copy_mess.CP_NR_BYTES = (long) bytes;
return(_taskcall(SYSTASK, SYS_PHYSCOPY, &copy_mess));
return(_kernel_call(SYS_PHYSCOPY, &copy_mess));
}

View file

@ -8,7 +8,7 @@ int sys_privctl(endpoint_t proc_ep, int request, void *p)
m.CTL_REQUEST = request;
m.CTL_ARG_PTR = p;
return _taskcall(SYSTASK, SYS_PRIVCTL, &m);
return _kernel_call(SYS_PRIVCTL, &m);
}
int sys_privquery_mem(endpoint_t proc_ep, phys_bytes start, phys_bytes len)
@ -20,5 +20,5 @@ int sys_privquery_mem(endpoint_t proc_ep, phys_bytes start, phys_bytes len)
m.CTL_PHYSSTART = start;
m.CTL_PHYSLEN = len;
return _taskcall(SYSTASK, SYS_PRIVCTL, &m);
return _kernel_call(SYS_PRIVCTL, &m);
}

View file

@ -12,6 +12,6 @@ void *mem_ptr; /* pointer to profiling table */
m.PROF_CTL_PTR = ctl_ptr;
m.PROF_MEM_PTR = mem_ptr;
return(_taskcall(SYSTASK, SYS_PROFBUF, &m));
return(_kernel_call(SYS_PROFBUF, &m));
}

View file

@ -11,5 +11,5 @@ size_t size; /* Amount of data to read */
m.RDB_SIZE = size;
m.RDB_ADDR = address;
m.RDB_BUF = buf;
return(_taskcall(SYSTASK, SYS_READBIOS, &m));
return(_kernel_call(SYS_READBIOS, &m));
}

View file

@ -11,5 +11,5 @@ PUBLIC int sys_runctl(endpoint_t proc_ep, int action, int flags)
m.RC_ACTION = action;
m.RC_FLAGS = flags;
return(_taskcall(SYSTASK, SYS_RUNCTL, &m));
return(_kernel_call(SYS_RUNCTL, &m));
}

View file

@ -21,7 +21,7 @@ PUBLIC int sys_safecopyfrom(endpoint_t src_e,
copy_mess.SCP_ADDRESS = (char *) address;
copy_mess.SCP_BYTES = (long) bytes;
return(_taskcall(SYSTASK, SYS_SAFECOPYFROM, &copy_mess));
return(_kernel_call(SYS_SAFECOPYFROM, &copy_mess));
}
@ -43,6 +43,6 @@ PUBLIC int sys_safecopyto(endpoint_t dst_e,
copy_mess.SCP_ADDRESS = (char *) address;
copy_mess.SCP_BYTES = (long) bytes;
return(_taskcall(SYSTASK, SYS_SAFECOPYTO, &copy_mess));
return(_kernel_call(SYS_SAFECOPYTO, &copy_mess));
}

View file

@ -24,7 +24,7 @@ PUBLIC int sys_safemap(endpoint_t grantor, cp_grant_id_t grant,
copy_mess.SMAP_BYTES = bytes;
copy_mess.SMAP_FLAG = writable;
return(_taskcall(SYSTASK, SYS_SAFEMAP, &copy_mess));
return(_kernel_call(SYS_SAFEMAP, &copy_mess));
}
@ -39,7 +39,7 @@ PUBLIC int sys_saferevmap_gid(cp_grant_id_t grant)
copy_mess.SMAP_FLAG = 1;
copy_mess.SMAP_GID = grant;
return(_taskcall(SYSTASK, SYS_SAFEREVMAP, &copy_mess));
return(_kernel_call(SYS_SAFEREVMAP, &copy_mess));
}
/*===========================================================================*
@ -53,7 +53,7 @@ PUBLIC int sys_saferevmap_addr(vir_bytes addr)
copy_mess.SMAP_FLAG = 0;
copy_mess.SMAP_GID = addr;
return(_taskcall(SYSTASK, SYS_SAFEREVMAP, &copy_mess));
return(_kernel_call(SYS_SAFEREVMAP, &copy_mess));
}
/*===========================================================================*
@ -67,6 +67,6 @@ PUBLIC int sys_safeunmap(int my_seg, vir_bytes my_address)
copy_mess.SMAP_SEG = (void*) my_seg;
copy_mess.SMAP_ADDRESS = my_address;
return(_taskcall(SYSTASK, SYS_SAFEUNMAP, &copy_mess));
return(_kernel_call(SYS_SAFEUNMAP, &copy_mess));
}

View file

@ -21,6 +21,6 @@ vir_bytes offset; /* offset from grant */
m_io.DIO_VEC_SIZE = count;
m_io.DIO_OFFSET = offset;
return(_taskcall(SYSTASK, SYS_SDEVIO, &m_io));
return(_kernel_call(SYS_SDEVIO, &m_io));
}

View file

@ -14,7 +14,7 @@ vir_bytes size; /* size of segment */
int s;
m.SEG_PHYS = phys;
m.SEG_SIZE = size;
s = _taskcall(SYSTASK, SYS_SEGCTL, &m);
s = _kernel_call(SYS_SEGCTL, &m);
*index = (int) m.SEG_INDEX;
*seg = (u16_t) m.SEG_SELECT;
*off = (vir_bytes) m.SEG_OFFSET;

View file

@ -13,6 +13,6 @@ int abs_time; /* use absolute or relative expiration time */
message m;
m.ALRM_EXP_TIME = exp_time; /* the expiration time */
m.ALRM_ABS_TIME = abs_time; /* time is absolute? */
return _taskcall(SYSTASK, SYS_SETALARM, &m);
return _kernel_call(SYS_SETALARM, &m);
}

View file

@ -10,5 +10,5 @@ int sys_setgrant(cp_grant_t *grants, int ngrants)
m.SG_ADDR = (char *) grants;
m.SG_SIZE = ngrants;
return _taskcall(SYSTASK, SYS_SETGRANT, &m);
return _kernel_call(SYS_SETGRANT, &m);
}

View file

@ -12,7 +12,7 @@ struct sigmsg *sig_ctxt; /* POSIX style handling */
m.SIG_ENDPT = proc_ep;
m.SIG_CTXT_PTR = (char *) sig_ctxt;
result = _taskcall(SYSTASK, SYS_SIGRETURN, &m);
result = _kernel_call(SYS_SIGRETURN, &m);
return(result);
}

View file

@ -12,7 +12,7 @@ struct sigmsg *sig_ctxt; /* POSIX style handling */
m.SIG_ENDPT = proc_ep;
m.SIG_CTXT_PTR = (char *) sig_ctxt;
result = _taskcall(SYSTASK, SYS_SIGSEND, &m);
result = _kernel_call(SYS_SIGSEND, &m);
return(result);
}

View file

@ -22,7 +22,7 @@ void *mem_ptr; /* location of profiling memory */
m.PROF_CTL_PTR = ctl_ptr;
m.PROF_MEM_PTR = mem_ptr;
return(_taskcall(SYSTASK, SYS_SPROF, &m));
return(_kernel_call(SYS_SPROF, &m));
}
#endif

View file

@ -7,6 +7,6 @@ time_t boottime; /* New boottime */
int r;
m.T_BOOTTIME = boottime;
r = _taskcall(SYSTASK, SYS_STIME, &m);
r = _kernel_call(SYS_STIME, &m);
return(r);
}

View file

@ -9,7 +9,7 @@ PUBLIC int sys_sysctl(int code, char *arg1, int arg2)
m.SYSCTL_ARG1 = arg1;
m.SYSCTL_ARG2 = arg2;
return(_taskcall(SYSTASK, SYS_SYSCTL, &m));
return(_kernel_call(SYS_SYSCTL, &m));
}

View file

@ -14,7 +14,7 @@ time_t *boottime; /* boot time */
int r;
m.T_ENDPT = proc_ep;
r = _taskcall(SYSTASK, SYS_TIMES, &m);
r = _kernel_call(SYS_TIMES, &m);
if (user_time) *user_time = m.T_USER_TIME;
if (sys_time) *sys_time = m.T_SYSTEM_TIME;
if (uptime) *uptime = m.T_BOOT_TICKS;

View file

@ -12,7 +12,7 @@ long addr, *data_p;
m.CTL_REQUEST = req;
m.CTL_ADDRESS = addr;
if (data_p) m.CTL_DATA = *data_p;
r = _taskcall(SYSTASK, SYS_TRACE, &m);
r = _kernel_call(SYS_TRACE, &m);
if (data_p) *data_p = m.CTL_DATA;
return(r);
}

View file

@ -18,7 +18,7 @@ phys_bytes *phys_addr; /* placeholder for result */
m.CP_SRC_ADDR = vir_addr;
m.CP_NR_BYTES = bytes;
result = _taskcall(SYSTASK, SYS_UMAP, &m);
result = _kernel_call(SYS_UMAP, &m);
*phys_addr = m.CP_DST_ADDR;
return(result);
}

View file

@ -12,6 +12,6 @@ int nr_ports; /* nr of pairs to be processed */
m_io.DIO_REQUEST = _DIO_INPUT | _DIO_BYTE;
m_io.DIO_VEC_ADDR = (char *) pvb_pairs;
m_io.DIO_VEC_SIZE = nr_ports;
return _taskcall(SYSTASK, SYS_VDEVIO, &m_io);
return _kernel_call(SYS_VDEVIO, &m_io);
}

View file

@ -12,6 +12,6 @@ int nr_ports; /* nr of pairs to be processed */
m_io.DIO_REQUEST = _DIO_INPUT | _DIO_LONG;
m_io.DIO_VEC_ADDR = (char *) pvl_pairs;
m_io.DIO_VEC_SIZE = nr_ports;
return _taskcall(SYSTASK, SYS_VDEVIO, &m_io);
return _kernel_call(SYS_VDEVIO, &m_io);
}

View file

@ -13,6 +13,6 @@ int nr_ports; /* nr of pairs to be processed */
m_io.DIO_REQUEST = _DIO_WORD | _DIO_INPUT;
m_io.DIO_VEC_ADDR = (char *) pvw_pairs;
m_io.DIO_VEC_SIZE = nr_ports;
return _taskcall(SYSTASK, SYS_VDEVIO, &m_io);
return _kernel_call(SYS_VDEVIO, &m_io);
}

View file

@ -25,5 +25,5 @@ phys_bytes bytes; /* how many bytes */
copy_mess.CP_DST_SPACE = dst_seg;
copy_mess.CP_DST_ADDR = (long) dst_vir;
copy_mess.CP_NR_BYTES = (long) bytes;
return(_taskcall(SYSTASK, SYS_VIRCOPY, &copy_mess));
return(_kernel_call(SYS_VIRCOPY, &copy_mess));
}

View file

@ -8,7 +8,7 @@ PUBLIC int sys_vmctl(endpoint_t who, int param, u32_t value)
m.SVMCTL_WHO = who;
m.SVMCTL_PARAM = param;
m.SVMCTL_VALUE = value;
r = _taskcall(SYSTASK, SYS_VMCTL, &m);
r = _kernel_call(SYS_VMCTL, &m);
return(r);
}
@ -19,7 +19,7 @@ PUBLIC int sys_vmctl_get_pagefault_i386(endpoint_t *who, u32_t *cr2, u32_t *err)
m.SVMCTL_WHO = SELF;
m.SVMCTL_PARAM = VMCTL_GET_PAGEFAULT;
r = _taskcall(SYSTASK, SYS_VMCTL, &m);
r = _kernel_call(SYS_VMCTL, &m);
if(r == OK) {
*who = m.SVMCTL_PF_WHO;
*cr2 = m.SVMCTL_PF_I386_CR2;
@ -35,7 +35,7 @@ PUBLIC int sys_vmctl_get_cr3_i386(endpoint_t who, u32_t *cr3)
m.SVMCTL_WHO = who;
m.SVMCTL_PARAM = VMCTL_I386_GETCR3;
r = _taskcall(SYSTASK, SYS_VMCTL, &m);
r = _kernel_call(SYS_VMCTL, &m);
if(r == OK) {
*cr3 = m.SVMCTL_VALUE;
}
@ -51,7 +51,7 @@ PUBLIC int sys_vmctl_get_memreq(endpoint_t *who, vir_bytes *mem,
m.SVMCTL_WHO = SELF;
m.SVMCTL_PARAM = VMCTL_MEMREQ_GET;
r = _taskcall(SYSTASK, SYS_VMCTL, &m);
r = _kernel_call(SYS_VMCTL, &m);
if(r >= 0) {
*who = m.SVMCTL_MRG_TARGET;
*mem = m.SVMCTL_MRG_ADDR;
@ -70,7 +70,7 @@ PUBLIC int sys_vmctl_enable_paging(struct mem_map *map)
m.SVMCTL_WHO = SELF;
m.SVMCTL_PARAM = VMCTL_ENABLE_PAGING;
m.SVMCTL_VALUE = (int) map;
return _taskcall(SYSTASK, SYS_VMCTL, &m);
return _kernel_call(SYS_VMCTL, &m);
}
PUBLIC int sys_vmctl_get_mapping(int index,
@ -83,7 +83,7 @@ PUBLIC int sys_vmctl_get_mapping(int index,
m.SVMCTL_PARAM = VMCTL_KERN_PHYSMAP;
m.SVMCTL_VALUE = (int) index;
r = _taskcall(SYSTASK, SYS_VMCTL, &m);
r = _kernel_call(SYS_VMCTL, &m);
if(r != OK)
return r;
@ -105,5 +105,5 @@ PUBLIC int sys_vmctl_reply_mapping(int index, vir_bytes addr)
m.SVMCTL_VALUE = index;
m.SVMCTL_MAP_VIR_ADDR = (char *) addr;
return _taskcall(SYSTASK, SYS_VMCTL, &m);
return _kernel_call(SYS_VMCTL, &m);
}

View file

@ -11,7 +11,7 @@ int nr_ports; /* nr of pairs to be processed */
m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_BYTE;
m_io.DIO_VEC_ADDR = (char *) pvb_pairs;
m_io.DIO_VEC_SIZE = nr_ports;
return _taskcall(SYSTASK, SYS_VDEVIO, &m_io);
return _kernel_call(SYS_VDEVIO, &m_io);
}

View file

@ -12,6 +12,6 @@ int nr_ports; /* nr of pairs to be processed */
m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_LONG;
m_io.DIO_VEC_ADDR = (char *) pvl_pairs;
m_io.DIO_VEC_SIZE = nr_ports;
return _taskcall(SYSTASK, SYS_VDEVIO, &m_io);
return _kernel_call(SYS_VDEVIO, &m_io);
}

View file

@ -13,6 +13,6 @@ int nr_ports; /* nr of pairs to be processed */
m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_WORD;
m_io.DIO_VEC_ADDR = (char *) pvw_pairs;
m_io.DIO_VEC_SIZE = nr_ports;
return _taskcall(SYSTASK, SYS_VDEVIO, &m_io);
return _kernel_call(SYS_VDEVIO, &m_io);
}

View file

@ -12,7 +12,7 @@ PUBLIC int sys_vsafecopy(struct vscp_vec *vec, int els)
copy_mess.VSCP_VEC_ADDR = (char *) vec;
copy_mess.VSCP_VEC_SIZE = els;
return(_taskcall(SYSTASK, SYS_VSAFECOPY, &copy_mess));
return(_kernel_call(SYS_VSAFECOPY, &copy_mess));
}

View file

@ -18,7 +18,7 @@ clock_t *oldval; /* if non-NULL, old value is stored here */
m.VT_SET = 0;
}
r = _taskcall(SYSTASK, SYS_VTIMER, &m);
r = _kernel_call(SYS_VTIMER, &m);
if (oldval != NULL) {
*oldval = m.VT_VALUE;

View file

@ -55,7 +55,7 @@ int max_len; /* maximum length of value */
m.I_ENDPT = SELF;
m.I_VAL_LEN = sizeof(mon_params);
m.I_VAL_PTR = mon_params;
if ((s=_taskcall(SYSTASK, SYS_GETINFO, &m)) != OK) {
if ((s=_kernel_call(SYS_GETINFO, &m)) != OK) {
printf("SYS_GETINFO: %d (size %u)\n", s, sizeof(mon_params));
return(s);
}

View file

@ -11,7 +11,7 @@ clock_t *ticks; /* uptime in ticks */
m.m_type = SYS_TIMES; /* request time information */
m.T_ENDPT = NONE; /* ignore process times */
s = _taskcall(SYSTASK, SYS_TIMES, &m);
s = _kernel_call(SYS_TIMES, &m);
*ticks = m.T_BOOT_TICKS;
return(s);
}

View file

@ -12,7 +12,7 @@ time_t *boottime;
m.m_type = SYS_TIMES; /* request time information */
m.T_ENDPT = NONE; /* ignore process times */
s = _taskcall(SYSTASK, SYS_TIMES, &m);
s = _kernel_call(SYS_TIMES, &m);
*ticks = m.T_BOOT_TICKS;
*boottime = m.T_BOOTTIME;
return(s);

View file

@ -20,7 +20,7 @@ long ticks; /* number of ticks to wait */
m.ALRM_EXP_TIME = ticks; /* request message after ticks */
m.ALRM_ABS_TIME = 0; /* ticks are relative to now */
s = _taskcall(SYSTASK, SYS_SETALARM, &m);
s = _kernel_call(SYS_SETALARM, &m);
if (s != OK) return(s);
receive(CLOCK,&m_alarm); /* await synchronous alarm */
@ -30,7 +30,7 @@ long ticks; /* number of ticks to wait */
m.ALRM_EXP_TIME = m.ALRM_TIME_LEFT - ticks;
if (m.ALRM_EXP_TIME <= 0)
m.ALRM_EXP_TIME = 1;
s = _taskcall(SYSTASK, SYS_SETALARM, &m);
s = _kernel_call(SYS_SETALARM, &m);
}
return(s);