From owner-cvs-all@FreeBSD.ORG Wed Apr 13 23:32:16 2005 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 99F8416A4CE; Wed, 13 Apr 2005 23:32:16 +0000 (GMT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 57A7C43D39; Wed, 13 Apr 2005 23:32:16 +0000 (GMT) (envelope-from peter@evilpete.dyndns.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id 074EA2A923; Wed, 13 Apr 2005 16:32:16 -0700 (PDT) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (overcee.wemm.org [10.0.0.3]) by fw.wemm.org (Postfix) with ESMTP id 9ACCCE2B3; Wed, 13 Apr 2005 16:32:15 -0700 (PDT) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (localhost [127.0.0.1]) by overcee.wemm.org (8.13.1/8.13.1) with ESMTP id j3DNWHvw021774; Wed, 13 Apr 2005 16:32:17 -0700 (PDT) (envelope-from peter@overcee.wemm.org) Received: (from peter@localhost) by overcee.wemm.org (8.13.1/8.13.1/Submit) id j3DNWHRX021773; Wed, 13 Apr 2005 16:32:17 -0700 (PDT) (envelope-from peter) Date: Wed, 13 Apr 2005 16:32:17 -0700 From: Peter Wemm To: Peter Wemm Message-ID: <20050413233217.GA21723@overcee.wemm.org> References: <200504132257.j3DMvHha095246@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200504132257.j3DMvHha095246@repoman.freebsd.org> User-Agent: Mutt/1.4.2.1i cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/i386 genassym.c machdep.c mp_machdep.c swtch.s sys_machdep.c src/sys/i386/include pcb.h pcpu.h segments.h sysarch.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2005 23:32:16 -0000 On Wed, Apr 13, 2005 at 10:57:17PM +0000, Peter Wemm wrote: > peter 2005-04-13 22:57:17 UTC > > FreeBSD src repository > > Modified files: > sys/i386/i386 genassym.c machdep.c mp_machdep.c swtch.s > sys_machdep.c > sys/i386/include pcb.h pcpu.h segments.h sysarch.h > Log: > Change the segment limits to 4GB, we set the user accessible bit on all > of the kernel address space already. Intel recommend this anyway, because > using a non-4GB limit adds an additional clock cycle to address generation. > We were able to install 4GB segments into the LDT, so any limits we imposed > on %cs and %ds were academic anyway. More importantly, this allows us to > make a page in the kernel readable to user applications, for holding things > like the signal trampoline and other fun things. > > Move the user %cs/%ds segments from the LDT to the GDT. There was no good > reason for them to be there anyway. The old LDT entries are still there > but we can now relax the restriction that prevented users from emptying > the default LDT entries. > > Putting user and kernel %cs and %ds together allows us to access the fast > sysenter/sysexit/syscall/sysret instructions. syscall/sysret in particular > require that the user/kernel segments be laid out this way. Reserve a slot > specifically for NDIS while here. > > Create two user controllable slots in the GDT that are context switched > with the (kernel) thread. This allows user applications to set two > user privilige selectors to arbitary values. Create > i386_set_fsbase(void *base) and friends. (get/set, fs/gs). For i386, > %gs is used by tls and the thread libraries and this means that user > processes no longer have to have the cost of having a custom LDT, and > we will no longer to do a ldt switch when activating a kthread/ithread in > the usual case any more. > > In other words, we can now set the base address for %fs and %gs to arbitary > addresses without the pain of messing with ldt segments. Please note that I have not tested this with SMP yet, but I am 99.9% sure that it will work. I have a bunch of patches for userland that will use this stuff. It does fall back to the old ldt method if you boot a kernel.old, so it should be safe to commit these shortly. I have patches for ld.so, libc and libpthread. I have not tried libthr yet. -Peter