Cleaned up system call library.
Added new alert() trap to replace notify() --- current notify will be removed
and alert() will be called notify() later.
.sect .text; .sect .rom; .sect .data; .sect .bss
-.define __echo, __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
+.define __echo, __alert, __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
! See src/kernel/ipc.h for C definitions
ECHO = 0
RECEIVE = 2
SENDREC = 3 + 32 ! flags 0x20 to request fresh answer
NOTIFY = 4
+ALERT = 5
NB_SEND = 1 + 16 ! flags 0x10 to prevent blocking
NB_RECEIVE = 2 + 16 ! flags 0x10 to prevent blocking
SYSVEC = 33 ! trap to kernel
! IPC assembly routines *
!*========================================================================*
! all message passing routines save ebp, but destroy eax and ecx.
-.define __echo, __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
+.define __echo, __alert, __send, __nb_send, __receive, __nb_receive, __sendrec, __notify
.sect .text
__send:
push ebp
pop ebp
ret
+__alert:
+ push ebp
+ mov ebp, esp
+ push ebx
+ mov eax, SRC_DST(ebp) ! ebx = destination
+ mov ecx, ALERT ! _echo(srcdest, ptr)
+ int SYSVEC ! trap to the kernel
+ pop ebx
+ pop ebp
+ ret
+
__echo:
push ebp
mov ebp, esp
LIBSYS = ../libsys.a
all: $(LIBSYS)
+clean:
+ rm *.o
+
OBJECTS = \
$(LIBSYS)(sys_times.o) \
- $(LIBSYS)(sys_getuptm.o) \
$(LIBSYS)(sys_abort.o) \
$(LIBSYS)(sys_exec.o) \
$(LIBSYS)(sys_fork.o) \
$(LIBSYS)(sys_kill.o) \
$(LIBSYS)(sys_newmap.o) \
$(LIBSYS)(sys_sigsend.o) \
- $(LIBSYS)(sys_sigret.o) \
+ $(LIBSYS)(sys_sigreturn.o) \
$(LIBSYS)(sys_endsig.o) \
$(LIBSYS)(sys_getsig.o) \
$(LIBSYS)(sys_svrctl.o) \
$(LIBSYS)(sys_trace.o) \
- $(LIBSYS)(sys_xit.o) \
+ $(LIBSYS)(sys_exit.o) \
$(LIBSYS)(sys_sdevio.o) \
$(LIBSYS)(sys_getinfo.o) \
$(LIBSYS)(sys_irqctl.o) \
- $(LIBSYS)(sys_eniop.o) \
$(LIBSYS)(sys_segctl.o) \
$(LIBSYS)(sys_setpriority.o) \
$(LIBSYS)(sys_umap.o) \
- $(LIBSYS)(sys_physcp.o) \
- $(LIBSYS)(sys_vircp.o) \
+ $(LIBSYS)(sys_physcopy.o) \
+ $(LIBSYS)(sys_vircopy.o) \
$(LIBSYS)(sys_in.o) \
$(LIBSYS)(sys_out.o) \
$(LIBSYS)(sys_vinb.o) \
$(LIBSYS)(sys_voutb.o) \
$(LIBSYS)(sys_voutw.o) \
$(LIBSYS)(sys_voutl.o) \
- $(LIBSYS)(sys_signalrm.o) \
- $(LIBSYS)(sys_syncalrm.o) \
- $(LIBSYS)(sys_physzero.o) \
+ $(LIBSYS)(sys_setalarm.o) \
+ $(LIBSYS)(sys_memset.o) \
$(LIBSYS)(taskcall.o) \
$(LIBSYS): $(OBJECTS)
$(LIBSYS)(sys_trace.o): sys_trace.c
$(CC1) sys_trace.c
-$(LIBSYS)(sys_xit.o): sys_xit.c
- $(CC1) sys_xit.c
+$(LIBSYS)(sys_exit.o): sys_exit.c
+ $(CC1) sys_exit.c
$(LIBSYS)(sys_sdevio.o): sys_sdevio.c
$(CC1) sys_sdevio.c
$(LIBSYS)(sys_sigsend.o): sys_sigsend.c
$(CC1) sys_sigsend.c
-$(LIBSYS)(sys_sigret.o): sys_sigret.c
- $(CC1) sys_sigret.c
+$(LIBSYS)(sys_sigreturn.o): sys_sigreturn.c
+ $(CC1) sys_sigreturn.c
-$(LIBSYS)(sys_physcp.o): sys_physcp.c
- $(CC1) sys_physcp.c
+$(LIBSYS)(sys_physcopy.o): sys_physcopy.c
+ $(CC1) sys_physcopy.c
-$(LIBSYS)(sys_vircp.o): sys_vircp.c
- $(CC1) sys_vircp.c
+$(LIBSYS)(sys_vircopy.o): sys_vircopy.c
+ $(CC1) sys_vircopy.c
$(LIBSYS)(sys_out.o): sys_out.c
$(CC1) sys_out.c
$(LIBSYS)(sys_vinl.o): sys_vinl.c
$(CC1) sys_vinl.c
-$(LIBSYS)(sys_signalrm.o): sys_signalrm.c
- $(CC1) sys_signalrm.c
-
-$(LIBSYS)(sys_syncalrm.o): sys_syncalrm.c
- $(CC1) sys_syncalrm.c
+$(LIBSYS)(sys_setalarm.o): sys_setalarm.c
+ $(CC1) sys_setalarm.c
-$(LIBSYS)(sys_physzero.o): sys_physcp.c
- $(CC1) sys_physzero.c
+$(LIBSYS)(sys_memset.o): sys_memset.c
+ $(CC1) sys_memset.c
$(LIBSYS)(taskcall.o): taskcall.c
$(CC1) taskcall.c
#include "syslib.h"
/*===========================================================================*
- * sys_endsig *
+ * sys_endksig *
*===========================================================================*/
-PUBLIC int sys_endsig(proc_nr)
+PUBLIC int sys_endksig(proc_nr)
int proc_nr; /* process number */
{
message m;
int result;
m.SIG_PROC = proc_nr;
- result = _taskcall(SYSTASK, SYS_ENDSIG, &m);
+ result = _taskcall(SYSTASK, SYS_ENDKSIG, &m);
return(result);
}
+++ /dev/null
-#include "syslib.h"
-
-/*===========================================================================*
- * sys_enable_iop *
- *===========================================================================*/
-PUBLIC int sys_enable_iop(proc_nr)
-int proc_nr; /* number of process to allow I/O */
-{
- message m_iop;
- m_iop.PROC_NR = proc_nr;
- return _taskcall(SYSTASK, SYS_IOPENABLE, &m_iop);
-}
-
-
+++ /dev/null
-#include "syslib.h"
-
-/*===========================================================================*
- * sys_enable_irq *
- *===========================================================================*/
-PUBLIC int sys_enable_irq(int irq_nr)
-{
- message m_irq;
- m_irq.IRQ_NR = irq_nr;
- m_irq.IRQ_CTL_OP = IRQ_ENABLE;
- return _taskcall(SYSTASK, SYS_IRQCTL, &m_irq);
-}
-
-
#include "syslib.h"
/*===========================================================================*
- * sys_xit *
+ * sys_exit *
*===========================================================================*/
-PUBLIC int sys_xit(proc)
+PUBLIC int sys_exit(proc)
int proc; /* which process has exited */
{
/* A process has exited. PM tells the kernel. In addition this call can be
message m;
m.PR_PROC_NR = proc;
- return(_taskcall(SYSTASK, SYS_XIT, &m));
+ return(_taskcall(SYSTASK, SYS_EXIT, &m));
}
+++ /dev/null
-#include "syslib.h"
-#include <string.h>
-
-int sys_findproc(name, tasknr, flags)
-char *name;
-int *tasknr;
-int flags;
-{
-/* Map a task name to a task number. */
- message m;
- int r;
-
- strncpy(m.m3_ca1, name, M3_STRING);
- m.m3_i1= flags;
-
- /* Clear unused fields */
- m.m3_i2 = 0;
- m.m3_p1= NULL;
-
- r= _taskcall(SYSTASK, SYS_FINDPROC, &m);
-
- *tasknr= m.m3_i1;
- return r;
-}
-
-/*
- * $PchId: sys_findproc.c,v 1.2 1996/04/11 05:46:27 philip Exp $
- */
+++ /dev/null
-#include "syslib.h"
-
-/*===========================================================================*
- * sys_forward_irq *
- *===========================================================================*/
-PUBLIC int sys_forward_irq(int irq_nr)
-{
- message m_irq;
- m_irq.IRQ_NR = irq_nr;
- m_irq.IRQ_CTL_OP = IRQ_DO_FWD;
- return _taskcall(SYSTASK, SYS_IRQCTL, &m_irq);
-}
-
-
#include "syslib.h"
/*===========================================================================*
- * sys_getsig *
+ * sys_getksig *
*===========================================================================*/
-PUBLIC int sys_getsig(k_proc_nr, k_sig_map)
+PUBLIC int sys_getksig(k_proc_nr, k_sig_map)
int *k_proc_nr; /* return process number here */
sigset_t *k_sig_map; /* return signal map here */
{
message m;
int result;
- result = _taskcall(SYSTASK, SYS_GETSIG, &m);
+ result = _taskcall(SYSTASK, SYS_GETKSIG, &m);
*k_proc_nr = m.SIG_PROC;
*k_sig_map = (sigset_t) m.SIG_MAP;
return(result);
+++ /dev/null
-#include "syslib.h"
-
-PUBLIC int sys_getsp(proc, newsp)
-int proc; /* process whose sp is wanted */
-vir_bytes *newsp; /* place to put sp read from kernel */
-{
-/* Ask the kernel what the sp is. */
-
- message m;
- int r;
-
- m.m1_i1 = proc;
- r = _taskcall(SYSTASK, SYS_GETSP, &m);
- *newsp = (vir_bytes) m.STACK_PTR;
- return(r);
-}
+++ /dev/null
-#include "syslib.h"
-
-PUBLIC int sys_getuptime(ticks)
-clock_t *ticks; /* pointer to store ticks */
-{
-/* Fetch the system time. */
- message m;
- int r;
-
- m.T_PROC_NR = NONE;
- r = _taskcall(SYSTASK, SYS_TIMES, &m);
- *ticks = m.T_BOOT_TICKS;
- return(r);
-}
+++ /dev/null
-#include "syslib.h"
-
-/*===========================================================================*
- * sys_kmalloc *
- *===========================================================================*/
-PUBLIC int sys_kmalloc(size, phys_base)
-size_t size; /* size in bytes */
-phys_bytes *phys_base; /* return physical base address */
-{
- message m;
- int result;
-
- m.MEM_CHUNK_SIZE = size;
-
- if (OK == (result = _taskcall(SYSTASK, SYS_KMALLOC, &m)))
- *phys_base = (phys_bytes) m.MEM_CHUNK_BASE;
- return(result);
-}
-
--- /dev/null
+#include "syslib.h"
+
+PUBLIC int sys_memset(char c, phys_bytes base, phys_bytes bytes)
+{
+/* Zero a block of data. */
+ message mess;
+
+ if (bytes == 0L) return(OK);
+
+ mess.MEM_CHAR = c;
+ mess.MEM_PTR = (char *) base;
+ mess.MEM_COUNT = bytes;
+
+ return(_taskcall(SYSTASK, SYS_MEMSET, &mess));
+}
+
+++ /dev/null
-#include "syslib.h"
-
-PUBLIC int sys_physzero(phys_bytes base, phys_bytes bytes)
-{
-/* Zero a block of data. */
-
- message mess;
-
- if (bytes == 0L) return(OK);
-
- mess.PZ_MEM_PTR = (char *) base;
- mess.PZ_COUNT = bytes;
-
- return(_taskcall(SYSTASK, SYS_PHYSZERO, &mess));
-}
-
#include "syslib.h"
/*===========================================================================*
- * sys_syncalrm *
+ * sys_setalarm *
*===========================================================================*/
-PUBLIC int sys_syncalrm(proc_nr, exp_time, abs_time)
+PUBLIC int sys_setalarm(proc_nr, exp_time, abs_time)
int proc_nr; /* process to send SYN_ALARM message to */
clock_t exp_time; /* expiration time for the alarm */
int abs_time; /* use absolute or relative expiration time */
*/
message m;
- m.m_type= SYS_SYNCALRM; /* the alarm type requested */
m.ALRM_PROC_NR = proc_nr; /* receiving process */
m.ALRM_EXP_TIME = exp_time; /* the expiration time */
m.ALRM_ABS_TIME = abs_time; /* time is absolute? */
- return _taskcall(SYSTASK, SYS_SYNCALRM, &m);
+ return _taskcall(SYSTASK, SYS_SETALARM, &m);
}
+++ /dev/null
-#include "syslib.h"
-
-/*===========================================================================*
- * sys_signalrm *
- *===========================================================================*/
-PUBLIC int sys_signalrm(proc_nr, ticks)
-int proc_nr; /* process to send SYN_ALARM message to */
-clock_t *ticks; /* how many ticks / return ticks left here */
-{
-/* Ask the clock to schedule a synchronous alarm for the caller. The process
- * number can be SELF if the caller doesn't know its process number.
- */
- message m;
- int s;
-
- m.m_type= SYS_SIGNALRM; /* the alarm type requested */
- m.ALRM_PROC_NR = proc_nr; /* receiving process */
- m.ALRM_EXP_TIME = *ticks; /* the expiration time */
- m.ALRM_ABS_TIME = 0; /* ticks are relative to now */
-
- s = _taskcall(SYSTASK, SYS_SIGNALRM, &m);
-
- *ticks = m.ALRM_TIME_LEFT; /* returned by SYSTEM task */
- return s;
-}
-
+++ /dev/null
-#include "syslib.h"
-
-int sys_sysctl(int proc, int request, int priv, vir_bytes argp)
-{
- message m;
-
- m.m2_i1 = proc;
- m.m2_i2 = request;
- m.m2_i3 = priv;
- m.m2_p1 = (char *) argp;
-
- return _taskcall(SYSTASK, SYS_SYSCTL, &m);
-}
}
}
- m.m_type = SYS_XIT;
m.PR_PROC_NR = SELF;
- _taskcall(SYSTASK, SYS_XIT, &m);
+ _taskcall(SYSTASK, SYS_EXIT, &m);
/* never reached */
}
if (ticks <= 0) return; /* check for robustness */
- m.m_type = SYS_SYNCALRM; /* request a synchronous alarm */
m.ALRM_PROC_NR = SELF; /* SELF means this process nr */
m.ALRM_EXP_TIME = ticks; /* request message after ticks */
m.ALRM_ABS_TIME = 0; /* ticks are relative to now */
- s = _taskcall(SYSTASK, SYS_SYNCALRM, &m);
+ s = _taskcall(SYSTASK, SYS_SETALARM, &m);
if (s != OK) return(s);
receive(CLOCK,&m_alarm); /* await synchronous alarm */
m.ALRM_EXP_TIME = m.ALRM_TIME_LEFT - ticks;
if (m.ALRM_EXP_TIME <= 0)
m.ALRM_EXP_TIME = 1;
- s = _taskcall(SYSTASK, SYS_SYNCALRM, &m);
+ s = _taskcall(SYSTASK, SYS_SETALARM, &m);
}
return(s);