diff --git a/WEGA/src/uts/sys/sig.c b/WEGA/src/uts/sys/sig.c index 2fe3bc4..36f8d51 100644 --- a/WEGA/src/uts/sys/sig.c +++ b/WEGA/src/uts/sys/sig.c @@ -1,4 +1,3 @@ -#include "sys/plexus.h" #include "sys/param.h" #include "sys/systm.h" #include "sys/dir.h" @@ -9,6 +8,8 @@ #include "sys/text.h" #include "sys/seg.h" #include "sys/var.h" +#include "sys/mtpr.h" +#include "sys/page.h" #include "sys/psl.h" /* @@ -185,7 +186,7 @@ fsig(p) struct proc *p; { register i; - long n; + register n; n = p->p_sig; for(i=1; i<=NSIG; i++) { @@ -206,18 +207,14 @@ struct proc *p; core() { register struct inode *ip; - register unsigned s; + register s; extern schar(); if (u.u_uid != u.u_ruid) return(0); u.u_error = 0; u.u_dirp = "core"; -#ifndef PNETDFS ip = namei(schar, 1); -#else - ip = namei(schar, 1, NULL); -#endif if(ip == NULL) { if(u.u_error) return(0); @@ -233,12 +230,13 @@ core() u.u_segflg = 1; u.u_limit = (daddr_t)ctod(MAXMEM); writei(ip); - s = u.u_procp->p_size - USIZE; - estabur((unsigned)0, s, (unsigned)0, 0, RO); - u.u_base = 0; - u.u_count = ctob(s); + u.u_base = (char *)ctob(u.u_tsize); + u.u_count = ctob(u.u_dsize); u.u_segflg = 0; writei(ip); + u.u_base = (char *)(0x80000000 - ctob(u.u_ssize)); + u.u_count = ctob(u.u_ssize); + writei(ip); } else u.u_error = EACCES; iput(ip); @@ -255,23 +253,21 @@ unsigned sp; { register si, i; register struct proc *p; - register a; - si = btoc(USRSTACK-sp) - u.u_ssize; + if(sp >= USRSTACK-ctob(u.u_ssize)) + return(0); + mtpr(TBIS, sp); + mtpr(TBIS, ((int *)&u) + 128*USIZE - u.u_ssize - 1); + si = btoc((USRSTACK-sp)) - u.u_ssize + SINCR; if(si <= 0) return(0); - if(estabur(u.u_tsize, u.u_dsize, u.u_ssize+si, u.u_sep, RO)) + if(chksize(u.u_tsize, u.u_dsize, u.u_ssize+si)) return(0); p = u.u_procp; - expand(p->p_size+si); - a = p->p_addr + p->p_size; - for(i=u.u_ssize; i; i--) { - a--; - copyseg(a-si, a); - } - for(i=si; i; i--) - clearseg(--a); u.u_ssize += si; + expand(si, P1BR); + for(i=si; --i>=0;) + clearseg(((int *)&u)[128*USIZE - u.u_ssize + i] & PG_PFNUM); return(1); } @@ -282,10 +278,10 @@ ptrace() { register struct proc *p; register struct a { - int data; + int req; int pid; int *addr; - int req; + int data; } *uap; uap = (struct a *)u.u_ap; @@ -319,6 +315,7 @@ ptrace() wakeup((caddr_t)&ipc); } +int ipcreg[] = {R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, AP, FP, SP, PC}; /* * Code that the child process * executes to implement the command @@ -352,7 +349,7 @@ procxmt() i = (int)ipc.ip_addr; if (i<0 || i >= ctob(USIZE)) goto error; - ipc.ip_data = ((physadr)&u)->r[i>>1]; + ipc.ip_data = ((physadr)&u)->r[i>>2]; break; /* write user I */ @@ -366,10 +363,10 @@ procxmt() goto error; xp->x_iptr->i_flag &= ~ITEXT; } - estabur(u.u_tsize, u.u_dsize, u.u_ssize, u.u_sep, RW); + chgprot(RW, 0, 0); i = suiword((caddr_t)ipc.ip_addr, 0); suiword((caddr_t)ipc.ip_addr, ipc.ip_data); - estabur(u.u_tsize, u.u_dsize, u.u_ssize, u.u_sep, RO); + chgprot(RO, 0, 0); if (i<0) goto error; if (xp) @@ -386,15 +383,13 @@ procxmt() /* write u */ case 6: i = (int)ipc.ip_addr; - p = (int *)&((physadr)&u)->r[i>>1]; - for (i=0; i<15; i++) - if (p == &u.u_ar0[regloc[i]]) + p = (int *)&((physadr)&u)->r[i>>2]; + for (i=0; i<16; i++) + if (p == &u.u_ar0[ipcreg[i]]) goto ok; - if (p == &u.u_ar0[PC]) - goto ok; - if (p == &u.u_ar0[FCW]) { - ipc.ip_data &= (M_FLGS << S_FLGS); - ipc.ip_data |= (B_VI | B_NVI); + if (p == &u.u_ar0[PS]) { + ipc.ip_data |= 0x3c00000; /* modes == user */ + ipc.ip_data &= ~0x3c20ff00; /* IS, FPD, ... */ goto ok; } goto error; @@ -406,9 +401,11 @@ procxmt() /* set signal and continue */ /* one version causes a trace-trap */ case 9: - u.u_ar0[FCW] |= B_SINGL; + u.u_ar0[PS] |= PS_T; case 7: - u.u_procp->p_sig = 0; + if ((int)ipc.ip_addr != 1) + u.u_ar0[PC] = (int)ipc.ip_addr; + u.u_procp->p_sig = 0L; if (ipc.ip_data) psignal(u.u_procp, ipc.ip_data); return(1); diff --git a/WEGA/src/uts/sys/sys2.c b/WEGA/src/uts/sys/sys2.c index f404881..a7fc4bd 100644 --- a/WEGA/src/uts/sys/sys2.c +++ b/WEGA/src/uts/sys/sys2.c @@ -5,9 +5,6 @@ #include "sys/file.h" #include "sys/inode.h" #include "sys/sysinfo.h" -#ifdef PNETDFS -extern ddbug; -#endif /* * read system call @@ -55,26 +52,14 @@ register mode; u.u_segflg = 0; u.u_fmode = fp->f_flag; ip = fp->f_inode; -#ifdef PNETDFS - if ( ip->i_flag & IRMT ) { - rrdwr( ip, uap->fdes, mode ); - goto dfsout; - } -#endif type = ip->i_mode&IFMT; if (type==IFREG || type==IFDIR) { + plock(ip); if ((u.u_fmode&FAPPEND) && (mode == FWRITE)) fp->f_offset = ip->i_size; - if (ip->i_locklist && - locked(1, ip, fp->f_offset, fp->f_offset + u.u_count)) - return; - plock(ip); } else if (type == IFIFO) { - fp->f_offset = 0; - if (ip->i_locklist && - locked(1, ip, fp->f_offset, fp->f_offset + u.u_count)) - return; plock(ip); + fp->f_offset = 0; } u.u_offset = fp->f_offset; if (mode == FREAD) @@ -83,9 +68,6 @@ register mode; writei(ip); if (type==IFREG || type==IFDIR || type==IFIFO) prele(ip); -#ifdef PNETDFS - dfsout: -#endif fp->f_offset += uap->count-u.u_count; u.u_rval1 = uap->count-u.u_count; u.u_ioch += u.u_rval1; @@ -141,11 +123,7 @@ register mode; return; } if (mode&FCREAT) { -#ifndef PNETDFS ip = namei(uchar, 1); -#else - ip = namei(uchar, 1, NULL); -#endif if (ip == NULL) { if (u.u_error) return; @@ -154,12 +132,6 @@ register mode; return; mode &= ~FTRUNC; } else { - if (ip->i_locklist != NULL && - (ip->i_flag & IFMT) == IFREG && - locked(2, ip, (long)(0L), (long)(1L<<30))) { - iput(ip); - return; - } if (mode&FEXCL) { u.u_error = EEXIST; iput(ip); @@ -168,11 +140,7 @@ register mode; mode &= ~FCREAT; } } else { -#ifndef PNETDFS ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if (ip == NULL) return; } @@ -196,12 +164,10 @@ register mode; fp->f_inode = ip; i = u.u_rval1; if (setjmp(u.u_qsav)) { /* catch half-opens */ - if (u.u_abreq) - (*u.u_abreq)(); if (u.u_error == 0) u.u_error = EINTR; - closef(fp); u.u_ofile[i] = NULL; + closef(fp); } else { openi(ip, mode); if (u.u_error == 0) @@ -226,8 +192,8 @@ close() fp = getf(uap->fdes); if (fp == NULL) return; - closef(fp); u.u_ofile[uap->fdes] = NULL; + closef(fp); } /* @@ -252,16 +218,6 @@ seek() u.u_error = ESPIPE; return; } -#ifdef PNETDFS - if ( ip->i_flag & IRMT ) { -if ( ddbug ) { - printf( "remote seek %x\n", ip ); - debug(); -} - rseek( uap->fdes, uap->off, uap->sbase ); - return; - } -#endif if (uap->sbase == 1) uap->off += fp->f_offset; else if (uap->sbase == 2) @@ -291,11 +247,7 @@ link() } *uap; uap = (struct a *)u.u_ap; -#ifndef PNETDFS ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if (ip == NULL) return; if (ip->i_nlink >= MAXLINK) { @@ -314,11 +266,7 @@ link() */ prele(ip); u.u_dirp = (caddr_t)uap->linkname; -#ifndef PNETDFS xp = namei(uchar, 1); -#else - xp = namei(uchar, 1, NULL); -#endif if (xp != NULL) { u.u_error = EEXIST; iput(xp); @@ -326,15 +274,6 @@ link() } if (u.u_error) goto out; -#ifdef PNETDFS - if ( u.u_pdir && u.u_pdir->i_flag & IRMT ) { - printf( "link on remote dfs, not there yet\n" ); - debug(); - u.u_error = EXDEV; - iput( u.u_pdir ); - goto out; - } -#endif if (u.u_pdir->i_dev != ip->i_dev) { iput(u.u_pdir); u.u_error = EXDEV; @@ -361,30 +300,17 @@ mknod() int fmode; dev_t dev; } *uap; -#ifdef PNETDFS - struct inode *rmaknode(); -#endif uap = (struct a *)u.u_ap; if ((uap->fmode&IFMT) != IFIFO && !suser()) return; -#ifndef PNETDFS ip = namei(uchar, 1); -#else - ip = namei(uchar, 1, NULL); -#endif if (ip != NULL) { u.u_error = EEXIST; goto out; } if (u.u_error) return; -#ifdef PNETDFS - if ( u.u_pdir->i_flag & IRMT ) { - ip = rmaknode( uap->fmode ); - return; - } -#endif ip = maknode(uap->fmode); if (ip == NULL) return; @@ -416,11 +342,7 @@ saccess() svgid = u.u_gid; u.u_uid = u.u_ruid; u.u_gid = u.u_rgid; -#ifndef PNETDFS ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if (ip != NULL) { if (uap->fmode&(IREAD>>6)) access(ip, IREAD); diff --git a/WEGA/src/uts/sys/sys3.c b/WEGA/src/uts/sys/sys3.c index 2961fad..86185e7 100644 --- a/WEGA/src/uts/sys/sys3.c +++ b/WEGA/src/uts/sys/sys3.c @@ -1,6 +1,5 @@ #include "sys/param.h" #include "sys/systm.h" -#include "sys/stat.h" #include "sys/mount.h" #include "sys/ino.h" #include "sys/buf.h" @@ -10,11 +9,9 @@ #include "sys/inode.h" #include "sys/file.h" #include "sys/conf.h" +#include "sys/stat.h" #include "sys/ioctl.h" #include "sys/var.h" -#ifdef PNETDFS -extern ddbug; -#endif /* * the fstat system call. @@ -46,11 +43,7 @@ stat() } *uap; uap = (struct a *)u.u_ap; -#ifndef PNETDFS ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if(ip == NULL) return; stat1(ip, uap->sb); @@ -65,16 +58,10 @@ stat1(ip, ub) register struct inode *ip; struct stat *ub; { + register struct dinode *dp; register struct buf *bp; struct stat ds; -#ifdef PNETDFS - if ( ip->i_flag & IRMT ) { - rstat1( ip, ub ); - return; - } -#endif - if(ip->i_flag&(IACC|IUPD|ICHG)) iupdat(ip, &time, &time); /* @@ -92,9 +79,11 @@ struct stat *ub; * next the dates in the disk */ bp = bread(ip->i_dev, itod(ip->i_number)); - copyio(paddr(bp)+itoo(ip->i_number)*sizeof(struct dinode) - +(long)(&((struct dinode *)0)->di_atime), - &ds.st_atime, 3*sizeof(time_t), U_RKD); + dp = bp->b_un.b_dino; + dp += itoo(ip->i_number); + ds.st_atime = dp->di_atime; + ds.st_mtime = dp->di_mtime; + ds.st_ctime = dp->di_ctime; brelse(bp); if (copyout((caddr_t)&ds, (caddr_t)ub, sizeof(ds)) < 0) u.u_error = EFAULT; @@ -102,42 +91,23 @@ struct stat *ub; /* * the dup system call. - * - * dup2 has been added to the stock SYSTEM III code for compatibility - * with v7. */ dup() { register struct file *fp; + register i; register struct a { int fdes; - int fdes2; } *uap; - register i,m; uap = (struct a *)u.u_ap; - m = uap->fdes & ~077; - uap->fdes &= 077; fp = getf(uap->fdes); if(fp == NULL) return; - if ((m&0100) == 0) { - if ((i = ufalloc(0)) < 0) - return; - } else { - i = uap->fdes2; - if (i<0 || i>=NOFILE) { - u.u_error = EBADF; - return; - } - u.u_rval1 = i; - } - if (i!=uap->fdes) { - if (u.u_ofile[i]!=NULL) - closef(u.u_ofile[i]); - u.u_ofile[i] = fp; - fp->f_count++; - } + if ((i = ufalloc(0)) < 0) + return; + u.u_ofile[i] = fp; + fp->f_count++; } /* @@ -166,15 +136,6 @@ fcntl() } if ((i = ufalloc(i)) < 0) return; -#ifdef PNETDFS - if ( fp->f_inode->i_flag & IRMT ) { -if ( ddbug ) { - printf( "fcntl dup on remote file %x\n", fp ); - debug(); -} - rfcntl( uap->fdes, i, 0, uap->arg ); - } -#endif u.u_ofile[i] = fp; fp->f_count++; break; @@ -193,15 +154,6 @@ if ( ddbug ) { case 4: fp->f_flag &= (FREAD|FWRITE); -#ifdef PNETDFS - if ( fp->f_inode->i_flag & IRMT ) { -if ( ddbug ) { - printf( "fcntl setfl on remote file %x\n", fp ); - debug(); -} - rfcntl( uap->fdes, i, 4, uap->arg ); - } -#endif fp->f_flag |= (uap->arg-FOPEN) & ~(FREAD|FWRITE); break; @@ -232,13 +184,6 @@ ioctl() u.u_error = ENOTTY; return; } - u.u_rval1 = 0; -#ifdef PNETDFS - if ( ip->i_flag & IRMT ) { - rioctl( uap->fdes, uap->cmd, uap->arg ); - return; - } -#endif dev = (dev_t)ip->i_rdev; (*cdevsw[major(dev)].d_ioctl)(minor(dev),uap->cmd,uap->arg,fp->f_flag); } @@ -298,11 +243,7 @@ smount() if(u.u_error) return; u.u_dirp = (caddr_t)uap->freg; -#ifndef PNETDFS ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if(ip == NULL) return; if ((ip->i_mode&IFMT) != IFDIR) { @@ -336,9 +277,9 @@ smount() goto out1; } mp->m_inodp = ip; - mp->m_bufp = getablk(1); - fp = (struct filsys *)paddr(mp->m_bufp); - copyio(paddr(bp), fp, sizeof(struct filsys), U_RKD); + mp->m_bufp = geteblk(); + bcopy((caddr_t)bp->b_un.b_addr, mp->m_bufp->b_un.b_addr, BSIZE); + fp = mp->m_bufp->b_un.b_filsys; mp->m_flags = MINUSE; fp->s_ilock = 0; fp->s_flock = 0; @@ -411,11 +352,7 @@ getmdev() dev_t dev; register struct inode *ip; -#ifndef PNETDFS ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if(ip == NULL) return(NODEV); if((ip->i_mode&IFMT) != IFBLK) diff --git a/WEGA/src/uts/sys/sys4.c b/WEGA/src/uts/sys/sys4.c index fa9ba1a..ffe1c7f 100644 --- a/WEGA/src/uts/sys/sys4.c +++ b/WEGA/src/uts/sys/sys4.c @@ -1,15 +1,13 @@ #include "sys/param.h" -#include "sys/plexus.h" #include "sys/systm.h" #include "sys/dir.h" #include "sys/user.h" #include "sys/inode.h" #include "sys/proc.h" #include "sys/var.h" +#include "sys/mtpr.h" +#include "sys/clock.h" -#ifdef PNETDFS -extern int ddbug; -#endif /* * Everything in this file is a routine implementing a system call. */ @@ -21,6 +19,7 @@ gtime() stime() { + register unsigned i; register struct a { time_t time; } *uap; @@ -29,7 +28,12 @@ stime() if (suser()) { logtchg(uap->time); time = uap->time; - puttod(time); + /* + * In addition to setting software time + * also set VAX TODR. + */ + i = urem(time, SECYR); + mtpr(TODR,i*100) ; /* 10 ms. clicks */ } } @@ -144,22 +148,9 @@ unlink() char *fname; }; -#ifndef PNETDFS pp = namei(uchar, 2); -#else - pp = namei(uchar, 2, NULL); -#endif if (pp == NULL) return; -#ifdef PNETDFS - if ( pp->i_flag & IRMT ) { -if ( ddbug ) { - printf( "remote unlink, not there yet\n" ); - debug(); -} - goto out1; - } -#endif /* * Check for unlink(".") * to avoid hanging on the iget @@ -223,11 +214,7 @@ register struct inode **ipp; char *fname; }; -#ifndef PNETDFS ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if (ip == NULL) return; if ((ip->i_mode&IFMT) != IFDIR) { @@ -265,12 +252,6 @@ chmod() if (u.u_gid != ip->i_gid) uap->fmode &= ~ISGID; } -#ifdef PNETDFS - if ( ip->i_flag & IRMT ) { - rchmod( ip, uap->fmode ); - return; - } -#endif ip->i_mode |= uap->fmode&07777; ip->i_flag |= ICHG; if (ip->i_flag&ITEXT && (ip->i_mode&ISVTX)==0) @@ -290,12 +271,6 @@ chown() uap = (struct a *)u.u_ap; if ((ip = owner()) == NULL) return; -#ifdef PNETDFS - if ( ip->i_flag & IRMT ) { - rchown( ip, uap->uid, uap->gid ); - return; - } -#endif ip->i_uid = uap->uid; ip->i_gid = uap->gid; if (u.u_uid != 0) @@ -479,11 +454,7 @@ utime() tv[0] = time; tv[1] = time; } -#ifndef ip = namei(uchar, 0); -#else - ip = namei(uchar, 0, NULL); -#endif if (ip == NULL) return; if (u.u_uid != ip->i_uid && u.u_uid != 0) { @@ -493,12 +464,6 @@ utime() access(ip, IWRITE); } if (!u.u_error) { -#ifdef PNETDFS - if ( ip->i_flag & IRMT ) { - rutime( ip, &tv[0], &tv[1] ); - return; - } -#endif ip->i_flag |= IACC|IUPD|ICHG; iupdat(ip, &tv[0], &tv[1]); } @@ -512,8 +477,6 @@ ulimit() long arg; } *uap; - register brk, stk; - uap = (struct a *)u.u_ap; switch(uap->cmd) { case 2: @@ -525,7 +488,7 @@ ulimit() break; case 3: - u.u_roff = ctob((long)(NUMLOGPAGE - u.u_ssize)); + u.u_roff = ctob(maxmem - UPAGES - MAXUMEM/128); break; } }