-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 112751 b: refs/heads/master c: 774400a h: refs/heads/master i: 112749: c7a69b6 112747: b20c4fe 112743: c6d4aaa 112735: 611425d v: v3
- Loading branch information
Thomas Petazzoni
authored and
Ingo Molnar
committed
Aug 18, 2008
1 parent
4608318
commit 2e95938
Showing
4 changed files
with
74 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 8bfcb3960fde049b863266dab8c3617bb5a541aa | ||
refs/heads/master: 774400a3ba23b63f4de39e67ce6c4e48935809dc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* cmpxchg*() fallbacks for CPU not supporting these instructions | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/smp.h> | ||
#include <linux/module.h> | ||
|
||
#ifndef CONFIG_X86_CMPXCHG | ||
unsigned long cmpxchg_386_u8(volatile void *ptr, u8 old, u8 new) | ||
{ | ||
u8 prev; | ||
unsigned long flags; | ||
|
||
/* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
local_irq_save(flags); | ||
prev = *(u8 *)ptr; | ||
if (prev == old) | ||
*(u8 *)ptr = new; | ||
local_irq_restore(flags); | ||
return prev; | ||
} | ||
EXPORT_SYMBOL(cmpxchg_386_u8); | ||
|
||
unsigned long cmpxchg_386_u16(volatile void *ptr, u16 old, u16 new) | ||
{ | ||
u16 prev; | ||
unsigned long flags; | ||
|
||
/* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
local_irq_save(flags); | ||
prev = *(u16 *)ptr; | ||
if (prev == old) | ||
*(u16 *)ptr = new; | ||
local_irq_restore(flags); | ||
return prev; | ||
} | ||
EXPORT_SYMBOL(cmpxchg_386_u16); | ||
|
||
unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new) | ||
{ | ||
u32 prev; | ||
unsigned long flags; | ||
|
||
/* Poor man's cmpxchg for 386. Unsuitable for SMP */ | ||
local_irq_save(flags); | ||
prev = *(u32 *)ptr; | ||
if (prev == old) | ||
*(u32 *)ptr = new; | ||
local_irq_restore(flags); | ||
return prev; | ||
} | ||
EXPORT_SYMBOL(cmpxchg_386_u32); | ||
#endif | ||
|
||
#ifndef CONFIG_X86_CMPXCHG64 | ||
unsigned long long cmpxchg_486_u64(volatile void *ptr, u64 old, u64 new) | ||
{ | ||
u64 prev; | ||
unsigned long flags; | ||
|
||
/* Poor man's cmpxchg8b for 386 and 486. Unsuitable for SMP */ | ||
local_irq_save(flags); | ||
prev = *(u64 *)ptr; | ||
if (prev == old) | ||
*(u64 *)ptr = new; | ||
local_irq_restore(flags); | ||
return prev; | ||
} | ||
EXPORT_SYMBOL(cmpxchg_486_u64); | ||
#endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters