Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2003 18:15:54 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 29754 for review
Message-ID:  <200304260115.h3Q1Fs28006224@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29754

Change 29754 by peter@peter_daintree on 2003/04/25 18:15:52

	remove stub pcpu stuff, use %gs instead of %fs since we have hardware
	support for %gs via syscall/sysret

Affected files ...

.. //depot/projects/hammer/sys/x86_64/include/asmacros.h#5 edit
.. //depot/projects/hammer/sys/x86_64/include/pcpu.h#10 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/include/asmacros.h#5 (text+ko) ====

@@ -64,13 +64,9 @@
 #define NON_GPROF_RET		.byte 0xc3	/* opcode for `ret' */
 
 #ifdef LOCORE
-#if 0
-#define	PCPU(member)	%fs:PC_ ## member
-#define	PCPU_ADDR(member, reg)	movq %fs:PC_PRVSPACE,reg; \
+#define	PCPU(member)	%gs:PC_ ## member
+#define	PCPU_ADDR(member, reg)	movq %gs:PC_PRVSPACE,reg; \
 			addq $PC_ ## member,reg
-#else
-#define PCPU(member)	__pcpu + PC_ ## member
-#endif
 #endif
 
 #ifdef GPROF

==== //depot/projects/hammer/sys/x86_64/include/pcpu.h#10 (text+ko) ====

@@ -52,7 +52,6 @@
  
 #elif defined(__GNUC__)
 
-#if 0
 /*
  * Evaluates to the byte offset of the per-cpu variable name.
  */
@@ -71,7 +70,7 @@
 #define	__PCPU_PTR(name) ({						\
 	__pcpu_type(name) *__p;						\
 									\
-	__asm __volatile("movq %%fs:%1,%0; addq %2,%0"			\
+	__asm __volatile("movq %%gs:%1,%0; addq %2,%0"			\
 	    : "=r" (__p)						\
 	    : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))),	\
 	      "i" (__pcpu_offset(name)));				\
@@ -87,25 +86,25 @@
 									\
 	if (sizeof(__result) == 1) {					\
 		u_char __b;						\
-		__asm __volatile("movb %%fs:%1,%0"			\
+		__asm __volatile("movb %%gs:%1,%0"			\
 		    : "=r" (__b)					\
 		    : "m" (*(u_char *)(__pcpu_offset(name))));		\
 		__result = *(__pcpu_type(name) *)&__b;			\
 	} else if (sizeof(__result) == 2) {				\
 		u_short __w;						\
-		__asm __volatile("movw %%fs:%1,%0"			\
+		__asm __volatile("movw %%gs:%1,%0"			\
 		    : "=r" (__w)					\
 		    : "m" (*(u_short *)(__pcpu_offset(name))));		\
 		__result = *(__pcpu_type(name) *)&__w;			\
 	} else if (sizeof(__result) == 4) {				\
 		u_int __i;						\
-		__asm __volatile("movl %%fs:%1,%0"			\
+		__asm __volatile("movl %%gs:%1,%0"			\
 		    : "=r" (__i)					\
 		    : "m" (*(u_int *)(__pcpu_offset(name))));		\
 		__result = *(__pcpu_type(name) *)&__i;			\
 	} else if (sizeof(__result) == 8) {				\
 		u_long __l;						\
-		__asm __volatile("movq %%fs:%1,%0"			\
+		__asm __volatile("movq %%gs:%1,%0"			\
 		    : "=r" (__l)					\
 		    : "m" (*(u_long *)(__pcpu_offset(name))));		\
 		__result = *(__pcpu_type(name) *)&__l;			\
@@ -125,25 +124,25 @@
 	if (sizeof(__val) == 1) {					\
 		u_char __b;						\
 		__b = *(u_char *)&__val;				\
-		__asm __volatile("movb %1,%%fs:%0"			\
+		__asm __volatile("movb %1,%%gs:%0"			\
 		    : "=m" (*(u_char *)(__pcpu_offset(name)))		\
 		    : "r" (__b));					\
 	} else if (sizeof(__val) == 2) {				\
 		u_short __w;						\
 		__w = *(u_short *)&__val;				\
-		__asm __volatile("movw %1,%%fs:%0"			\
+		__asm __volatile("movw %1,%%gs:%0"			\
 		    : "=m" (*(u_short *)(__pcpu_offset(name)))		\
 		    : "r" (__w));					\
 	} else if (sizeof(__val) == 4) {				\
 		u_int __i;						\
 		__i = *(u_int *)&__val;					\
-		__asm __volatile("movl %1,%%fs:%0"			\
+		__asm __volatile("movl %1,%%gs:%0"			\
 		    : "=m" (*(u_int *)(__pcpu_offset(name)))		\
 		    : "r" (__i));					\
 	} else if (sizeof(__val) == 8) {				\
 		u_long __l;						\
 		__l = *(u_long *)&__val;				\
-		__asm __volatile("movq %1,%%fs:%0"			\
+		__asm __volatile("movq %1,%%gs:%0"			\
 		    : "=m" (*(u_long *)(__pcpu_offset(name)))		\
 		    : "r" (__l));					\
 	} else {							\
@@ -154,15 +153,6 @@
 #define	PCPU_GET(member)	__PCPU_GET(pc_ ## member)
 #define	PCPU_PTR(member)	__PCPU_PTR(pc_ ## member)
 #define	PCPU_SET(member, val)	__PCPU_SET(pc_ ## member, val)
-#else
-
-extern struct pcpu __pcpu;
- 
-#define PCPU_GET(member)        (__pcpu.pc_ ## member)
-#define PCPU_PTR(member)        (&__pcpu.pc_ ## member)
-#define PCPU_SET(member,value)  (__pcpu.pc_ ## member = (value))
-
-#endif
 
 #else
 #error gcc or lint is required to use this file



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304260115.h3Q1Fs28006224>