aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/intel.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c
index 43601de0f633..c28d26fb5f24 100644
--- a/arch/i386/kernel/cpu/intel.c
+++ b/arch/i386/kernel/cpu/intel.c
@@ -6,6 +6,7 @@
6#include <linux/bitops.h> 6#include <linux/bitops.h>
7#include <linux/smp.h> 7#include <linux/smp.h>
8#include <linux/thread_info.h> 8#include <linux/thread_info.h>
9#include <linux/module.h>
9 10
10#include <asm/processor.h> 11#include <asm/processor.h>
11#include <asm/msr.h> 12#include <asm/msr.h>
@@ -264,5 +265,52 @@ __init int intel_cpu_init(void)
264 return 0; 265 return 0;
265} 266}
266 267
268#ifndef CONFIG_X86_CMPXCHG
269unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new)
270{
271 u8 prev;
272 unsigned long flags;
273
274 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
275 local_irq_save(flags);
276 prev = *(u8 *)ptr;
277 if (prev == old)
278 *(u8 *)ptr = new;
279 local_irq_restore(flags);
280 return prev;
281}
282EXPORT_SYMBOL(cmpxchg_386_u8);
283
284unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new)
285{
286 u16 prev;
287 unsigned long flags;
288
289 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
290 local_irq_save(flags);
291 prev = *(u16 *)ptr;
292 if (prev == old)
293 *(u16 *)ptr = new;
294 local_irq_restore(flags);
295 return prev;
296}
297EXPORT_SYMBOL(cmpxchg_386_u16);
298
299unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new)
300{
301 u32 prev;
302 unsigned long flags;
303
304 /* Poor man's cmpxchg for 386. Unsuitable for SMP */
305 local_irq_save(flags);
306 prev = *(u32 *)ptr;
307 if (prev == old)
308 *(u32 *)ptr = new;
309 local_irq_restore(flags);
310 return prev;
311}
312EXPORT_SYMBOL(cmpxchg_386_u32);
313#endif
314
267// arch_initcall(intel_cpu_init); 315// arch_initcall(intel_cpu_init);
268 316