From owner-freebsd-arch Tue Nov 21 17:57:59 2000 Delivered-To: freebsd-arch@freebsd.org Received: from io.yi.org (h24-69-199-88.gv.shawcable.net [24.69.199.88]) by hub.freebsd.org (Postfix) with ESMTP id 3F16437B479; Tue, 21 Nov 2000 17:57:56 -0800 (PST) Received: from io.yi.org (localhost.gvcl1.bc.wave.home.com [127.0.0.1]) by io.yi.org (Postfix) with ESMTP id AF470BA7A; Tue, 21 Nov 2000 17:57:56 -0800 (PST) X-Mailer: exmh version 2.1.1 10/15/1999 To: John Baldwin Cc: Daniel Eischen , Jonathan Lemon , arch@FreeBSD.ORG Subject: Re: Thread-specific data and KSEs In-Reply-To: Message from John Baldwin of "Tue, 21 Nov 2000 17:19:23 PST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 21 Nov 2000 17:57:56 -0800 From: Jake Burkholder Message-Id: <20001122015756.AF470BA7A@io.yi.org> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > On 22-Nov-00 Daniel Eischen wrote: > > On Tue, 21 Nov 2000, John Baldwin wrote: > >> > >> On 22-Nov-00 Daniel Eischen wrote: > >> > On Tue, 21 Nov 2000, Jonathan Lemon wrote: > >> >> On Tue, Nov 21, 2000 at 06:51:59PM -0500, Daniel Eischen wrote: > >> >> > I'm going to start working on the user-side of the new threads > >> >> > library. I need to be able to quickly get at the current KSE > >> >> > (or perhaps KSEG). Can we define a register on each architecture > >> >> > that should not be used by FreeBSD ABI compliant applications? > >> >> > The register doesn't have to be 32 bits or larger, just large > >> >> > enough to hold the maximum number of KSEs (or KSEGs). > >> >> > >> >> Um. On a i386 I'm not sure this will be practical, there aren't > >> >> a whole lot of architecturally visible registers for use by the > >> >> application. > >> > > >> > Why can't we use a segment register? > >> > >> %cs = code segment and is taken > >> %ds = data segment and is taken > >> %es = not sure, but bet it isn't safe > >> %ss = stack, taken > >> %fs = per-CPU data > > > > Isn't this kernel-only? > > I think so, but I would prefer that we use %gs if we go this route so that the > same mechanism can be used both in and out of the kernel. If that makes sense. > > >> %gs ? as I mentioned in my other message, this one might be useful for > >> addressing a structure of thread-local variables much like %fs is used for > >> per-CPU data. It also has value in that supposedly x86-64 (aka k64) has > >> both > >> %fs and %gs, but no other seg regs. > > > > All I need is one. > > Well, %gs would cover x86 and k64. I think ia64 has several application > registers that are available for OS use and we could steal one of those. I'm > not sure about the alpha though. > Doug uses $8 (t7) on the alpha for the per-cpu data pointer, and r13 on ia64. Not that that means anything to me. alpha/inclue/globals.h: register struct globaldata *globalp __asm__("$8"); ia64/include/globals.h: register struct globaldata *globalp __asm__("r13"); Its not really relevant if they're the same in and out of the kernel cause the memory isn't addressable in both places anyway. > -- > > John Baldwin -- http://www.FreeBSD.org/~jhb/ > PGP Key: http://www.baldwin.cx/~john/pgpkey.asc > "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-arch" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message