BSD 4_4 release
[unix-history] / usr / src / sys / kern / sys_process.c
index ad238f0..c57aac7 100644 (file)
@@ -1,10 +1,12 @@
 /*-
 /*-
- * Copyright (c) 1982, 1986, 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.proprietary.c%
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
  *
  *
- *     @(#)sys_process.c       7.38 (Berkeley) %G%
+ *     @(#)sys_process.c       8.1 (Berkeley) 6/10/93
  */
 
 #define IPCREG
  */
 
 #define IPCREG
@@ -117,6 +119,11 @@ ptrace(curp, uap, retval)
 }
 
 #define        PHYSOFF(p, o) ((caddr_t)(p) + (o))
 }
 
 #define        PHYSOFF(p, o) ((caddr_t)(p) + (o))
+#if defined(hp300) || defined(luna68k)
+#define PHYSALIGNED(a) (((int)(a) & (sizeof(short) - 1)) == 0)
+#else
+#define PHYSALIGNED(a) (((int)(a) & (sizeof(int) - 1)) == 0)
+#endif
 
 #if defined(i386)
 #undef        PC
 
 #if defined(i386)
 #undef        PC
@@ -166,7 +173,7 @@ procxmt(p)
 
        case PT_READ_U:                 /* read the child's u. */
                i = (int)ipc.ip_addr;
 
        case PT_READ_U:                 /* read the child's u. */
                i = (int)ipc.ip_addr;
-               if ((u_int) i > ctob(UPAGES)-sizeof(int) || (i & 1) != 0)
+               if ((u_int) i > ctob(UPAGES)-sizeof(int) || !PHYSALIGNED(i))
                        goto error;
                ipc.ip_data = *(int *)PHYSOFF(p->p_addr, i);
                break;
                        goto error;
                ipc.ip_data = *(int *)PHYSOFF(p->p_addr, i);
                break;
@@ -200,7 +207,7 @@ procxmt(p)
        case PT_WRITE_U:                /* write the child's u. */
                i = (int)ipc.ip_addr;
 #ifdef mips
        case PT_WRITE_U:                /* write the child's u. */
                i = (int)ipc.ip_addr;
 #ifdef mips
-               poff = (int *)PHYSOFF(curproc->p_addr, i);
+               poff = (int *)PHYSOFF(p->p_addr, i);
 #else
                poff = (int *)PHYSOFF(kstack, i);
 #endif
 #else
                poff = (int *)PHYSOFF(kstack, i);
 #endif