*** empty log message ***

This commit is contained in:
Jorrit Herder
2005-04-29 15:36:43 +00:00
parent 0e869cdd44
commit 89ac678b9b
78 changed files with 1293 additions and 2858 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ PUBLIC int do_cmostime(void)
/* First obtain the machine ID to see if we can read the CMOS clock. Only
* for PS_386 and PC_AT this is possible. Otherwise, return an error.
*/
sys_vircopy(SELF, BIOS_SEG, (vir_bytes) ADR_MACHINE_ID,
SELF, D, (vir_bytes) &mach_id, LEN_MACHINE_ID);
sys_vircopy(SELF, BIOS_SEG, (vir_bytes) MACHINE_ID_ADDR,
SELF, D, (vir_bytes) &mach_id, MACHINE_ID_SIZE);
if (mach_id != PS_386_MACHINE && mach_id != PC_AT_MACHINE) {
printf("IS: Machine ID unknown. ID byte = %02x.\n", mach_id);
return(EFAULT);
+1 -1
View File
@@ -206,7 +206,7 @@ PUBLIC int do_setsid()
register struct fproc *rfp;
/* Only MM may do the SETSID call directly. */
if (who != MM_PROC_NR) return(ENOSYS);
if (who != PM_PROC_NR) return(ENOSYS);
/* Make the process a session leader with no controlling tty. */
rfp = &fproc[m_in.slot1];
+3 -3
View File
@@ -305,10 +305,10 @@ PRIVATE void load_ram(void)
if (sendrec(MEMORY, &m_out) != OK || m_out.REP_STATUS != OK)
panic("Can't set RAM disk size", NO_NUM);
/* Tell MM the RAM disk size, and wait for it to come "on-line". */
/* Tell PM the RAM disk size, and wait for it to come "on-line". */
m_out.MEM_CHUNK_SIZE = ((long) ram_size_kb * 1024) >> CLICK_SHIFT;
if (sendrec(MM_PROC_NR, &m_out) != OK)
panic("FS can't sync up with MM", NO_NUM);
if (sendrec(PM_PROC_NR, &m_out) != OK)
panic("FS can't sync up with PM", NO_NUM);
#if ENABLE_CACHE2
/* The RAM disk is a second level block cache while not otherwise used. */
+10 -10
View File
@@ -171,8 +171,8 @@ PUBLIC int do_reboot()
struct super_block *sp;
struct inode dummy;
/* Only MM may make this call directly. */
if (who != MM_PROC_NR) return(EGENERIC);
/* Only PM may make this call directly. */
if (who != PM_PROC_NR) return(EGENERIC);
/* Do exit processing for all leftover processes and servers. */
for (i = 0; i < NR_PROCS; i++) { m_in.slot1 = i; do_exit(); }
@@ -212,8 +212,8 @@ PUBLIC int do_fork()
register struct fproc *cp;
int i;
/* Only MM may make this call directly. */
if (who != MM_PROC_NR) return(EGENERIC);
/* Only PM may make this call directly. */
if (who != PM_PROC_NR) return(EGENERIC);
/* Copy the parent's fproc struct to the child. */
fproc[m_in.child] = fproc[m_in.parent];
@@ -248,8 +248,8 @@ PUBLIC int do_exec()
register int i;
long bitmap;
/* Only MM may make this call directly. */
if (who != MM_PROC_NR) return(EGENERIC);
/* Only PM may make this call directly. */
if (who != PM_PROC_NR) return(EGENERIC);
/* The array of FD_CLOEXEC bits is in the fp_cloexec bit map. */
fp = &fproc[m_in.slot1]; /* get_filp() needs 'fp' */
@@ -279,8 +279,8 @@ PUBLIC int do_exit()
register struct inode *rip;
dev_t dev;
/* Only MM may do the EXIT call directly. */
if (who != MM_PROC_NR) return(EGENERIC);
/* Only PM may do the EXIT call directly. */
if (who != PM_PROC_NR) return(EGENERIC);
/* Nevertheless, pretend that the call came from the user. */
fp = &fproc[m_in.slot1]; /* get_filp() needs 'fp' */
@@ -343,8 +343,8 @@ PUBLIC int do_set()
register struct fproc *tfp;
/* Only MM may make this call directly. */
if (who != MM_PROC_NR) return(EGENERIC);
/* Only PM may make this call directly. */
if (who != PM_PROC_NR) return(EGENERIC);
tfp = &fproc[m_in.slot1];
if (call_nr == SETUID) {
+1 -1
View File
@@ -267,7 +267,7 @@ PUBLIC int do_unpause()
dev_t dev;
message mess;
if (who > MM_PROC_NR) return(EPERM);
if (who > PM_PROC_NR) return(EPERM);
proc_nr = m_in.pro;
if (proc_nr < 0 || proc_nr >= NR_PROCS) panic("unpause err 1", proc_nr);
rfp = &fproc[proc_nr];
+1 -1
View File
@@ -54,7 +54,7 @@ int rw_flag; /* READING or WRITING */
int block_size;
/* MM loads segments by putting funny things in upper 10 bits of 'fd'. */
if (who == MM_PROC_NR && (m_in.fd & (~BYTE)) ) {
if (who == PM_PROC_NR && (m_in.fd & (~BYTE)) ) {
usr = m_in.fd >> 7;
seg = (m_in.fd >> 5) & 03;
m_in.fd &= 037; /* get rid of user and segment bits */
+1 -1
View File
@@ -36,7 +36,7 @@ PUBLIC int do_chdir()
int r;
register struct fproc *rfp;
if (who == MM_PROC_NR) {
if (who == PM_PROC_NR) {
rfp = &fproc[m_in.slot1];
put_inode(fp->fp_rootdir);
dup_inode(fp->fp_rootdir = rfp->fp_rootdir);
+23 -18
View File
@@ -107,6 +107,7 @@ FORWARD _PROTOTYPE ( int cp_b2u, (acc_t *acc_ptr, int proc, char *dest) );
PRIVATE sr_fd_t sr_fd_table[FD_NR];
PRIVATE mq_t *repl_queue, *repl_queue_tail;
PRIVATE cpvec_t cpvec[CPVEC_NR];
PRIVATE struct vir_cp_req vir_cp_req[CPVEC_NR];
PUBLIC void sr_init()
{
@@ -650,9 +651,13 @@ int size;
{
size= (vir_bytes)acc->acc_length;
cpvec[i].cpv_src= (vir_bytes)src;
cpvec[i].cpv_dst= (vir_bytes)ptr2acc_data(acc);
cpvec[i].cpv_size= size;
vir_cp_req[i].count= size;
vir_cp_req[i].src.proc_nr = proc;
vir_cp_req[i].src.segment = D;
vir_cp_req[i].src.offset = (vir_bytes) src;
vir_cp_req[i].dst.proc_nr = this_proc;
vir_cp_req[i].dst.segment = D;
vir_cp_req[i].dst.offset = (vir_bytes) ptr2acc_data(acc);
src += size;
acc= acc->acc_next;
@@ -660,11 +665,9 @@ int size;
if (i == CPVEC_NR || acc == NULL)
{
mess.m_type= SYS_VCOPY;
mess.m1_i1= proc;
mess.m1_i2= this_proc;
mess.m1_i3= i;
mess.m1_p1= (char *)cpvec;
mess.m_type= SYS_VIRVCOPY;
mess.VCP_VEC_SIZE = i;
mess.VCP_VEC_ADDR = (char *) vir_cp_req;
if (sendrec(SYSTASK, &mess) <0)
ip_panic(("unable to sendrec"));
if (mess.m_type <0)
@@ -697,9 +700,13 @@ char *dest;
if (size)
{
cpvec[i].cpv_src= (vir_bytes)ptr2acc_data(acc);
cpvec[i].cpv_dst= (vir_bytes)dest;
cpvec[i].cpv_size= size;
vir_cp_req[i].src.proc_nr = this_proc;
vir_cp_req[i].src.segment = D;
vir_cp_req[i].src.offset= (vir_bytes)ptr2acc_data(acc);
vir_cp_req[i].dst.proc_nr = proc;
vir_cp_req[i].dst.segment = D;
vir_cp_req[i].dst.offset= (vir_bytes)dest;
vir_cp_req[i].count= size;
i++;
}
@@ -708,11 +715,9 @@ char *dest;
if (i == CPVEC_NR || acc == NULL)
{
mess.m_type= SYS_VCOPY;
mess.m1_i1= this_proc;
mess.m1_i2= proc;
mess.m1_i3= i;
mess.m1_p1= (char *)cpvec;
mess.m_type= SYS_VIRVCOPY;
mess.VCP_VEC_SIZE = i;
mess.VCP_VEC_ADDR = (char *) vir_cp_req;
if (sendrec(SYSTASK, &mess) <0)
ip_panic(("unable to sendrec"));
if (mess.m_type <0)
@@ -746,7 +751,7 @@ assert(!m_cancel);
m= m->mq_next;
continue;
}
assert(m->mq_mess.m_source != MM_PROC_NR);
assert(m->mq_mess.m_source != PM_PROC_NR);
assert(m->mq_mess.m_type == REVIVE);
result= send(m->mq_mess.m_source, &m->mq_mess);
if (result != OK)
@@ -758,7 +763,7 @@ assert(m->mq_mess.m_type == REVIVE);
repl_queue= NULL;
if (m_cancel)
{
assert(m_cancel->mq_mess.m_source != MM_PROC_NR);
assert(m_cancel->mq_mess.m_source != PM_PROC_NR);
assert(m_cancel->mq_mess.m_type == REVIVE);
result= send(m_cancel->mq_mess.m_source, &m_cancel->mq_mess);
if (result != OK)
+36 -23
View File
@@ -35,7 +35,7 @@ FORWARD _PROTOTYPE( void kmessages_dmp, (void) );
FORWARD _PROTOTYPE( void diagnostics_dmp, (void) );
FORWARD _PROTOTYPE( void sched_dmp, (void) );
FORWARD _PROTOTYPE( void monparams_dmp, (void) );
FORWARD _PROTOTYPE( void kenviron_dmp, (void) );
FORWARD _PROTOTYPE( void kenv_dmp, (void) );
FORWARD _PROTOTYPE( void memchunks_dmp, (void) );
/* Some global data that is shared among several dumping procedures.
@@ -62,7 +62,7 @@ PUBLIC int do_fkey_pressed(message *m)
case F6: irqtab_dmp(); break;
case F7: kmessages_dmp(); break;
case F9: diagnostics_dmp(); break;
case F10: kenviron_dmp(); break;
case F10: kenv_dmp(); break;
case F11: memchunks_dmp(); break;
case F12: sched_dmp(); break;
default:
@@ -253,7 +253,7 @@ PRIVATE void sched_dmp()
{
struct proc *rdy_head[NR_SCHED_QUEUES];
char *types[] = {"task","higher","high","normal","low","lower","user","idle"};
struct kenviron kenviron;
struct kinfo kinfo;
register struct proc *rp;
vir_bytes ptr_diff;
int r;
@@ -264,13 +264,13 @@ PRIVATE void sched_dmp()
return;
}
/* Then obtain kernel addresses to correct pointer information. */
if ((r = sys_getkenviron(&kenviron)) != OK) {
if ((r = sys_getkinfo(&kinfo)) != OK) {
report("warning: couldn't get kernel addresses", r);
return;
}
/* Update all pointers. Nasty pointer algorithmic ... */
ptr_diff = (vir_bytes) proc - (vir_bytes) kenviron.proc_addr;
ptr_diff = (vir_bytes) proc - (vir_bytes) kinfo.proc_addr;
for (r=0;r<NR_SCHED_QUEUES; r++)
if (rdy_head[r] != NIL_PROC)
rdy_head[r] =
@@ -296,30 +296,43 @@ PRIVATE void sched_dmp()
}
/*===========================================================================*
* kenviron_dmp *
* kenv_dmp *
*===========================================================================*/
PRIVATE void kenviron_dmp()
PRIVATE void kenv_dmp()
{
struct kenviron kenv;
struct kinfo kinfo;
struct machine machine;
int r;
if ((r = sys_getkenviron(&kenv)) != OK) {
report("warning: couldn't get copy of kernel env", r);
if ((r = sys_getkinfo(&kinfo)) != OK) {
report("warning: couldn't get copy of kernel info struct", r);
return;
}
if ((r = sys_getmachine(&machine)) != OK) {
report("warning: couldn't get copy of kernel machine struct", r);
return;
}
printf("Dump of kernel variables based on the environment set by the boot loader.\n");
printf("- pc_at: %3d\n", kenv.pc_at);
printf("- ps_mca: %3d\n", kenv.ps_mca);
printf("- processor: %3d\n", kenv.processor);
printf("- protected: %3d\n", kenv.protected);
printf("- ega: %3d\n", kenv.ega);
printf("- vga: %3d\n", kenv.vga);
printf("- params_base:%5u\n", kenv.params_base);
printf("- params_size:%5u\n", kenv.params_size);
printf("- kmem_base:%5u\n", kenv.kmem_base);
printf("- kmem_size:%5u\n", kenv.kmem_size);
printf("- bootfs_base:%5u\n", kenv.bootfs_base);
printf("- bootfs_size:%5u\n", kenv.bootfs_size);
printf("Dump of kinfo and machine structures.\n\n");
printf("Machine structure:\n");
printf("- pc_at: %3d\n", machine.pc_at);
printf("- ps_mca: %3d\n", machine.ps_mca);
printf("- processor: %3d\n", machine.processor);
printf("- protected: %3d\n", machine.protected);
printf("- vdu_ega: %3d\n", machine.vdu_ega);
printf("- vdu_vga: %3d\n\n", machine.vdu_vga);
printf("Kernel info structure:\n");
printf("- code_base: %5u\n", kinfo.code_base);
printf("- code_size: %5u\n", kinfo.code_size);
printf("- data_base: %5u\n", kinfo.data_base);
printf("- data_size: %5u\n", kinfo.data_size);
printf("- proc_addr: %5u\n", kinfo.proc_addr);
printf("- kmem_base: %5u\n", kinfo.kmem_base);
printf("- kmem_size: %5u\n", kinfo.kmem_size);
printf("- bootdev_base: %5u\n", kinfo.bootdev_base);
printf("- bootdev_size: %5u\n", kinfo.bootdev_size);
printf("- params_base: %5u\n", kinfo.params_base);
printf("- params_size: %5u\n", kinfo.params_size);
printf("- version: %.6s\n", kinfo.version);
printf("\n");
}
+5 -5
View File
@@ -75,14 +75,14 @@ PUBLIC int do_exec()
src = (vir_bytes) m_in.exec_name;
dst = (vir_bytes) name_buf;
r = sys_datacopy(who, (vir_bytes) src,
MM_PROC_NR, (vir_bytes) dst, (phys_bytes) m_in.exec_len);
PM_PROC_NR, (vir_bytes) dst, (phys_bytes) m_in.exec_len);
if (r != OK) return(r); /* file name not in user data segment */
/* Fetch the stack from the user before destroying the old core image. */
src = (vir_bytes) m_in.stack_ptr;
dst = (vir_bytes) mbuf;
r = sys_datacopy(who, (vir_bytes) src,
MM_PROC_NR, (vir_bytes) dst, (phys_bytes)stk_bytes);
PM_PROC_NR, (vir_bytes) dst, (phys_bytes)stk_bytes);
if (r != OK) return(EACCES); /* can't fetch stack (e.g. bad virtual addr) */
@@ -128,7 +128,7 @@ PUBLIC int do_exec()
vsp -= stk_bytes;
patch_ptr(mbuf, vsp);
src = (vir_bytes) mbuf;
r = sys_datacopy(MM_PROC_NR, (vir_bytes) src,
r = sys_datacopy(PM_PROC_NR, (vir_bytes) src,
who, (vir_bytes) vsp, (phys_bytes)stk_bytes);
if (r != OK) panic("do_exec stack copy err on", who);
@@ -374,8 +374,8 @@ phys_bytes tot_bytes; /* total memory to allocate, including gap */
while (bytes > 0) {
count = MIN(bytes, (phys_bytes) sizeof(zero));
if (sys_copy(MM_PROC_NR, D, (phys_bytes) zero,
ABS, 0, base, count) != OK) {
if (sys_physcopy(PM_PROC_NR, D, (phys_bytes) zero,
NONE, PHYS_SEG, base, count) != OK) {
panic("new_mem can't zero", NO_NUM);
}
base += count;
+1 -1
View File
@@ -64,7 +64,7 @@ PUBLIC int do_fork()
/* Create a copy of the parent's core image for the child. */
child_abs = (phys_bytes) child_base << CLICK_SHIFT;
parent_abs = (phys_bytes) rmp->mp_seg[D].mem_phys << CLICK_SHIFT;
i = sys_physcopy(parent_abs, child_abs, prog_bytes);
i = sys_abscopy(parent_abs, child_abs, prog_bytes);
if (i < 0) panic("do_fork can't copy", i);
/* Find a slot in 'mproc' for the child process. A slot must exist. */
+1 -1
View File
@@ -91,7 +91,7 @@ PRIVATE void get_work()
/* Process slot of caller. Misuse MM's own process slot if the kernel is
* calling. The can happen in case of pending kernel signals.
*/
mp = &mproc[who < 0 ? MM_PROC_NR : who];
mp = &mproc[who < 0 ? PM_PROC_NR : who];
}
+6 -3
View File
@@ -49,7 +49,7 @@ PUBLIC int do_reboot()
case RBT_MONITOR:
if (m_in.reboot_size >= sizeof(monitor_code)) return(EINVAL);
if (sys_datacopy(who, (vir_bytes) m_in.reboot_code,
MM_PROC_NR, (vir_bytes) monitor_code,
PM_PROC_NR, (vir_bytes) monitor_code,
(phys_bytes) (m_in.reboot_size+1)) != OK) return(EFAULT);
if (monitor_code[m_in.reboot_size] != 0) return(EINVAL);
break;
@@ -60,7 +60,7 @@ PUBLIC int do_reboot()
check_sig(-1, SIGKILL); /* kill all processes except init */
tell_fs(REBOOT,0,0,0); /* tell FS to prepare for shutdown */
sys_abort(m_in.reboot_flag, MM_PROC_NR, monitor_code, m_in.reboot_size);
sys_abort(m_in.reboot_flag, PM_PROC_NR, monitor_code, m_in.reboot_size);
sys_exit(0);
}
@@ -85,6 +85,9 @@ PUBLIC int do_svrctl()
/* Binary compatibility check. */
if (req == SYSGETENV) {
#if DEAD_CODE
printf("SYSGETENV by %d (fix!)\n", who);
#endif
req = MMGETPARAM;
}
@@ -179,7 +182,7 @@ PUBLIC int do_svrctl()
if (mp->mp_effuid != SUPER_USER) return(EPERM);
if (sys_datacopy(who, (phys_bytes) ptr,
MM_PROC_NR, (phys_bytes) &swapon,
PM_PROC_NR, (phys_bytes) &swapon,
(phys_bytes) sizeof(swapon)) != OK) return(EFAULT);
return(swap_on(swapon.file, swapon.offset, swapon.size)); }
+3 -3
View File
@@ -53,7 +53,7 @@ PUBLIC int do_sigaction()
if (m_in.sig_nr < 1 || m_in.sig_nr > _NSIG) return (EINVAL);
svp = &mp->mp_sigact[m_in.sig_nr];
if ((struct sigaction *) m_in.sig_osa != (struct sigaction *) NULL) {
r = sys_datacopy(MM_PROC_NR,(vir_bytes) svp,
r = sys_datacopy(PM_PROC_NR,(vir_bytes) svp,
who, (vir_bytes) m_in.sig_osa, (phys_bytes) sizeof(svec));
if (r != OK) return(r);
}
@@ -63,7 +63,7 @@ PUBLIC int do_sigaction()
/* Read in the sigaction structure. */
r = sys_datacopy(who, (vir_bytes) m_in.sig_nsa,
MM_PROC_NR, (vir_bytes) &svec, (phys_bytes) sizeof(svec));
PM_PROC_NR, (vir_bytes) &svec, (phys_bytes) sizeof(svec));
if (r != OK) return(r);
if (svec.sa_handler == SIG_IGN) {
@@ -433,7 +433,7 @@ int signo; /* signal to send to process (1 to _NSIG) */
rmp->mp_sigact[signo].sa_handler = SIG_DFL;
}
sys_sendsig(slot, &sm);
sys_sigsend(slot, &sm);
sigdelset(&rmp->mp_sigpending, signo);
/* If process is hanging on PAUSE, WAIT, SIGSUSPEND, tty, pipe, etc.,
* release it.
+2 -2
View File
@@ -39,12 +39,12 @@ int mask; /* R_BIT, W_BIT, or X_BIT */
if (access(name_buf, mask) < 0) return(-errno);
/* The file is accessible but might not be readable. Make it readable. */
tell_fs(SETUID, MM_PROC_NR, (int) SUPER_USER, (int) SUPER_USER);
tell_fs(SETUID, PM_PROC_NR, (int) SUPER_USER, (int) SUPER_USER);
/* Open the file and fstat it. Restore the ids early to handle errors. */
fd = open(name_buf, O_RDONLY | O_NONBLOCK);
save_errno = errno; /* open might fail, e.g. from ENFILE */
tell_fs(SETUID, MM_PROC_NR, (int) mp->mp_effuid, (int) mp->mp_effuid);
tell_fs(SETUID, PM_PROC_NR, (int) mp->mp_effuid, (int) mp->mp_effuid);
if (fd < 0) return(-save_errno);
if (fstat(fd, s_buf) < 0) panic("allowed: fstat failed", NO_NUM);