From owner-p4-projects@FreeBSD.ORG Thu Jun 30 00:57:20 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BFF1216A420; Thu, 30 Jun 2005 00:57:19 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9A99316A41C for ; Thu, 30 Jun 2005 00:57:19 +0000 (GMT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E73443D4C for ; Thu, 30 Jun 2005 00:57:19 +0000 (GMT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j5U0vJPv063563 for ; Thu, 30 Jun 2005 00:57:19 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j5U0vJLn063560 for perforce@freebsd.org; Thu, 30 Jun 2005 00:57:19 GMT (envelope-from peter@freebsd.org) Date: Thu, 30 Jun 2005 00:57:19 GMT Message-Id: <200506300057.j5U0vJLn063560@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Cc: Subject: PERFORCE change 79218 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 00:57:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=79218 Change 79218 by peter@peter_overcee on 2005/06/30 00:56:26 *blush* un-reverse copyout args Affected files ... .. //depot/projects/hammer/sys/kern/sys_process.c#30 edit Differences ... ==== //depot/projects/hammer/sys/kern/sys_process.c#30 (text+ko) ==== @@ -156,6 +156,7 @@ } #ifdef COMPAT_IA32 +/* For 32 bit binaries, we need to expose the 32 bit regs layouts. */ int proc_read_regs32(struct thread *td, struct reg32 *regs32) { @@ -352,10 +353,20 @@ #endif #ifdef COMPAT_IA32 +/* + * This CPP subterfuge is to try and reduce the number of ifdefs in + * the body of the code. + * COPYIN(uap->addr, &r.reg, sizeof r.reg); + * becomes either: + * copyin(uap->addr, &r.reg, sizeof r.reg); + * or + * copyin(uap->addr, &r.reg32, sizeof r.reg32); + * .. except this is done at runtime. + */ #define COPYIN(u, k, s) wrap32 ? \ - copyin(u, k ## 32, s ##32) : copyin(u, k, s) + copyin(u, k ## 32, s ## 32) : copyin(u, k, s) #define COPYOUT(k, u, s) wrap32 ? \ - copyout(k ## 32, u, s ##32) : copyout(u, k, s) + copyout(k ## 32, u, s ## 32) : copyout(k, u, s) #else #define COPYIN(u, k, s) copyin(u, k, s) #define COPYOUT(k, u, s) copyout(k, u, s) @@ -445,10 +456,23 @@ #undef COPYOUT #ifdef COMPAT_IA32 +/* + * This CPP subterfuge is to try and reduce the number of ifdefs in + * the body of the code. + * PROC_READ(regs, td2, addr); + * becomes either: + * proc_read_regs(td2, addr); + * or + * proc_read_regs32(td2, addr); + * .. except this is done at runtime. There is an additional + * complication in that PROC_WRITE disallows 32 bit consumers + * from writing to 64 bit address space targets. + */ #define PROC_READ(w, t, a) wrap32 ? \ - proc_read_ ## w ## 32(t, a) : proc_read_ ## w (t, a) + proc_read_ ## w ## 32(t, a) : proc_read_ ## w (t, a) #define PROC_WRITE(w, t, a) wrap32 ? \ - (safe ? proc_write_ ## w ## 32(t, a) : EINVAL ) : proc_write_ ## w (t, a) + (safe ? proc_write_ ## w ## 32(t, a) : EINVAL ) : \ + proc_write_ ## w (t, a) #else #define PROC_READ(w, t, a) proc_read_ ## w (t, a) #define PROC_WRITE(w, t, a) proc_write_ ## w (t, a) @@ -547,6 +571,10 @@ } #ifdef COMPAT_IA32 + /* + * Test if we're a 32 bit client and what the target is. + * Set the wrap controls accordingly. + */ if (td->td_proc->p_sysent == &ia32_freebsd_sysvec) { if (td2->td_proc->p_sysent == &ia32_freebsd_sysvec) safe = 1;