From owner-svn-src-head@FreeBSD.ORG Fri Dec 31 17:41:14 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCB6E10656A3; Fri, 31 Dec 2010 17:41:14 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB95A8FC0C; Fri, 31 Dec 2010 17:41:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oBVHfEde083634; Fri, 31 Dec 2010 17:41:14 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBVHfENF083632; Fri, 31 Dec 2010 17:41:14 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201012311741.oBVHfENF083632@svn.freebsd.org> From: Colin Percival Date: Fri, 31 Dec 2010 17:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216846 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2010 17:41:14 -0000 Author: cperciva Date: Fri Dec 31 17:41:14 2010 New Revision: 216846 URL: http://svn.freebsd.org/changeset/base/216846 Log: Make i386_set_ldt work on i386/XEN, step 4/5. Use xen_update_descriptor to update the LDT rather than bcopy. Under Xen, pages used for holding LDTs must be read-only, so we can't make the change ourselves. Ths obvious alternative of "remap the page read-write, make the change, then map it read-only again" doesn't work since Xen won't allow an LDT page to be remapped as R/W. An arguably better solution is used by NetBSD: They don't modify LDTs in-place at all, but instead copy the entire LDT, modify the new version, then atomically swap. MFC after: 3 days Modified: head/sys/i386/i386/sys_machdep.c Modified: head/sys/i386/i386/sys_machdep.c ============================================================================== --- head/sys/i386/i386/sys_machdep.c Fri Dec 31 17:40:30 2010 (r216845) +++ head/sys/i386/i386/sys_machdep.c Fri Dec 31 17:41:14 2010 (r216846) @@ -761,10 +761,14 @@ i386_set_ldt_data(struct thread *td, int mtx_assert(&dt_lock, MA_OWNED); - /* Fill in range */ - bcopy(descs, - &((union descriptor *)(pldt->ldt_base))[start], - num * sizeof(union descriptor)); + while (num) { + xen_update_descriptor( + &((union descriptor *)(pldt->ldt_base))[start], + descs); + num--; + start++; + descs++; + } return (0); } #else