From 728f0f0c499b1d01661bb2b59ccde8f6ed19c664 Mon Sep 17 00:00:00 2001 From: Tomas Hruby Date: Tue, 9 Feb 2010 15:20:09 +0000 Subject: [PATCH] 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 --- include/ibm/interrupt.h | 4 +- include/minix/ipc.h | 2 + include/minix/syslib.h | 1 + kernel/arch/i386/apic.c | 3 +- kernel/arch/i386/do_int86.c | 4 +- kernel/arch/i386/exception.c | 2 +- kernel/arch/i386/mpx386.S | 32 +++++- kernel/arch/i386/protect.c | 3 +- kernel/const.h | 4 +- kernel/debug.c | 1 + kernel/glo.h | 1 - kernel/main.c | 2 + kernel/proc.c | 12 +- kernel/proc.h | 6 + kernel/profile.c | 4 +- kernel/proto.h | 3 +- kernel/system.c | 211 ++++++++++++++++------------------- kernel/system/do_abort.c | 5 +- kernel/system/do_cprofile.c | 8 +- kernel/system/do_exec.c | 2 +- kernel/system/do_getinfo.c | 2 +- kernel/system/do_newmap.c | 2 +- kernel/system/do_privctl.c | 8 +- kernel/system/do_safecopy.c | 4 +- kernel/system/do_sigreturn.c | 2 +- kernel/system/do_sigsend.c | 6 +- kernel/system/do_sprofile.c | 2 +- kernel/system/do_sysctl.c | 2 +- kernel/system/do_trace.c | 4 +- kernel/system/do_vdevio.c | 17 +-- kernel/system/do_vmctl.c | 12 +- kernel/table.c | 2 +- lib/i386/rts/_ipc.s | 21 ++-- lib/syslib/Makefile.in | 1 + lib/syslib/sys_abort.c | 2 +- lib/syslib/sys_cprof.c | 2 +- lib/syslib/sys_endsig.c | 2 +- lib/syslib/sys_eniop.c | 2 +- lib/syslib/sys_exec.c | 2 +- lib/syslib/sys_exit.c | 2 +- lib/syslib/sys_fork.c | 2 +- lib/syslib/sys_getinfo.c | 4 +- lib/syslib/sys_getsig.c | 2 +- lib/syslib/sys_in.c | 2 +- lib/syslib/sys_int86.c | 2 +- lib/syslib/sys_irqctl.c | 2 +- lib/syslib/sys_kill.c | 2 +- lib/syslib/sys_memset.c | 2 +- lib/syslib/sys_newmap.c | 2 +- lib/syslib/sys_nice.c | 2 +- lib/syslib/sys_out.c | 2 +- lib/syslib/sys_physcopy.c | 2 +- lib/syslib/sys_privctl.c | 4 +- lib/syslib/sys_profbuf.c | 2 +- lib/syslib/sys_readbios.c | 2 +- lib/syslib/sys_runctl.c | 2 +- lib/syslib/sys_safecopy.c | 4 +- lib/syslib/sys_safemap.c | 8 +- lib/syslib/sys_sdevio.c | 2 +- lib/syslib/sys_segctl.c | 2 +- lib/syslib/sys_setalarm.c | 2 +- lib/syslib/sys_setgrant.c | 2 +- lib/syslib/sys_sigreturn.c | 2 +- lib/syslib/sys_sigsend.c | 2 +- lib/syslib/sys_sprof.c | 2 +- lib/syslib/sys_stime.c | 2 +- lib/syslib/sys_sysctl.c | 2 +- lib/syslib/sys_times.c | 2 +- lib/syslib/sys_trace.c | 2 +- lib/syslib/sys_umap.c | 2 +- lib/syslib/sys_vinb.c | 2 +- lib/syslib/sys_vinl.c | 2 +- lib/syslib/sys_vinw.c | 2 +- lib/syslib/sys_vircopy.c | 2 +- lib/syslib/sys_vmctl.c | 14 +-- lib/syslib/sys_voutb.c | 2 +- lib/syslib/sys_voutl.c | 2 +- lib/syslib/sys_voutw.c | 2 +- lib/syslib/sys_vsafecopy.c | 2 +- lib/syslib/sys_vtimer.c | 2 +- lib/sysutil/env_get_prm.c | 2 +- lib/sysutil/getuptime.c | 2 +- lib/sysutil/getuptime2.c | 2 +- lib/sysutil/tickdelay.c | 4 +- 84 files changed, 273 insertions(+), 248 deletions(-) diff --git a/include/ibm/interrupt.h b/include/ibm/interrupt.h index 53d452f80..66dab2bc6 100644 --- a/include/ibm/interrupt.h +++ b/include/ibm/interrupt.h @@ -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 diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 58c7c8a8f..6302db085 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -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 */ diff --git a/include/minix/syslib.h b/include/minix/syslib.h index c0c1df9ff..8b89af9ef 100644 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -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)); diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 2b3493606..fc3f0c2c8 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -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} }; diff --git a/kernel/arch/i386/do_int86.c b/kernel/arch/i386/do_int86.c index 5a646acc7..3914bf2d5 100644 --- a/kernel/arch/i386/do_int86.c +++ b/kernel/arch/i386/do_int86.c @@ -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) ®86, sizeof(reg86)); + KERNEL, (vir_bytes) ®86, sizeof(reg86)); level0(int86); /* Copy results back to the caller */ - data_copy(SYSTEM, (vir_bytes) ®86, + data_copy(KERNEL, (vir_bytes) ®86, caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86, sizeof(reg86)); /* The BIOS call eats interrupts. Call get_randomness to generate some diff --git a/kernel/arch/i386/exception.c b/kernel/arch/i386/exception.c index 8f53c8f4b..2144e8a94 100644 --- a/kernel/arch/i386/exception.c +++ b/kernel/arch/i386/exception.c @@ -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); diff --git a/kernel/arch/i386/mpx386.S b/kernel/arch/i386/mpx386.S index 321bc59a5..3eb81a507 100644 --- a/kernel/arch/i386/mpx386.S +++ b/kernel/arch/i386/mpx386.S @@ -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 diff --git a/kernel/arch/i386/protect.c b/kernel/arch/i386/protect.c index c5ffc626d..42abc6c34 100644 --- a/kernel/arch/i386/protect.c +++ b/kernel/arch/i386/protect.c @@ -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} }; diff --git a/kernel/const.h b/kernel/const.h index aa0ec7a7d..9be211045 100644 --- a/kernel/const.h +++ b/kernel/const.h @@ -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. diff --git a/kernel/debug.c b/kernel/debug.c index 6050ab48f..6dd91e1ac 100644 --- a/kernel/debug.c +++ b/kernel/debug.c @@ -145,6 +145,7 @@ miscflagstr(int flags) FLAG(MF_ASYNMSG); FLAG(MF_FULLVM); FLAG(MF_DELIVERMSG); + FLAG(MF_KCALL_RESUME); return str; } diff --git a/kernel/glo.h b/kernel/glo.h index cac8fba72..3e48708aa 100644 --- a/kernel/glo.h +++ b/kernel/glo.h @@ -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 */ diff --git a/kernel/main.c b/kernel/main.c index 16b859e39..0f67f0f96 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -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); } diff --git a/kernel/proc.c b/kernel/proc.c index 04062a105..f8eeb427e 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -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) {\ diff --git a/kernel/proc.h b/kernel/proc.h index 8abca51fa..20a35d0d3 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -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 */ diff --git a/kernel/profile.c b/kernel/profile.c index 76f5e30fe..1a387e54f 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -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)); diff --git a/kernel/proto.h b/kernel/proto.h index 8fdf923ed..219333ff9 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -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, diff --git a/kernel/system.c b/kernel/system.c index 2e7d5d71b..03d7558ab 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -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; + } + } + } +} -/*===========================================================================* - * sys_task * - *===========================================================================*/ -PUBLIC void sys_task() +PRIVATE int kernel_call_dispatch(struct proc * caller, message *msg) { -/* 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 result = OK; int call_nr; - int who_p; - endpoint_t who_e; - - 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); + 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 */ + /* 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); + call_nr,msg->m_source); result = EBADREQUEST; /* illegal message type */ - } - else if (!GET_BIT(priv(caller_ptr)->s_k_call_mask, call_nr)) { + } + else if (!GET_BIT(priv(caller)->s_k_call_mask, call_nr)) { result = ECALLDENIED; /* illegal message type */ - } - else { + } else { /* handle the system call */ - result = (*call_vec[call_nr])(caller_ptr, &m); - } + result = (*call_vec[call_nr])(caller, msg); + } - 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); - } - } + return result; +} + +/*===========================================================================* + * kernel_call * + *===========================================================================*/ +/* + * 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) +{ + int result = OK; + message msg; + + 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; - - /* Anyone waiting to be vm-restarted? */ - - if(!(restarting = vmrestart)) - return NULL; - - vmassert(!RTS_ISSET(restarting, RTS_SLOT_FREE)); - vmassert(RTS_ISSET(restarting, RTS_VMREQUEST)); - - 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; + int result; + + vmassert(!RTS_ISSET(p, RTS_SLOT_FREE)); + vmassert(!RTS_ISSET(p, RTS_VMREQUEST)); + + vmassert(p->p_vmrequest.saved.reqmsg.m_source == p->p_endpoint); + + /* + 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); + */ + + /* + * 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); } diff --git a/kernel/system/do_abort.c b/kernel/system/do_abort.c index 3d9213cfd..935568b2b 100644 --- a/kernel/system/do_abort.c +++ b/kernel/system/do_abort.c @@ -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'; diff --git a/kernel/system/do_cprofile.c b/kernel/system/do_cprofile.c index 12734c490..02c925bbf 100644 --- a/kernel/system/do_cprofile.c +++ b/kernel/system/do_cprofile.c @@ -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; iPROF_ENDPT, vir_dst, len); vir_dst += CPROF_PROCNAME_LEN; diff --git a/kernel/system/do_exec.c b/kernel/system/do_exec.c index c7b2c9053..acba49a34 100644 --- a/kernel/system/do_exec.c +++ b/kernel/system/do_exec.c @@ -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, "", P_NAME_LEN); /* Do architecture-specific exec() stuff. */ diff --git a/kernel/system/do_getinfo.c b/kernel/system/do_getinfo.c index 93f88eac7..98400404c 100644 --- a/kernel/system/do_getinfo.c +++ b/kernel/system/do_getinfo.c @@ -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; diff --git a/kernel/system/do_newmap.c b/kernel/system/do_newmap.c index 848147bf5..e36ae7c71 100644 --- a/kernel/system/do_newmap.c +++ b/kernel/system/do_newmap.c @@ -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; } diff --git a/kernel/system/do_privctl.c b/kernel/system/do_privctl.c index 2c3d83fe3..64582b02e 100644 --- a/kernel/system/do_privctl.c +++ b/kernel/system/do_privctl.c @@ -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; diff --git a/kernel/system/do_safecopy.c b/kernel/system/do_safecopy.c index ff39c51a3..ffb1613c4 100644 --- a/kernel/system/do_safecopy.c +++ b/kernel/system/do_safecopy.c @@ -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. */ diff --git a/kernel/system/do_sigreturn.c b/kernel/system/do_sigreturn.c index b3f3480f4..a0c751d6e 100644 --- a/kernel/system/do_sigreturn.c +++ b/kernel/system/do_sigreturn.c @@ -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. */ diff --git a/kernel/system/do_sigsend.c b/kernel/system/do_sigsend.c index ec4be8833..0e325be2b 100644 --- a/kernel/system/do_sigsend.c +++ b/kernel/system/do_sigsend.c @@ -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; diff --git a/kernel/system/do_sprofile.c b/kernel/system/do_sprofile.c index cfb713817..a0a5824a4 100644 --- a/kernel/system/do_sprofile.c +++ b/kernel/system/do_sprofile.c @@ -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; diff --git a/kernel/system/do_sysctl.c b/kernel/system/do_sysctl.c index 2dcab01ac..c47c52e17 100644 --- a/kernel/system/do_sysctl.c +++ b/kernel/system/do_sysctl.c @@ -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); diff --git a/kernel/system/do_trace.c b/kernel/system/do_trace.c index fca014609..2e60a42a1 100644 --- a/kernel/system/do_trace.c +++ b/kernel/system/do_trace.c @@ -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); \ diff --git a/kernel/system/do_vdevio.c b/kernel/system/do_vdevio.c index 2cf12afaf..2d383f152 100644 --- a/kernel/system/do_vdevio.c +++ b/kernel/system/do_vdevio.c @@ -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; ip_endpoint, (vir_bytes) m_ptr->DIO_VEC_ADDR, (phys_bytes) bytes)) != OK) return r; diff --git a/kernel/system/do_vmctl.c b/kernel/system/do_vmctl.c index a6a65c2e7..abcaaedec 100644 --- a/kernel/system/do_vmctl.c +++ b/kernel/system/do_vmctl.c @@ -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, diff --git a/kernel/table.c b/kernel/table.c index 7ce3a240b..760d9328c 100644 --- a/kernel/table.c +++ b/kernel/table.c @@ -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" }, diff --git a/lib/i386/rts/_ipc.s b/lib/i386/rts/_ipc.s index 289414514..38a33d441 100644 --- a/lib/i386/rts/_ipc.s +++ b/lib/i386/rts/_ipc.s @@ -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 diff --git a/lib/syslib/Makefile.in b/lib/syslib/Makefile.in index 34416a6ce..fb66c52cf 100644 --- a/lib/syslib/Makefile.in +++ b/lib/syslib/Makefile.in @@ -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 \ diff --git a/lib/syslib/sys_abort.c b/lib/syslib/sys_abort.c index ab19af718..afcb79457 100644 --- a/lib/syslib/sys_abort.c +++ b/lib/syslib/sys_abort.c @@ -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)); } diff --git a/lib/syslib/sys_cprof.c b/lib/syslib/sys_cprof.c index 2b981df99..b22643c92 100644 --- a/lib/syslib/sys_cprof.c +++ b/lib/syslib/sys_cprof.c @@ -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)); } diff --git a/lib/syslib/sys_endsig.c b/lib/syslib/sys_endsig.c index 8776256b0..63dbe4d1c 100644 --- a/lib/syslib/sys_endsig.c +++ b/lib/syslib/sys_endsig.c @@ -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); } diff --git a/lib/syslib/sys_eniop.c b/lib/syslib/sys_eniop.c index bee8965fc..91b1e3d9b 100644 --- a/lib/syslib/sys_eniop.c +++ b/lib/syslib/sys_eniop.c @@ -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); } diff --git a/lib/syslib/sys_exec.c b/lib/syslib/sys_exec.c index ddcfe2780..6e5d5466d 100644 --- a/lib/syslib/sys_exec.c +++ b/lib/syslib/sys_exec.c @@ -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)); } diff --git a/lib/syslib/sys_exit.c b/lib/syslib/sys_exit.c index 1351c4d5e..bc1acad8a 100644 --- a/lib/syslib/sys_exit.c +++ b/lib/syslib/sys_exit.c @@ -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)); } diff --git a/lib/syslib/sys_fork.c b/lib/syslib/sys_fork.c index 50035847d..0282b0f84 100644 --- a/lib/syslib/sys_fork.c +++ b/lib/syslib/sys_fork.c @@ -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; diff --git a/lib/syslib/sys_getinfo.c b/lib/syslib/sys_getinfo.c index b712c6bee..5a87a786d 100644 --- a/lib/syslib/sys_getinfo.c +++ b/lib/syslib/sys_getinfo.c @@ -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; diff --git a/lib/syslib/sys_getsig.c b/lib/syslib/sys_getsig.c index c49d5ac1b..c81c09961 100644 --- a/lib/syslib/sys_getsig.c +++ b/lib/syslib/sys_getsig.c @@ -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); diff --git a/lib/syslib/sys_in.c b/lib/syslib/sys_in.c index 2a6fa0cc8..13ecce54d 100644 --- a/lib/syslib/sys_in.c +++ b/lib/syslib/sys_in.c @@ -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); } diff --git a/lib/syslib/sys_int86.c b/lib/syslib/sys_int86.c index 43897748f..86d62dc9f 100644 --- a/lib/syslib/sys_int86.c +++ b/lib/syslib/sys_int86.c @@ -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); } diff --git a/lib/syslib/sys_irqctl.c b/lib/syslib/sys_irqctl.c index d1bc051ef..abaac999d 100644 --- a/lib/syslib/sys_irqctl.c +++ b/lib/syslib/sys_irqctl.c @@ -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); } diff --git a/lib/syslib/sys_kill.c b/lib/syslib/sys_kill.c index a7e6381c1..740ca95a9 100644 --- a/lib/syslib/sys_kill.c +++ b/lib/syslib/sys_kill.c @@ -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)); } diff --git a/lib/syslib/sys_memset.c b/lib/syslib/sys_memset.c index b0755f983..dbd7423ec 100644 --- a/lib/syslib/sys_memset.c +++ b/lib/syslib/sys_memset.c @@ -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)); } diff --git a/lib/syslib/sys_newmap.c b/lib/syslib/sys_newmap.c index 176319ac7..af1416b72 100644 --- a/lib/syslib/sys_newmap.c +++ b/lib/syslib/sys_newmap.c @@ -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)); } diff --git a/lib/syslib/sys_nice.c b/lib/syslib/sys_nice.c index 97f1c4c3f..d90c53c4e 100644 --- a/lib/syslib/sys_nice.c +++ b/lib/syslib/sys_nice.c @@ -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)); } diff --git a/lib/syslib/sys_out.c b/lib/syslib/sys_out.c index f1f2a03d7..51cbfae05 100644 --- a/lib/syslib/sys_out.c +++ b/lib/syslib/sys_out.c @@ -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); } diff --git a/lib/syslib/sys_physcopy.c b/lib/syslib/sys_physcopy.c index c78ef6b24..6d16749ec 100644 --- a/lib/syslib/sys_physcopy.c +++ b/lib/syslib/sys_physcopy.c @@ -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, ©_mess)); + return(_kernel_call(SYS_PHYSCOPY, ©_mess)); } diff --git a/lib/syslib/sys_privctl.c b/lib/syslib/sys_privctl.c index 47fe42706..0c9632f92 100644 --- a/lib/syslib/sys_privctl.c +++ b/lib/syslib/sys_privctl.c @@ -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); } diff --git a/lib/syslib/sys_profbuf.c b/lib/syslib/sys_profbuf.c index 4b5b0fd53..2534f8a9d 100644 --- a/lib/syslib/sys_profbuf.c +++ b/lib/syslib/sys_profbuf.c @@ -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)); } diff --git a/lib/syslib/sys_readbios.c b/lib/syslib/sys_readbios.c index 286bb075e..8c043e53c 100644 --- a/lib/syslib/sys_readbios.c +++ b/lib/syslib/sys_readbios.c @@ -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)); } diff --git a/lib/syslib/sys_runctl.c b/lib/syslib/sys_runctl.c index fb2afc7d0..f0d35a70d 100644 --- a/lib/syslib/sys_runctl.c +++ b/lib/syslib/sys_runctl.c @@ -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)); } diff --git a/lib/syslib/sys_safecopy.c b/lib/syslib/sys_safecopy.c index df6b50f20..2a876d8ae 100644 --- a/lib/syslib/sys_safecopy.c +++ b/lib/syslib/sys_safecopy.c @@ -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, ©_mess)); + return(_kernel_call(SYS_SAFECOPYFROM, ©_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, ©_mess)); + return(_kernel_call(SYS_SAFECOPYTO, ©_mess)); } diff --git a/lib/syslib/sys_safemap.c b/lib/syslib/sys_safemap.c index 8621dfe2e..26bfbcbb4 100644 --- a/lib/syslib/sys_safemap.c +++ b/lib/syslib/sys_safemap.c @@ -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, ©_mess)); + return(_kernel_call(SYS_SAFEMAP, ©_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, ©_mess)); + return(_kernel_call(SYS_SAFEREVMAP, ©_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, ©_mess)); + return(_kernel_call(SYS_SAFEREVMAP, ©_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, ©_mess)); + return(_kernel_call(SYS_SAFEUNMAP, ©_mess)); } diff --git a/lib/syslib/sys_sdevio.c b/lib/syslib/sys_sdevio.c index e6bfcb2f8..c9066d56b 100644 --- a/lib/syslib/sys_sdevio.c +++ b/lib/syslib/sys_sdevio.c @@ -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)); } diff --git a/lib/syslib/sys_segctl.c b/lib/syslib/sys_segctl.c index 84deecbba..c9cb6f28d 100644 --- a/lib/syslib/sys_segctl.c +++ b/lib/syslib/sys_segctl.c @@ -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; diff --git a/lib/syslib/sys_setalarm.c b/lib/syslib/sys_setalarm.c index 50f330271..6d6331575 100644 --- a/lib/syslib/sys_setalarm.c +++ b/lib/syslib/sys_setalarm.c @@ -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); } diff --git a/lib/syslib/sys_setgrant.c b/lib/syslib/sys_setgrant.c index 6d2c96daf..39d719690 100644 --- a/lib/syslib/sys_setgrant.c +++ b/lib/syslib/sys_setgrant.c @@ -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); } diff --git a/lib/syslib/sys_sigreturn.c b/lib/syslib/sys_sigreturn.c index 3d6ebdd6b..38f2c9537 100644 --- a/lib/syslib/sys_sigreturn.c +++ b/lib/syslib/sys_sigreturn.c @@ -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); } diff --git a/lib/syslib/sys_sigsend.c b/lib/syslib/sys_sigsend.c index 94faaeb60..39f643ce7 100644 --- a/lib/syslib/sys_sigsend.c +++ b/lib/syslib/sys_sigsend.c @@ -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); } diff --git a/lib/syslib/sys_sprof.c b/lib/syslib/sys_sprof.c index 6e2fe423b..6b72a7221 100644 --- a/lib/syslib/sys_sprof.c +++ b/lib/syslib/sys_sprof.c @@ -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 diff --git a/lib/syslib/sys_stime.c b/lib/syslib/sys_stime.c index 9a9cffe01..94034e12a 100644 --- a/lib/syslib/sys_stime.c +++ b/lib/syslib/sys_stime.c @@ -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); } diff --git a/lib/syslib/sys_sysctl.c b/lib/syslib/sys_sysctl.c index 80ee821c3..e9458656b 100644 --- a/lib/syslib/sys_sysctl.c +++ b/lib/syslib/sys_sysctl.c @@ -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)); } diff --git a/lib/syslib/sys_times.c b/lib/syslib/sys_times.c index 68982489f..714fd419c 100644 --- a/lib/syslib/sys_times.c +++ b/lib/syslib/sys_times.c @@ -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; diff --git a/lib/syslib/sys_trace.c b/lib/syslib/sys_trace.c index 471c435c8..003d7f3bf 100644 --- a/lib/syslib/sys_trace.c +++ b/lib/syslib/sys_trace.c @@ -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); } diff --git a/lib/syslib/sys_umap.c b/lib/syslib/sys_umap.c index 6c5909a6f..0f4f5a371 100644 --- a/lib/syslib/sys_umap.c +++ b/lib/syslib/sys_umap.c @@ -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); } diff --git a/lib/syslib/sys_vinb.c b/lib/syslib/sys_vinb.c index af1cc2be7..c973fd7bc 100644 --- a/lib/syslib/sys_vinb.c +++ b/lib/syslib/sys_vinb.c @@ -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); } diff --git a/lib/syslib/sys_vinl.c b/lib/syslib/sys_vinl.c index 1649a76e3..e2ef972dd 100644 --- a/lib/syslib/sys_vinl.c +++ b/lib/syslib/sys_vinl.c @@ -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); } diff --git a/lib/syslib/sys_vinw.c b/lib/syslib/sys_vinw.c index c2ba3eeb7..168186511 100644 --- a/lib/syslib/sys_vinw.c +++ b/lib/syslib/sys_vinw.c @@ -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); } diff --git a/lib/syslib/sys_vircopy.c b/lib/syslib/sys_vircopy.c index 65af1be3b..6690216d8 100644 --- a/lib/syslib/sys_vircopy.c +++ b/lib/syslib/sys_vircopy.c @@ -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, ©_mess)); + return(_kernel_call(SYS_VIRCOPY, ©_mess)); } diff --git a/lib/syslib/sys_vmctl.c b/lib/syslib/sys_vmctl.c index a6aa159fe..ea0e256be 100644 --- a/lib/syslib/sys_vmctl.c +++ b/lib/syslib/sys_vmctl.c @@ -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); } diff --git a/lib/syslib/sys_voutb.c b/lib/syslib/sys_voutb.c index 42467274e..040d9dddb 100644 --- a/lib/syslib/sys_voutb.c +++ b/lib/syslib/sys_voutb.c @@ -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); } diff --git a/lib/syslib/sys_voutl.c b/lib/syslib/sys_voutl.c index 1cec294d9..8cf7f2b07 100644 --- a/lib/syslib/sys_voutl.c +++ b/lib/syslib/sys_voutl.c @@ -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); } diff --git a/lib/syslib/sys_voutw.c b/lib/syslib/sys_voutw.c index 107e2ecde..a497e3b60 100644 --- a/lib/syslib/sys_voutw.c +++ b/lib/syslib/sys_voutw.c @@ -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); } diff --git a/lib/syslib/sys_vsafecopy.c b/lib/syslib/sys_vsafecopy.c index e89f19a5e..e223a5014 100644 --- a/lib/syslib/sys_vsafecopy.c +++ b/lib/syslib/sys_vsafecopy.c @@ -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, ©_mess)); + return(_kernel_call(SYS_VSAFECOPY, ©_mess)); } diff --git a/lib/syslib/sys_vtimer.c b/lib/syslib/sys_vtimer.c index 9ec2efc33..2e3706866 100644 --- a/lib/syslib/sys_vtimer.c +++ b/lib/syslib/sys_vtimer.c @@ -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; diff --git a/lib/sysutil/env_get_prm.c b/lib/sysutil/env_get_prm.c index 12bc7c741..07ff1fe8b 100644 --- a/lib/sysutil/env_get_prm.c +++ b/lib/sysutil/env_get_prm.c @@ -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); } diff --git a/lib/sysutil/getuptime.c b/lib/sysutil/getuptime.c index 4dd76a1ca..481826224 100644 --- a/lib/sysutil/getuptime.c +++ b/lib/sysutil/getuptime.c @@ -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); } diff --git a/lib/sysutil/getuptime2.c b/lib/sysutil/getuptime2.c index 764f7f7f3..ad7a0497e 100644 --- a/lib/sysutil/getuptime2.c +++ b/lib/sysutil/getuptime2.c @@ -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); diff --git a/lib/sysutil/tickdelay.c b/lib/sysutil/tickdelay.c index 2b813f9a1..096b36006 100644 --- a/lib/sysutil/tickdelay.c +++ b/lib/sysutil/tickdelay.c @@ -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); -- 2.44.0