*** empty log message ***
This commit is contained in:
@@ -20,8 +20,7 @@ CFLAGS = -I$i
|
||||
LDFLAGS = -i
|
||||
|
||||
SYS = alarms.o copying.o debugging.o devio.o irqctl.o proctl.o \
|
||||
srvrctl.o misc.o sigctl.o tracing.o \
|
||||
do_copy.o do_vcopy.o
|
||||
sysctl.o misc.o sigctl.o tracing.o \
|
||||
|
||||
# What to make.
|
||||
all build: $(SYS)
|
||||
@@ -48,11 +47,8 @@ irqctl.o: $a $b
|
||||
misc.o: $a $b $i/unistd.h
|
||||
proctl.o: $a $b $k/sendmask.h $k/protect.h $i/signal.h
|
||||
sigctl.o: $a $b $i/signal.h $s/sigcontext.h
|
||||
srvrctl.o: $a $b $s/svrctl.h $k/sendmask.h
|
||||
sysctl.o: $a $b $s/svrctl.h $k/sendmask.h
|
||||
tracing.o: $a $b $s/ptrace.h
|
||||
|
||||
do_copy.o: $a $b
|
||||
do_vcopy.o: $a $b
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* The system call implemented in this file:
|
||||
* m_type: SYS_VIRCOPY
|
||||
* m_type: SYS_VIRCOPY, SYS_PHYSCOPY
|
||||
*
|
||||
* The parameters for this system call are:
|
||||
* m5_c1: CP_SRC_SPACE
|
||||
@@ -13,14 +13,17 @@
|
||||
|
||||
#include "../kernel.h"
|
||||
#include "../system.h"
|
||||
#include <minix/type.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* do_vircopy *
|
||||
* do_copy *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_vircopy(m_ptr)
|
||||
PUBLIC int do_copy(m_ptr)
|
||||
register message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_vircopy(). Copy data by using virtual addressing. */
|
||||
/* Handle sys_vircopy() and sys_physcopy(). Copy data using virtual or
|
||||
* physical addressing.
|
||||
*/
|
||||
struct vir_addr vir_addr[2]; /* virtual source and destination address */
|
||||
vir_bytes bytes; /* number of bytes to copy */
|
||||
int i;
|
||||
@@ -41,21 +44,18 @@ register message *m_ptr; /* pointer to request message */
|
||||
|
||||
/* Check if process number was given implictly with SELF and is valid. */
|
||||
if (vir_addr[i].proc_nr == SELF) vir_addr[i].proc_nr = m_ptr->m_source;
|
||||
if (! isokprocn(vir_addr[i].proc_nr)) {
|
||||
kprintf("do_vircopy: illegal proc nr\n",NO_ARG);
|
||||
if (! isokprocn(vir_addr[i].proc_nr) && vir_addr[i].segment != PHYS_SEG) {
|
||||
kprintf("do_vircopy: illegal proc nr, while not phys addr\n",NO_ARG);
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
/* Copying from or to special segments can only done by the owner. */
|
||||
if ((vir_addr[i].segment & SEGMENT_TYPE) != LOCAL_SEG &&
|
||||
vir_addr[i].proc_nr != m_ptr->m_source) {
|
||||
kprintf("do_vircopy: special seg permission denied\n", NO_ARG);
|
||||
return(EPERM);
|
||||
}
|
||||
/* Check if physical addressing is used without SYS_PHYSCOPY. */
|
||||
if ((vir_addr[i].segment & SEGMENT_TYPE) == PHYS_SEG &&
|
||||
m_ptr->m_type != SYS_PHYSCOPY) return(EPERM);
|
||||
}
|
||||
|
||||
/* Check for overflow. This would happen for 64K segments and 16-bit
|
||||
* vir_bytes. Especially copying by the MM on do_fork() is affected.
|
||||
* vir_bytes. Especially copying by the PM on do_fork() is affected.
|
||||
*/
|
||||
if (bytes != (vir_bytes) bytes) {
|
||||
kprintf("do_vircopy: overflow\n", NO_ARG);
|
||||
@@ -67,37 +67,44 @@ register message *m_ptr; /* pointer to request message */
|
||||
}
|
||||
|
||||
|
||||
/* The system call implemented in this file:
|
||||
* m_type: SYS_PHYSCOPY
|
||||
*
|
||||
* The parameters for this system call are:
|
||||
* m5_l1: CP_SRC_ADDR (physical source address)
|
||||
* m5_l2: CP_DST_ADDR (physical destination address)
|
||||
* m5_l3: CP_NR_BYTES (number of bytes to copy)
|
||||
*
|
||||
* Author:
|
||||
* Jorrit N. Herder <jnherder@cs.vu.nl>
|
||||
*/
|
||||
/* Buffer to hold copy request vector from user. */
|
||||
PRIVATE struct vir_cp_req vir_cp_req[VCOPY_VEC_SIZE];
|
||||
|
||||
/*===========================================================================*
|
||||
* do_physcopy *
|
||||
* do_vcopy *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_physcopy(m_ptr)
|
||||
PUBLIC int do_vcopy(m_ptr)
|
||||
register message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_physcopy(). Copy data by using physical addressing. */
|
||||
/* Handle sys_virvcopy(). Handle virtual copy requests from vector. */
|
||||
int nr_req;
|
||||
int caller_pid;
|
||||
vir_bytes caller_vir;
|
||||
phys_bytes caller_phys;
|
||||
phys_bytes kernel_phys;
|
||||
phys_bytes bytes;
|
||||
int i,s;
|
||||
|
||||
phys_bytes src_phys, dst_phys, bytes;
|
||||
/* Check if request vector size is ok. */
|
||||
nr_req = (unsigned) m_ptr->VCP_VEC_SIZE;
|
||||
if (nr_req > VCOPY_VEC_SIZE) return(EINVAL);
|
||||
bytes = nr_req * sizeof(struct vir_cp_req);
|
||||
|
||||
/* Dismember the command message. */
|
||||
src_phys = (phys_bytes) m_ptr->CP_SRC_ADDR;
|
||||
dst_phys = (phys_bytes) m_ptr->CP_DST_ADDR;
|
||||
bytes = (phys_bytes) m_ptr->CP_NR_BYTES;
|
||||
/* Calculate physical addresses and copy (port,value)-pairs from user. */
|
||||
caller_pid = (int) m_ptr->m_source;
|
||||
caller_vir = (vir_bytes) m_ptr->VCP_VEC_ADDR;
|
||||
caller_phys = umap_local(proc_addr(caller_pid), D, caller_vir, bytes);
|
||||
if (0 == caller_phys) return(EFAULT);
|
||||
kernel_phys = vir2phys(vir_cp_req);
|
||||
phys_copy(caller_phys, kernel_phys, (phys_bytes) bytes);
|
||||
|
||||
/* Do some checks and copy the data. */
|
||||
if (src_phys == 0 || dst_phys == 0) return(EFAULT);
|
||||
phys_copy(src_phys, dst_phys, bytes);
|
||||
return(OK);
|
||||
/* Assume vector with requests is correct. Try to copy everything. */
|
||||
for (i=0; i<nr_req; i++) {
|
||||
s = virtual_copy(&vir_cp_req[i].src, &vir_cp_req[i].dst,
|
||||
vir_cp_req[i].count);
|
||||
if (s != OK) break;
|
||||
}
|
||||
return(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/* The system call implemented in this file:
|
||||
* m_type: SYS_COPY
|
||||
*
|
||||
* The parameters for this system call are:
|
||||
* m5_c1: CP_SRC_SPACE
|
||||
* m5_i1: CP_SRC_PROC_NR
|
||||
* m5_l1: CP_SRC_ADDR
|
||||
* m5_c2: CP_DST_SPACE
|
||||
* m5_i2: CP_DST_PROC_NR
|
||||
* m5_l2: CP_DST_ADDR
|
||||
* m5_l3: CP_NR_BYTES
|
||||
*/
|
||||
|
||||
#include "../kernel.h"
|
||||
#include "../system.h"
|
||||
|
||||
/*===========================================================================*
|
||||
* do_copy *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_copy(m_ptr)
|
||||
register message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_copy(). Copy data by using virtual or physical addressing. */
|
||||
|
||||
int src_proc, dst_proc, src_space, dst_space;
|
||||
vir_bytes src_vir, dst_vir;
|
||||
phys_bytes src_phys, dst_phys, bytes;
|
||||
|
||||
/* Dismember the command message. */
|
||||
src_proc = m_ptr->CP_SRC_PROC_NR;
|
||||
dst_proc = m_ptr->CP_DST_PROC_NR;
|
||||
src_space = m_ptr->CP_SRC_SPACE;
|
||||
dst_space = m_ptr->CP_DST_SPACE;
|
||||
src_vir = (vir_bytes) m_ptr->CP_SRC_ADDR;
|
||||
dst_vir = (vir_bytes) m_ptr->CP_DST_ADDR;
|
||||
bytes = (phys_bytes) m_ptr->CP_NR_BYTES;
|
||||
|
||||
/* Check if process number was given implicitly with SELF. */
|
||||
if (src_proc == SELF) src_proc = m_ptr->m_source;
|
||||
if (dst_proc == SELF) dst_proc = m_ptr->m_source;
|
||||
|
||||
/* Compute the source and destination addresses and do the copy. */
|
||||
if (src_proc == ABS) {
|
||||
src_phys = (phys_bytes) m_ptr->CP_SRC_ADDR;
|
||||
} else {
|
||||
if (bytes != (vir_bytes) bytes) {
|
||||
/* This would happen for 64K segments and 16-bit vir_bytes.
|
||||
* It would happen a lot for do_fork except MM uses ABS
|
||||
* copies for that case.
|
||||
*/
|
||||
panic("overflow in count in do_copy", NO_NUM);
|
||||
}
|
||||
src_phys = umap_local(proc_addr(src_proc), src_space, src_vir,
|
||||
(vir_bytes) bytes);
|
||||
}
|
||||
|
||||
if (dst_proc == ABS) {
|
||||
dst_phys = (phys_bytes) m_ptr->CP_DST_ADDR;
|
||||
} else {
|
||||
dst_phys = umap_local(proc_addr(dst_proc), dst_space, dst_vir,
|
||||
(vir_bytes) bytes);
|
||||
}
|
||||
|
||||
if (src_phys == 0 || dst_phys == 0) return(EFAULT);
|
||||
phys_copy(src_phys, dst_phys, bytes);
|
||||
return(OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/* The system call implemented in this file:
|
||||
* m_type: SYS_VCOPY
|
||||
*
|
||||
* The parameters for this system call are:
|
||||
* m1_i1: VCP_SRC_PROC (source process number)
|
||||
* m1_i2: VCP_DST_PROC (destination process number)
|
||||
* m1_i3: VCP_VEC_SIZE (vector size)
|
||||
* m1_p1: VCP_VEC_ADDR (pointer to vector)
|
||||
*
|
||||
* Author:
|
||||
* Jorrit N. Herder <jnherder@cs.vu.nl>
|
||||
*/
|
||||
|
||||
#include "../kernel.h"
|
||||
#include "../system.h"
|
||||
|
||||
/*===========================================================================*
|
||||
* do_vcopy *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_vcopy(m_ptr)
|
||||
register message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_vcopy(). Copy multiple blocks of memory */
|
||||
|
||||
int src_proc, dst_proc, vect_s, i;
|
||||
vir_bytes src_vir, dst_vir, vect_addr;
|
||||
phys_bytes src_phys, dst_phys, bytes;
|
||||
cpvec_t cpvec_table[CPVEC_NR];
|
||||
|
||||
/* Dismember the command message. */
|
||||
src_proc = m_ptr->VCP_SRC_PROC;
|
||||
dst_proc = m_ptr->VCP_DST_PROC;
|
||||
vect_s = m_ptr->VCP_VEC_SIZE;
|
||||
vect_addr = (vir_bytes)m_ptr->VCP_VEC_ADDR;
|
||||
|
||||
if (vect_s > CPVEC_NR) return EDOM;
|
||||
|
||||
src_phys= numap_local(m_ptr->m_source, vect_addr, vect_s * sizeof(cpvec_t));
|
||||
if (!src_phys) return EFAULT;
|
||||
phys_copy(src_phys, vir2phys(cpvec_table),
|
||||
(phys_bytes) (vect_s * sizeof(cpvec_t)));
|
||||
|
||||
for (i = 0; i < vect_s; i++) {
|
||||
src_vir= cpvec_table[i].cpv_src;
|
||||
dst_vir= cpvec_table[i].cpv_dst;
|
||||
bytes= cpvec_table[i].cpv_size;
|
||||
src_phys = numap_local(src_proc,src_vir,(vir_bytes)bytes);
|
||||
dst_phys = numap_local(dst_proc,dst_vir,(vir_bytes)bytes);
|
||||
if (src_phys == 0 || dst_phys == 0) return(EFAULT);
|
||||
phys_copy(src_phys, dst_phys, bytes);
|
||||
}
|
||||
return(OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,13 @@ register message *m_ptr; /* pointer to request message */
|
||||
/* Dismember the request message. */
|
||||
int irq = m_ptr->IRQ_VECTOR; /* which IRQ vector */
|
||||
int policy = m_ptr->IRQ_POLICY; /* policy field with flags */
|
||||
int proc_nr = m_ptr->IRQ_PROC_NR; /* process number to forward to */
|
||||
#if DEAD_CODE
|
||||
long port = m_ptr->IRQ_PORT; /* port to read or write */
|
||||
vir_bytes vir_addr = m_ptr->IRQ_VIR_ADDR; /* address at caller */
|
||||
phys_bytes phys_addr = 0; /* calculate physical address */
|
||||
long mask_val = m_ptr->IRQ_MASK_VAL; /* mask or value to be written */
|
||||
int proc_nr = m_ptr->IRQ_PROC_NR; /* process number to forward to */
|
||||
#endif
|
||||
|
||||
/* Check if IRQ line is acceptable. */
|
||||
if ((unsigned) irq >= NR_IRQ_VECTORS) {
|
||||
@@ -76,6 +78,7 @@ register message *m_ptr; /* pointer to request message */
|
||||
kprintf("ST: notify: invalid proc_nr: %d\n", proc_nr);
|
||||
return(EINVAL);
|
||||
}
|
||||
#if DEAD_CODE
|
||||
if (policy & IRQ_READ_PORT) { /* get phys_addr at caller */
|
||||
switch(policy & (IRQ_BYTE|IRQ_WORD|IRQ_LONG)) {
|
||||
case IRQ_BYTE: phys_addr=numap_local(proc_nr,vir_addr,sizeof( u8_t));
|
||||
@@ -88,12 +91,15 @@ register message *m_ptr; /* pointer to request message */
|
||||
}
|
||||
if (phys_addr==0) return(EFAULT); /* invalid address */
|
||||
}
|
||||
#endif
|
||||
/* Arguments seem to be OK, register them in the IRQ table. */
|
||||
irqtab[irq].policy = policy; /* policy for interrupts */
|
||||
irqtab[irq].proc_nr = proc_nr; /* process number to notify */
|
||||
#if DEAD_CODE
|
||||
irqtab[irq].port = port; /* port to read or write */
|
||||
irqtab[irq].addr = phys_addr; /* address to store status */
|
||||
irqtab[irq].mask_val = mask_val; /* strobe mask or value */
|
||||
#endif
|
||||
put_irq_handler(&irqtab[irq].hook, irq, generic_handler);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -54,6 +54,16 @@ message *m; /* pointer to request message */
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================*
|
||||
* do_random *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_random(m)
|
||||
message *m; /* pointer to request message */
|
||||
{
|
||||
return(ENOSYS); /* no yet implemented */
|
||||
}
|
||||
|
||||
|
||||
/* The system call implemented in this file:
|
||||
* m_type: SYS_ABORT
|
||||
*
|
||||
@@ -71,7 +81,7 @@ PUBLIC int do_abort(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_abort. MINIX is unable to continue. This can originate in the
|
||||
* MM (normal abort or panic) or FS (panic), or TTY (a CTRL-ALT-DEL or ESC
|
||||
* PM (normal abort or panic) or FS (panic), or TTY (a CTRL-ALT-DEL or ESC
|
||||
* after debugging dumps).
|
||||
*/
|
||||
register struct proc *rp;
|
||||
@@ -84,11 +94,11 @@ message *m_ptr; /* pointer to request message */
|
||||
if (how == RBT_MONITOR) {
|
||||
/* The monitor is to run user specified instructions. */
|
||||
len = m_ptr->ABRT_MON_LEN + 1;
|
||||
assert(len <= mon_parmsize);
|
||||
assert(len <= kinfo.params_size);
|
||||
src_phys = numap_local(m_ptr->ABRT_MON_PROC,
|
||||
(vir_bytes) m_ptr->ABRT_MON_ADDR, len);
|
||||
assert(src_phys != 0);
|
||||
phys_copy(src_phys, mon_params, (phys_bytes) len);
|
||||
phys_copy(src_phys, kinfo.params_base, (phys_bytes) len);
|
||||
}
|
||||
prepare_shutdown(how);
|
||||
return(OK); /* pro-forma (really EDISASTER) */
|
||||
@@ -125,23 +135,14 @@ register message *m_ptr; /* pointer to request message */
|
||||
|
||||
/* Set source address and length based on request type. */
|
||||
switch (m_ptr->I_REQUEST) {
|
||||
case GET_KENVIRON: {
|
||||
struct kenviron kenv;
|
||||
extern int end;
|
||||
|
||||
kenv.pc_at = pc_at; kenv.ps_mca = ps_mca;
|
||||
kenv.processor = processor; kenv.protected = protected_mode;
|
||||
kenv.ega = ega; kenv.vga = vga;
|
||||
|
||||
kenv.proc_addr = (vir_bytes) proc;
|
||||
kenv.params_base = mon_params;
|
||||
kenv.params_size = mon_parmsize;
|
||||
kenv.kmem_base = vir2phys(0);
|
||||
kenv.kmem_size = vir2phys(&end) - vir2phys(0) + 1;
|
||||
kenv.bootfs_base = proc_addr(MEMORY)->p_farmem[0].mem_phys;
|
||||
kenv.bootfs_size = proc_addr(MEMORY)->p_farmem[0].mem_len;
|
||||
length = sizeof(struct kenviron);
|
||||
src_phys = vir2phys(&kenv);
|
||||
case GET_MACHINE: {
|
||||
length = sizeof(struct machine);
|
||||
src_phys = vir2phys(&machine);
|
||||
break;
|
||||
}
|
||||
case GET_KINFO: {
|
||||
length = sizeof(struct kinfo);
|
||||
src_phys = vir2phys(&kinfo);
|
||||
break;
|
||||
}
|
||||
case GET_IMAGE: {
|
||||
@@ -184,20 +185,26 @@ register message *m_ptr; /* pointer to request message */
|
||||
break;
|
||||
}
|
||||
case GET_MONPARAMS: {
|
||||
src_phys = mon_params; /* already is a physical address! */
|
||||
length = mon_parmsize;
|
||||
src_phys = kinfo.params_base; /* already is a physical address! */
|
||||
length = kinfo.params_size;
|
||||
break;
|
||||
}
|
||||
case GET_PROCNR: {
|
||||
length = sizeof(int);
|
||||
if (m_ptr->I_KEY_LEN == 0) { /* get own process nr */
|
||||
#if DEAD_CODE
|
||||
/* GET_PROCNR functionality will be moved to the Process Manager! */
|
||||
kprintf("GET_PROCNR (own) from %d\n", m_ptr->m_source);
|
||||
#endif
|
||||
src_phys = vir2phys(&proc_nr);
|
||||
length = sizeof(int);
|
||||
} else { /* lookup nr by name */
|
||||
int proc_found = FALSE;
|
||||
struct proc *pp;
|
||||
char key[8]; /* storage for process name to lookup */
|
||||
kprintf("GET_PROCNR (others) from %d\n", m_ptr->m_source);
|
||||
#if DEAD_CODE
|
||||
/* GET_PROCNR functionality will be moved to the Process Manager! */
|
||||
kprintf("GET_PROCNR (by name) from %d\n", m_ptr->m_source);
|
||||
#endif
|
||||
proc_nr = m_ptr->m_source; /* only caller can request copy */
|
||||
if (m_ptr->I_KEY_LEN > sizeof(key)) return(EINVAL);
|
||||
if (vir_copy(proc_nr, (vir_bytes) m_ptr->I_KEY_PTR, SYSTASK,
|
||||
@@ -205,6 +212,7 @@ register message *m_ptr; /* pointer to request message */
|
||||
for (pp=BEG_PROC_ADDR; pp<END_PROC_ADDR; pp++) {
|
||||
if (kstrncmp(pp->p_name, key, m_ptr->I_KEY_LEN) == 0) {
|
||||
src_phys = vir2phys(&(pp->p_nr));
|
||||
length = sizeof(int);
|
||||
proc_found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* The parameters for this system call are:
|
||||
* m1_i1: PR_PROC_NR (child's process table slot)
|
||||
* m1_i2: PR_PPROC_NR (parent, process that forked)
|
||||
* m1_i3: PR_PID (child pid received from MM)
|
||||
* m1_i3: PR_PID (child pid received from PM)
|
||||
*/
|
||||
|
||||
#include "../kernel.h"
|
||||
@@ -81,23 +81,23 @@ register message *m_ptr; /* pointer to request message */
|
||||
PUBLIC int do_newmap(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_newmap(). Fetch the memory map from MM. */
|
||||
/* Handle sys_newmap(). Fetch the memory map from PM. */
|
||||
|
||||
register struct proc *rp;
|
||||
phys_bytes src_phys;
|
||||
int caller; /* whose space has the new map (usually MM) */
|
||||
int caller; /* whose space has the new map (usually PM) */
|
||||
int k; /* process whose map is to be loaded */
|
||||
int old_flags; /* value of flags before modification */
|
||||
struct mem_map *map_ptr; /* virtual address of map inside caller (MM) */
|
||||
struct mem_map *map_ptr; /* virtual address of map inside caller (PM) */
|
||||
|
||||
/* Extract message parameters and copy new memory map from MM. */
|
||||
/* Extract message parameters and copy new memory map from PM. */
|
||||
caller = m_ptr->m_source;
|
||||
k = m_ptr->PR_PROC_NR;
|
||||
map_ptr = (struct mem_map *) m_ptr->PR_MEM_PTR;
|
||||
if (!isokprocn(k)) return(EINVAL);
|
||||
rp = proc_addr(k); /* ptr to entry of user getting new map */
|
||||
|
||||
/* Copy the map from MM. */
|
||||
/* Copy the map from PM. */
|
||||
src_phys = umap_local(proc_addr(caller), D, (vir_bytes) map_ptr,
|
||||
sizeof(rp->p_memmap));
|
||||
assert(src_phys != 0);
|
||||
@@ -158,7 +158,7 @@ register message *m_ptr; /* pointer to request message */
|
||||
(LDT_SIZE - EXTRA_LDT_INDEX) * sizeof(rp->p_ldt[0]));
|
||||
#endif
|
||||
rp->p_reg.pc = (reg_t) m_ptr->PR_IP_PTR; /* set pc */
|
||||
rp->p_flags &= ~RECEIVING; /* MM does not reply to EXEC call */
|
||||
rp->p_flags &= ~RECEIVING; /* PM does not reply to EXEC call */
|
||||
if (rp->p_flags == 0) lock_ready(rp);
|
||||
|
||||
/* Save command name for debugging, ps(1) output, etc. */
|
||||
@@ -189,7 +189,7 @@ register message *m_ptr; /* pointer to request message */
|
||||
PUBLIC int do_xit(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_exit. A user process has exited (the MM sent the request).
|
||||
/* Handle sys_exit. A user process has exited (the PM sent the request).
|
||||
*/
|
||||
register struct proc *rp, *rc;
|
||||
struct proc *np, *xp;
|
||||
@@ -201,7 +201,7 @@ message *m_ptr; /* pointer to request message */
|
||||
if (! isokprocn(exit_proc_nr)) return(EINVAL);
|
||||
rc = proc_addr(exit_proc_nr);
|
||||
|
||||
/* If this is a user process and the MM passed in a valid parent process,
|
||||
/* If this is a user process and the PM passed in a valid parent process,
|
||||
* accumulate the child times at the parent.
|
||||
*/
|
||||
if (isuserp(rc) && isokprocn(m_ptr->PR_PPROC_NR)) {
|
||||
@@ -217,7 +217,7 @@ message *m_ptr; /* pointer to request message */
|
||||
* and resets important process table fields.
|
||||
*/
|
||||
clear_proc(exit_proc_nr);
|
||||
return(OK); /* tell MM that cleanup succeeded */
|
||||
return(OK); /* tell PM that cleanup succeeded */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,67 +23,54 @@
|
||||
#include <sys/sigcontext.h>
|
||||
INIT_ASSERT
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigctl *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sigctl(m_ptr)
|
||||
/* PM is ready to accept signals and repeatedly does a system call to get
|
||||
* one. Find a process with pending signals. If no signals are available,
|
||||
* return NONE in the process number field.
|
||||
*/
|
||||
PUBLIC int do_getsig(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Only the MM and FS are allowed to use signal control operations. */
|
||||
if (m_ptr->m_source != MM_PROC_NR && m_ptr->m_source != FS_PROC_NR)
|
||||
return(EPERM);
|
||||
register struct proc *rp;
|
||||
|
||||
/* Now see what request we got. The supported requests are S_GETSIG,
|
||||
* S_ENDSIG, S_SENDSIG, S_SIGRETURN, and S_KILL. Unsupported requests
|
||||
* result in an EINVAL error.
|
||||
*/
|
||||
switch(m_ptr->SIG_REQUEST) {
|
||||
|
||||
/* MM is ready to accept signals and repeatedly does a system call to get
|
||||
* one. Find a process with pending signals. If no signals are available,
|
||||
* return NONE in the process number field.
|
||||
*/
|
||||
case S_GETSIG: {
|
||||
|
||||
register struct proc *rp;
|
||||
|
||||
/* Find the next process with pending signals. */
|
||||
for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) {
|
||||
if (rp->p_flags & PENDING) {
|
||||
m_ptr->SIG_PROC = proc_number(rp);
|
||||
m_ptr->SIG_MAP = rp->p_pending;
|
||||
sigemptyset(&rp->p_pending); /* ball is in MM's court */
|
||||
rp->p_flags &= ~PENDING; /* blocked by SIG_PENDING */
|
||||
return(OK);
|
||||
}
|
||||
}
|
||||
|
||||
/* No process with pending signals was found. */
|
||||
m_ptr->SIG_PROC = NONE;
|
||||
return(OK);
|
||||
/* Find the next process with pending signals. */
|
||||
for (rp = BEG_USER_ADDR; rp < END_PROC_ADDR; rp++) {
|
||||
if (rp->p_flags & PENDING) {
|
||||
m_ptr->SIG_PROC = proc_number(rp);
|
||||
m_ptr->SIG_MAP = rp->p_pending;
|
||||
sigemptyset(&rp->p_pending); /* ball is in PM's court */
|
||||
rp->p_flags &= ~PENDING; /* blocked by SIG_PENDING */
|
||||
return(OK);
|
||||
}
|
||||
}
|
||||
|
||||
/* Finish up after a KSIG-type signal, caused by a SYS_KILL message or a
|
||||
* call to cause_sig by a task
|
||||
*/
|
||||
case S_ENDSIG: {
|
||||
/* No process with pending signals was found. */
|
||||
m_ptr->SIG_PROC = NONE;
|
||||
return(OK);
|
||||
}
|
||||
|
||||
register struct proc *rp;
|
||||
PUBLIC int do_endsig(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Finish up after a kernel type signal, caused by a SYS_KILL message or a
|
||||
* call to cause_sig by a task. This is called by the PM after processing a
|
||||
* signal it got with SYS_GETSIG.
|
||||
*/
|
||||
register struct proc *rp;
|
||||
|
||||
rp = proc_addr(m_ptr->SIG_PROC);
|
||||
if (isemptyp(rp)) return(EINVAL); /* process already dead? */
|
||||
assert(isuserp(rp));
|
||||
rp = proc_addr(m_ptr->SIG_PROC);
|
||||
if (isemptyp(rp)) return(EINVAL); /* process already dead? */
|
||||
|
||||
/* MM has finished one KSIG. Perhaps process is ready now? */
|
||||
if (rp->p_pendcount != 0 && --rp->p_pendcount == 0
|
||||
&& (rp->p_flags &= ~SIG_PENDING) == 0)
|
||||
lock_ready(rp);
|
||||
return(OK);
|
||||
}
|
||||
/* PM has finished one kernel signal. Perhaps process is ready now? */
|
||||
if (rp->p_pendcount != 0 && --rp->p_pendcount == 0
|
||||
&& (rp->p_flags &= ~SIG_PENDING) == 0)
|
||||
lock_ready(rp);
|
||||
return(OK);
|
||||
}
|
||||
|
||||
/* Handle sys_sendsig, POSIX-style signal handling.
|
||||
*/
|
||||
case S_SENDSIG: {
|
||||
PUBLIC int do_sigsend(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_sigsend, POSIX-style signal handling. */
|
||||
|
||||
struct sigmsg smsg;
|
||||
register struct proc *rp;
|
||||
@@ -95,7 +82,7 @@ message *m_ptr; /* pointer to request message */
|
||||
assert(isuserp(rp));
|
||||
|
||||
/* Get the sigmsg structure into our address space. */
|
||||
src_phys = umap_local(proc_addr(MM_PROC_NR), D, (vir_bytes)
|
||||
src_phys = umap_local(proc_addr(PM_PROC_NR), D, (vir_bytes)
|
||||
m_ptr->SIG_CTXT_PTR, (vir_bytes) sizeof(struct sigmsg));
|
||||
assert(src_phys != 0);
|
||||
phys_copy(src_phys,vir2phys(&smsg),(phys_bytes) sizeof(struct sigmsg));
|
||||
@@ -140,13 +127,14 @@ message *m_ptr; /* pointer to request message */
|
||||
rp->p_reg.pc = (reg_t) smsg.sm_sighandler;
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
/* POSIX style signals require sys_sigreturn to put things in order before
|
||||
* the signalled process can resume execution
|
||||
*/
|
||||
case S_SIGRETURN: {
|
||||
}
|
||||
|
||||
PUBLIC int do_sigreturn(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* POSIX style signals require sys_sigreturn to put things in order before
|
||||
* the signalled process can resume execution
|
||||
*/
|
||||
struct sigcontext sc;
|
||||
register struct proc *rp;
|
||||
phys_bytes src_phys;
|
||||
@@ -193,30 +181,18 @@ message *m_ptr; /* pointer to request message */
|
||||
|
||||
/* Restore the registers. */
|
||||
kmemcpy(&rp->p_reg, (char *)&sc.sc_regs, sizeof(struct sigregs));
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
||||
/* Handle sys_kill(). Cause a signal to be sent to a process via MM.
|
||||
* Note that this has nothing to do with the kill(2) system call, this
|
||||
* is how the FS (and possibly other servers) get access to cause_sig.
|
||||
*/
|
||||
case S_KILL: {
|
||||
cause_sig(m_ptr->SIG_PROC, m_ptr->SIG_NUMBER);
|
||||
return(OK);
|
||||
}
|
||||
|
||||
default:
|
||||
return(EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================*
|
||||
* do_sigctl *
|
||||
*===========================================================================*/
|
||||
|
||||
PUBLIC int do_kill(m_ptr)
|
||||
message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Handle sys_kill(). Cause a signal to be sent to a process via MM.
|
||||
/* Handle sys_kill(). Cause a signal to be sent to a process via PM.
|
||||
* Note that this has nothing to do with the kill (2) system call, this
|
||||
* is how the FS (and possibly other servers) get access to cause_sig.
|
||||
*/
|
||||
|
||||
@@ -82,7 +82,7 @@ message *m_ptr; /* pointer to request message */
|
||||
argp = (vir_bytes) m_ptr->CTL_ARG_PTR;
|
||||
rp = proc_addr(proc_nr);
|
||||
|
||||
/* Check if the MM privileges are super user. */
|
||||
/* Check if the PM privileges are super user. */
|
||||
if (!priv || !isuserp(rp))
|
||||
return(EPERM);
|
||||
|
||||
@@ -99,7 +99,7 @@ message *m_ptr; /* pointer to request message */
|
||||
rp->p_type = P_SERVER;
|
||||
rp->p_sendmask = ALLOW_ALL_MASK;
|
||||
send_mask_allow(proc_addr(RTL8139)->p_sendmask, proc_nr);
|
||||
send_mask_allow(proc_addr(MM_PROC_NR)->p_sendmask, proc_nr);
|
||||
send_mask_allow(proc_addr(PM_PROC_NR)->p_sendmask, proc_nr);
|
||||
send_mask_allow(proc_addr(FS_PROC_NR)->p_sendmask, proc_nr);
|
||||
send_mask_allow(proc_addr(IS_PROC_NR)->p_sendmask, proc_nr);
|
||||
send_mask_allow(proc_addr(CLOCK)->p_sendmask, proc_nr);
|
||||
@@ -112,7 +112,7 @@ message *m_ptr; /* pointer to request message */
|
||||
}
|
||||
|
||||
/* The system call implemented in this file:
|
||||
* m_type: SYS_MEMCTL
|
||||
* m_type: SYS_SEGCTL
|
||||
*
|
||||
* The parameters for this system call are:
|
||||
* m4_l3: SEG_PHYS (physical base address)
|
||||
@@ -127,9 +127,9 @@ message *m_ptr; /* pointer to request message */
|
||||
|
||||
|
||||
/*===========================================================================*
|
||||
* do_phys2seg *
|
||||
* do_segctl *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_phys2seg(m_ptr)
|
||||
PUBLIC int do_segctl(m_ptr)
|
||||
register message *m_ptr; /* pointer to request message */
|
||||
{
|
||||
/* Return a segment selector and offset that can be used to reach a physical
|
||||
@@ -137,14 +137,28 @@ register message *m_ptr; /* pointer to request message */
|
||||
*/
|
||||
u16_t selector;
|
||||
vir_bytes offset;
|
||||
int i, index;
|
||||
register struct proc *rp;
|
||||
phys_bytes phys = (phys_bytes) m_ptr->SEG_PHYS;
|
||||
vir_bytes size = (vir_bytes) m_ptr->SEG_SIZE;
|
||||
int result;
|
||||
|
||||
kprintf("Using Experimental LDT selector for video memory\n", NO_ARG);
|
||||
/* First check if there is a slot available for this segment. */
|
||||
rp = proc_addr(m_ptr->m_source);
|
||||
index = -1;
|
||||
for (i=0; i < NR_REMOTE_SEGS; i++) {
|
||||
if (! rp->p_farmem[i].in_use) {
|
||||
index = i;
|
||||
rp->p_farmem[i].in_use = TRUE;
|
||||
rp->p_farmem[i].mem_phys = phys;
|
||||
rp->p_farmem[i].mem_len = size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index < 0) return(ENOSPC);
|
||||
|
||||
if (!protected_mode) {
|
||||
|
||||
if (! machine.protected) {
|
||||
selector = phys / HCLICK_SIZE;
|
||||
offset = phys % HCLICK_SIZE;
|
||||
result = OK;
|
||||
@@ -155,26 +169,22 @@ register message *m_ptr; /* pointer to request message */
|
||||
* instead of bytes are used.
|
||||
*/
|
||||
if (size < BYTE_GRAN_MAX) {
|
||||
rp = proc_addr(m_ptr->m_source);
|
||||
init_dataseg(&rp->p_ldt[EXTRA_LDT_INDEX], phys, size,
|
||||
init_dataseg(&rp->p_ldt[EXTRA_LDT_INDEX+i], phys, size,
|
||||
USER_PRIVILEGE);
|
||||
selector = (EXTRA_LDT_INDEX * 0x08) | (1 * 0x04) | USER_PRIVILEGE;
|
||||
selector = ((EXTRA_LDT_INDEX+i)*0x08) | (1*0x04) | USER_PRIVILEGE;
|
||||
offset = 0;
|
||||
result = OK;
|
||||
} else {
|
||||
#if ENABLE_USERPRIV && ENABLE_LOOSELDT
|
||||
rp = proc_addr(m_ptr->m_source);
|
||||
init_dataseg(&rp->p_ldt[EXTRA_LDT_INDEX], phys & ~0xFFFF, 0,
|
||||
init_dataseg(&rp->p_ldt[EXTRA_LDT_INDEX+i], phys & ~0xFFFF, 0,
|
||||
USER_PRIVILEGE);
|
||||
selector = (EXTRA_LDT_INDEX * 0x08) | (1 * 0x04) | USER_PRIVILEGE;
|
||||
selector = ((EXTRA_LDT_INDEX+i)*0x08) | (1*0x04) | USER_PRIVILEGE;
|
||||
offset = phys & 0xFFFF;
|
||||
result = OK;
|
||||
#else
|
||||
result = E2BIG; /* allow settings only */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Request successfully done. Now return the result. */
|
||||
m_ptr->SEG_INDEX = index | REMOTE_SEG;
|
||||
m_ptr->SEG_SELECT = selector;
|
||||
m_ptr->SEG_OFFSET = offset;
|
||||
return(result);
|
||||
@@ -36,7 +36,7 @@ register message *m_ptr;
|
||||
* T_EXIT exit
|
||||
* T_STEP set trace bit
|
||||
*
|
||||
* The T_OK and T_EXIT commands are handled completely by the memory manager,
|
||||
* The T_OK and T_EXIT commands are handled completely by the process manager,
|
||||
* all others come here.
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user