aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/lib')
-rw-r--r--arch/x86/lib/bitstr_64.c2
-rw-r--r--arch/x86/lib/msr-on-cpu.c62
-rw-r--r--arch/x86/lib/rwlock_64.S2
-rw-r--r--arch/x86/lib/semaphore_32.S4
-rw-r--r--arch/x86/lib/string_32.c20
5 files changed, 26 insertions, 64 deletions
diff --git a/arch/x86/lib/bitstr_64.c b/arch/x86/lib/bitstr_64.c
index 24676609a6ac..7445caf1b5de 100644
--- a/arch/x86/lib/bitstr_64.c
+++ b/arch/x86/lib/bitstr_64.c
@@ -14,7 +14,7 @@ find_next_zero_string(unsigned long *bitmap, long start, long nbits, int len)
14 14
15 /* could test bitsliced, but it's hardly worth it */ 15 /* could test bitsliced, but it's hardly worth it */
16 end = n+len; 16 end = n+len;
17 if (end >= nbits) 17 if (end > nbits)
18 return -1; 18 return -1;
19 for (i = n+1; i < end; i++) { 19 for (i = n+1; i < end; i++) {
20 if (test_bit(i, bitmap)) { 20 if (test_bit(i, bitmap)) {
diff --git a/arch/x86/lib/msr-on-cpu.c b/arch/x86/lib/msr-on-cpu.c
index 7767962f25d3..57d043fa893e 100644
--- a/arch/x86/lib/msr-on-cpu.c
+++ b/arch/x86/lib/msr-on-cpu.c
@@ -26,27 +26,18 @@ static void __rdmsr_safe_on_cpu(void *info)
26static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) 26static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe)
27{ 27{
28 int err = 0; 28 int err = 0;
29 preempt_disable(); 29 struct msr_info rv;
30 if (smp_processor_id() == cpu) 30
31 if (safe) 31 rv.msr_no = msr_no;
32 err = rdmsr_safe(msr_no, l, h); 32 if (safe) {
33 else 33 smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 0, 1);
34 rdmsr(msr_no, *l, *h); 34 err = rv.err;
35 else { 35 } else {
36 struct msr_info rv; 36 smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1);
37
38 rv.msr_no = msr_no;
39 if (safe) {
40 smp_call_function_single(cpu, __rdmsr_safe_on_cpu,
41 &rv, 0, 1);
42 err = rv.err;
43 } else {
44 smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1);
45 }
46 *l = rv.l;
47 *h = rv.h;
48 } 37 }
49 preempt_enable(); 38 *l = rv.l;
39 *h = rv.h;
40
50 return err; 41 return err;
51} 42}
52 43
@@ -67,27 +58,18 @@ static void __wrmsr_safe_on_cpu(void *info)
67static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) 58static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe)
68{ 59{
69 int err = 0; 60 int err = 0;
70 preempt_disable(); 61 struct msr_info rv;
71 if (smp_processor_id() == cpu) 62
72 if (safe) 63 rv.msr_no = msr_no;
73 err = wrmsr_safe(msr_no, l, h); 64 rv.l = l;
74 else 65 rv.h = h;
75 wrmsr(msr_no, l, h); 66 if (safe) {
76 else { 67 smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 0, 1);
77 struct msr_info rv; 68 err = rv.err;
78 69 } else {
79 rv.msr_no = msr_no; 70 smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1);
80 rv.l = l;
81 rv.h = h;
82 if (safe) {
83 smp_call_function_single(cpu, __wrmsr_safe_on_cpu,
84 &rv, 0, 1);
85 err = rv.err;
86 } else {
87 smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1);
88 }
89 } 71 }
90 preempt_enable(); 72
91 return err; 73 return err;
92} 74}
93 75
diff --git a/arch/x86/lib/rwlock_64.S b/arch/x86/lib/rwlock_64.S
index 0cde1f807314..05ea55f71405 100644
--- a/arch/x86/lib/rwlock_64.S
+++ b/arch/x86/lib/rwlock_64.S
@@ -2,7 +2,7 @@
2 2
3#include <linux/linkage.h> 3#include <linux/linkage.h>
4#include <asm/rwlock.h> 4#include <asm/rwlock.h>
5#include <asm/alternative-asm.i> 5#include <asm/alternative-asm.h>
6#include <asm/dwarf2.h> 6#include <asm/dwarf2.h>
7 7
8/* rdi: pointer to rwlock_t */ 8/* rdi: pointer to rwlock_t */
diff --git a/arch/x86/lib/semaphore_32.S b/arch/x86/lib/semaphore_32.S
index c01eb39c0b43..444fba400983 100644
--- a/arch/x86/lib/semaphore_32.S
+++ b/arch/x86/lib/semaphore_32.S
@@ -15,8 +15,8 @@
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <asm/rwlock.h> 17#include <asm/rwlock.h>
18#include <asm/alternative-asm.i> 18#include <asm/alternative-asm.h>
19#include <asm/frame.i> 19#include <asm/frame.h>
20#include <asm/dwarf2.h> 20#include <asm/dwarf2.h>
21 21
22/* 22/*
diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c
index 2c773fefa3dd..c2c0504a3071 100644
--- a/arch/x86/lib/string_32.c
+++ b/arch/x86/lib/string_32.c
@@ -160,26 +160,6 @@ char *strchr(const char * s, int c)
160EXPORT_SYMBOL(strchr); 160EXPORT_SYMBOL(strchr);
161#endif 161#endif
162 162
163#ifdef __HAVE_ARCH_STRRCHR
164char *strrchr(const char * s, int c)
165{
166 int d0, d1;
167 char * res;
168 asm volatile( "movb %%al,%%ah\n"
169 "1:\tlodsb\n\t"
170 "cmpb %%ah,%%al\n\t"
171 "jne 2f\n\t"
172 "leal -1(%%esi),%0\n"
173 "2:\ttestb %%al,%%al\n\t"
174 "jne 1b"
175 :"=g" (res), "=&S" (d0), "=&a" (d1)
176 :"0" (0),"1" (s),"2" (c)
177 :"memory");
178 return res;
179}
180EXPORT_SYMBOL(strrchr);
181#endif
182
183#ifdef __HAVE_ARCH_STRLEN 163#ifdef __HAVE_ARCH_STRLEN
184size_t strlen(const char * s) 164size_t strlen(const char * s)
185{ 165{