Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 85106 | Differences between
and this patch

Collapse All | Expand All

(-)linux-2.6.11.3/include/asm-i386/system.h (-4 / +4 lines)
Lines 244-269 Link Here
244
#endif
244
#endif
245
245
246
static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
246
static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
247
				      unsigned long new, int size)
247
				      unsigned long _new, int size)
248
{
248
{
249
	unsigned long prev;
249
	unsigned long prev;
250
	switch (size) {
250
	switch (size) {
251
	case 1:
251
	case 1:
252
		__asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
252
		__asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2"
253
				     : "=a"(prev)
253
				     : "=a"(prev)
254
				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
254
				     : "q"(_new), "m"(*__xg(ptr)), "0"(old)
255
				     : "memory");
255
				     : "memory");
256
		return prev;
256
		return prev;
257
	case 2:
257
	case 2:
258
		__asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
258
		__asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2"
259
				     : "=a"(prev)
259
				     : "=a"(prev)
260
				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
260
				     : "q"(_new), "m"(*__xg(ptr)), "0"(old)
261
				     : "memory");
261
				     : "memory");
262
		return prev;
262
		return prev;
263
	case 4:
263
	case 4:
264
		__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
264
		__asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2"
265
				     : "=a"(prev)
265
				     : "=a"(prev)
266
				     : "q"(new), "m"(*__xg(ptr)), "0"(old)
266
				     : "q"(_new), "m"(*__xg(ptr)), "0"(old)
267
				     : "memory");
267
				     : "memory");
268
		return prev;
268
		return prev;
269
	}
269
	}
(-)linux-2.6.11.3/include/asm-x86_64/system.h (-24 / +26 lines)
Lines 4-9 Link Here
4
#include <linux/config.h>
4
#include <linux/config.h>
5
#include <linux/kernel.h>
5
#include <linux/kernel.h>
6
#include <asm/segment.h>
6
#include <asm/segment.h>
7
#include <linux/bitops.h> /* for LOCK_PREFIX... */
8
9
/*
10
 * Alternative inline assembly with input.
11
 * 
12
 * Pecularities:
13
 * No memory clobber here. 
14
 * Argument numbers start with 1.
15
 * Best is to use constraints that are fixed size (like (%1) ... "r")
16
 * If you use variable sized constraints like "m" or "g" in the 
17
 * replacement maake sure to pad to the worst case length.
18
 */
19
20
#define alternative_input(oldinstr, newinstr, feature, input)		\
21
	asm volatile ("661:\n\t" oldinstr "\n662:\n"			\
22
		      ".section .altinstructions,\"a\"\n"		\
23
		      "  .align 8\n"					\
24
		      "  .quad 661b\n"            /* label */		\
25
		      "  .quad 663f\n"		  /* new instruction */	\
26
		      "  .byte %c0\n"             /* feature bit */	\
27
		      "  .byte 662b-661b\n"       /* sourcelen */	\
28
		      "  .byte 664f-663f\n"       /* replacementlen */	\
29
		      ".previous\n"					\
30
		      ".section .altinstr_replacement,\"ax\"\n"		\
31
		      "663:\n\t" newinstr "\n664:\n"   /* replacement */ \
32
		      ".previous" :: "i" (feature), input)
7
33
8
#ifdef __KERNEL__
34
#ifdef __KERNEL__
9
35
Lines 114-143 Link Here
114
		      ".previous" :: "i" (feature) : "memory")  
140
		      ".previous" :: "i" (feature) : "memory")  
115
141
116
/*
142
/*
117
 * Alternative inline assembly with input.
118
 * 
119
 * Pecularities:
120
 * No memory clobber here. 
121
 * Argument numbers start with 1.
122
 * Best is to use constraints that are fixed size (like (%1) ... "r")
123
 * If you use variable sized constraints like "m" or "g" in the 
124
 * replacement maake sure to pad to the worst case length.
125
 */
126
#define alternative_input(oldinstr, newinstr, feature, input...)	\
127
	asm volatile ("661:\n\t" oldinstr "\n662:\n"			\
128
		      ".section .altinstructions,\"a\"\n"		\
129
		      "  .align 8\n"					\
130
		      "  .quad 661b\n"            /* label */		\
131
		      "  .quad 663f\n"		  /* new instruction */	\
132
		      "  .byte %c0\n"             /* feature bit */	\
133
		      "  .byte 662b-661b\n"       /* sourcelen */	\
134
		      "  .byte 664f-663f\n"       /* replacementlen */	\
135
		      ".previous\n"					\
136
		      ".section .altinstr_replacement,\"ax\"\n"		\
137
		      "663:\n\t" newinstr "\n664:\n"   /* replacement */ \
138
		      ".previous" :: "i" (feature), ##input)
139
140
/*
141
 * Clear and set 'TS' bit respectively
143
 * Clear and set 'TS' bit respectively
142
 */
144
 */
143
#define clts() __asm__ __volatile__ ("clts")
145
#define clts() __asm__ __volatile__ ("clts")

Return to bug 85106