-
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.
tile: fix multiple build failures from system.h dismantle
Commit bd119c6 "Disintegrate asm/system.h for Tile" created the asm/switch_to.h file, but did not add an include of it to all its users. Also, commit b4816af "Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h" introduced the concept of asm/cmpxchg.h but the tile arch never got one. Fork the cmpxchg content out of the asm/atomic.h file to create one. Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
- Loading branch information
Paul Gortmaker
authored and
Chris Metcalf
committed
Apr 2, 2012
1 parent
dd775ae
commit 34f2c0a
Showing
4 changed files
with
77 additions
and
48 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
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,73 @@ | ||
/* | ||
* cmpxchg.h -- forked from asm/atomic.h with this copyright: | ||
* | ||
* Copyright 2010 Tilera Corporation. All Rights Reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation, version 2. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
* NON INFRINGEMENT. See the GNU General Public License for | ||
* more details. | ||
* | ||
*/ | ||
|
||
#ifndef _ASM_TILE_CMPXCHG_H | ||
#define _ASM_TILE_CMPXCHG_H | ||
|
||
#ifndef __ASSEMBLY__ | ||
|
||
/* Nonexistent functions intended to cause link errors. */ | ||
extern unsigned long __xchg_called_with_bad_pointer(void); | ||
extern unsigned long __cmpxchg_called_with_bad_pointer(void); | ||
|
||
#define xchg(ptr, x) \ | ||
({ \ | ||
typeof(*(ptr)) __x; \ | ||
switch (sizeof(*(ptr))) { \ | ||
case 4: \ | ||
__x = (typeof(__x))(typeof(__x-__x))atomic_xchg( \ | ||
(atomic_t *)(ptr), \ | ||
(u32)(typeof((x)-(x)))(x)); \ | ||
break; \ | ||
case 8: \ | ||
__x = (typeof(__x))(typeof(__x-__x))atomic64_xchg( \ | ||
(atomic64_t *)(ptr), \ | ||
(u64)(typeof((x)-(x)))(x)); \ | ||
break; \ | ||
default: \ | ||
__xchg_called_with_bad_pointer(); \ | ||
} \ | ||
__x; \ | ||
}) | ||
|
||
#define cmpxchg(ptr, o, n) \ | ||
({ \ | ||
typeof(*(ptr)) __x; \ | ||
switch (sizeof(*(ptr))) { \ | ||
case 4: \ | ||
__x = (typeof(__x))(typeof(__x-__x))atomic_cmpxchg( \ | ||
(atomic_t *)(ptr), \ | ||
(u32)(typeof((o)-(o)))(o), \ | ||
(u32)(typeof((n)-(n)))(n)); \ | ||
break; \ | ||
case 8: \ | ||
__x = (typeof(__x))(typeof(__x-__x))atomic64_cmpxchg( \ | ||
(atomic64_t *)(ptr), \ | ||
(u64)(typeof((o)-(o)))(o), \ | ||
(u64)(typeof((n)-(n)))(n)); \ | ||
break; \ | ||
default: \ | ||
__cmpxchg_called_with_bad_pointer(); \ | ||
} \ | ||
__x; \ | ||
}) | ||
|
||
#define tas(ptr) (xchg((ptr), 1)) | ||
|
||
#endif /* __ASSEMBLY__ */ | ||
|
||
#endif /* _ASM_TILE_CMPXCHG_H */ |
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