public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin LaHaise <bcrl@redhat.com>
To: Manfred Spraul <manfred@colorfullife.com>,
	Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] current changes vs 2.4.15-pre4
Date: Tue, 13 Nov 2001 15:36:10 -0500	[thread overview]
Message-ID: <20011113153609.D17578@redhat.com> (raw)
In-Reply-To: <20011113022807.C14409@redhat.com>
In-Reply-To: <20011113022807.C14409@redhat.com>; from bcrl@redhat.com on Tue, Nov 13, 2001 at 02:28:07AM -0500

Hello,

Slight update since, as Manfred pointed out, the Pentium and i486 leave the 
upper bits of the register undefined.  Later intel docs claim the upper 
bits are zeroed, but I don't know what to believe anymore.  Also, removing 
the inline asm that was a silly idea lets gcc generate better code:

c0106008:       0f 00 c8                str    %ax
...
c0106012:       25 e0 ff 00 00          and    $0xffe0,%eax
...
c0106023:       8b 34 c5 40 25 3c c0    mov    0xc03c2540(,%eax,8),%esi

As Alan says: "x86 is really just an instruction stream compression format".

		-ben


diff -ur tr.prev/include/asm-i386/smp.h tr-2.4.15-pre4/include/asm-i386/smp.h
--- tr.prev/include/asm-i386/smp.h	Tue Nov 13 15:00:40 2001
+++ tr-2.4.15-pre4/include/asm-i386/smp.h	Tue Nov 13 15:19:39 2001
@@ -117,7 +117,7 @@
 	 * function calls.  Fun!  -ben
 	 */
 	__asm__ ("str %w0" : "=r" (tr) : "m" (dummy_cpu_id));
-	return tr;
+	return tr & 0xffe0;	/* Pentiums leave the high bits undefined. */
 }
 
 #define smp_processor_id()	( (get_TR() >> 5) - (__FIRST_TSS_ENTRY >> 2) )
@@ -128,13 +128,8 @@
  */
 #define smp_per_cpu_data()	\
 	( (struct per_cpu_data *)					\
-	  ({	long idx;						\
-		__asm__("str %w0 ; shll %1,%0"				\
-			: "=r" (idx)					\
-			: "i" (LOG2_PER_CPU_SIZE - 5)			\
-			, "m" (dummy_cpu_id));				\
-		(long)&aligned_data + idx -				\
-			(__FIRST_TSS_ENTRY << (LOG2_PER_CPU_SIZE - 2)); }) )
+	  ( (get_TR() << (LOG2_PER_CPU_SIZE - 5)) + (long)&aligned_data \
+		- (__FIRST_TSS_ENTRY << (LOG2_PER_CPU_SIZE - 2)) ) )
 
 static __inline int hard_smp_processor_id(void)
 {

      reply	other threads:[~2001-11-13 20:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-13  7:28 [RFC] current changes vs 2.4.15-pre4 Benjamin LaHaise
2001-11-13 20:36 ` Benjamin LaHaise [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011113153609.D17578@redhat.com \
    --to=bcrl@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox