From owner-freebsd-amd64@FreeBSD.ORG Mon Jun 25 18:05:44 2007 Return-Path: X-Original-To: freebsd-amd64@freebsd.org Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7B61F16A400 for ; Mon, 25 Jun 2007 18:05:44 +0000 (UTC) (envelope-from kbottle@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.231]) by mx1.freebsd.org (Postfix) with ESMTP id 2518813C45D for ; Mon, 25 Jun 2007 18:05:44 +0000 (UTC) (envelope-from kbottle@gmail.com) Received: by wr-out-0506.google.com with SMTP id 70so994625wra for ; Mon, 25 Jun 2007 11:05:43 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=OUaVzyb0geCfkB9+h+VBZW3srF/dQHcanszjzWlCK8JYYtYrBnU9icf0mF9jlt6Cd6mF3KI0OF2bQ5HM/ZXx+2ZjT26sEshXDk52MI+V+cqN1Ef+ejB262SUFw5+fhQwvyr8SVGVAmN+TgWDAL8a0laQUPlBqWZTdjO8SRQQIUg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=lzgrqwXmNXoU5134Fw2ZmWvewMUKyf9KchRHuEWmX2EbfkFb7TioVRmpg/RBvn11/0/8XmBKV25tBjoRsf+fEjROCcGSS9LW/B1Wl7WRpj63t+6SYst2ez+19nQLO9mWu8s7BcA3kdLoqJuiExfY5sKR1PniZBeOovE5XneRB/Y= Received: by 10.100.174.16 with SMTP id w16mr3287131ane.1182793069912; Mon, 25 Jun 2007 10:37:49 -0700 (PDT) Received: by 10.100.107.9 with HTTP; Mon, 25 Jun 2007 10:37:49 -0700 (PDT) Message-ID: <293b12a20706251037t39a0227p45434a8d71feeba1@mail.gmail.com> Date: Tue, 26 Jun 2007 01:37:49 +0800 From: "jj shen" To: freebsd-amd64@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: The relation between %fs and fs base X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2007 18:05:44 -0000 Hi, I want to access different TLS through both fs base and GDT simultaneously. Let us call the two ways TLS_FSBASE and TLS_GDT respectively. (1) Can I switch from TLS_FSBASE to TLS_GDT just by: "movl GDT_SEL, %fs" (where GDT_SEL is the selector of GDT entry)? Will this instruction destroy the content of the IA32_FS_BASE MSR? (2) When switching from TLS_GDT to TLS_FSBASE, can I just set %fs to zero to indicate the fs base should be used, or must I invoke the *wrmsrl*instruction to reset IA32_FS_BASE once again? (3) What is the length of %fs? What I get by "movl %fs, %eax" in %eax? In the programmer manual from AMD, it is said somewhere that segment registers are still 16 bits as in x86, and it is also said otherwhere that "segment loads into FS and GS load a standard 32-bit base value in the hidden portion of the segment descriptor register". (4) What is the content of %fs, a descriptor selector or a base address smaller than 0xffffffff? What is effect of "movl val, %fs", loading a GDT selector or a 32-bit base address to %fs? Seen from the citation above, I think *val *should be a 32-bit base address; however seen from the implementation of Linux *arch_prctl* system call, it is a GDT selector loaded into %fs. Anyone help me? Thanks, Dimension