-
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.
Disintegrate asm/system.h for M68K. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Greg Ungerer <gerg@uclinux.org> cc: linux-m68k@lists.linux-m68k.org
- Loading branch information
David Howells
committed
Mar 28, 2012
1 parent
2501cf7
commit 803f691
Showing
46 changed files
with
214 additions
and
246 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
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
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
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 |
---|---|---|
|
@@ -21,7 +21,6 @@ | |
|
||
#include <asm/io.h> | ||
#include <asm/uaccess.h> | ||
#include <asm/system.h> | ||
#include <asm/setup.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
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,20 @@ | ||
#ifndef _M68K_BARRIER_H | ||
#define _M68K_BARRIER_H | ||
|
||
/* | ||
* Force strict CPU ordering. | ||
* Not really required on m68k... | ||
*/ | ||
#define nop() do { asm volatile ("nop"); barrier(); } while (0) | ||
#define mb() barrier() | ||
#define rmb() barrier() | ||
#define wmb() barrier() | ||
#define read_barrier_depends() ((void)0) | ||
#define set_mb(var, value) ({ (var) = (value); wmb(); }) | ||
|
||
#define smp_mb() barrier() | ||
#define smp_rmb() barrier() | ||
#define smp_wmb() barrier() | ||
#define smp_read_barrier_depends() ((void)0) | ||
|
||
#endif /* _M68K_BARRIER_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#ifndef __ARCH_M68K_CMPXCHG__ | ||
#define __ARCH_M68K_CMPXCHG__ | ||
|
||
#include <linux/irqflags.h> | ||
|
||
struct __xchg_dummy { unsigned long a[100]; }; | ||
#define __xg(x) ((volatile struct __xchg_dummy *)(x)) | ||
|
||
extern unsigned long __invalid_xchg_size(unsigned long, volatile void *, int); | ||
|
||
#ifndef CONFIG_RMW_INSNS | ||
static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | ||
{ | ||
unsigned long flags, tmp; | ||
|
||
local_irq_save(flags); | ||
|
||
switch (size) { | ||
case 1: | ||
tmp = *(u8 *)ptr; | ||
*(u8 *)ptr = x; | ||
x = tmp; | ||
break; | ||
case 2: | ||
tmp = *(u16 *)ptr; | ||
*(u16 *)ptr = x; | ||
x = tmp; | ||
break; | ||
case 4: | ||
tmp = *(u32 *)ptr; | ||
*(u32 *)ptr = x; | ||
x = tmp; | ||
break; | ||
default: | ||
tmp = __invalid_xchg_size(x, ptr, size); | ||
break; | ||
} | ||
|
||
local_irq_restore(flags); | ||
return x; | ||
} | ||
#else | ||
static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | ||
{ | ||
switch (size) { | ||
case 1: | ||
__asm__ __volatile__ | ||
("moveb %2,%0\n\t" | ||
"1:\n\t" | ||
"casb %0,%1,%2\n\t" | ||
"jne 1b" | ||
: "=&d" (x) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
break; | ||
case 2: | ||
__asm__ __volatile__ | ||
("movew %2,%0\n\t" | ||
"1:\n\t" | ||
"casw %0,%1,%2\n\t" | ||
"jne 1b" | ||
: "=&d" (x) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
break; | ||
case 4: | ||
__asm__ __volatile__ | ||
("movel %2,%0\n\t" | ||
"1:\n\t" | ||
"casl %0,%1,%2\n\t" | ||
"jne 1b" | ||
: "=&d" (x) : "d" (x), "m" (*__xg(ptr)) : "memory"); | ||
break; | ||
default: | ||
x = __invalid_xchg_size(x, ptr, size); | ||
break; | ||
} | ||
return x; | ||
} | ||
#endif | ||
|
||
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | ||
|
||
#include <asm-generic/cmpxchg-local.h> | ||
|
||
#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) | ||
|
||
extern unsigned long __invalid_cmpxchg_size(volatile void *, | ||
unsigned long, unsigned long, int); | ||
|
||
/* | ||
* Atomic compare and exchange. Compare OLD with MEM, if identical, | ||
* store NEW in MEM. Return the initial value in MEM. Success is | ||
* indicated by comparing RETURN with OLD. | ||
*/ | ||
#ifdef CONFIG_RMW_INSNS | ||
#define __HAVE_ARCH_CMPXCHG 1 | ||
|
||
static inline unsigned long __cmpxchg(volatile void *p, unsigned long old, | ||
unsigned long new, int size) | ||
{ | ||
switch (size) { | ||
case 1: | ||
__asm__ __volatile__ ("casb %0,%2,%1" | ||
: "=d" (old), "=m" (*(char *)p) | ||
: "d" (new), "0" (old), "m" (*(char *)p)); | ||
break; | ||
case 2: | ||
__asm__ __volatile__ ("casw %0,%2,%1" | ||
: "=d" (old), "=m" (*(short *)p) | ||
: "d" (new), "0" (old), "m" (*(short *)p)); | ||
break; | ||
case 4: | ||
__asm__ __volatile__ ("casl %0,%2,%1" | ||
: "=d" (old), "=m" (*(int *)p) | ||
: "d" (new), "0" (old), "m" (*(int *)p)); | ||
break; | ||
default: | ||
old = __invalid_cmpxchg_size(p, old, new, size); | ||
break; | ||
} | ||
return old; | ||
} | ||
|
||
#define cmpxchg(ptr, o, n) \ | ||
((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ | ||
(unsigned long)(n), sizeof(*(ptr)))) | ||
#define cmpxchg_local(ptr, o, n) \ | ||
((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ | ||
(unsigned long)(n), sizeof(*(ptr)))) | ||
#else | ||
|
||
/* | ||
* cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make | ||
* them available. | ||
*/ | ||
#define cmpxchg_local(ptr, o, n) \ | ||
((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | ||
(unsigned long)(n), sizeof(*(ptr)))) | ||
|
||
#include <asm-generic/cmpxchg.h> | ||
|
||
#endif | ||
|
||
#endif /* __ARCH_M68K_CMPXCHG__ */ |
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,6 @@ | ||
#ifndef _M68K_EXEC_H | ||
#define _M68K_EXEC_H | ||
|
||
#define arch_align_stack(x) (x) | ||
|
||
#endif /* _M68K_EXEC_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef _M68K_SWITCH_TO_H | ||
#define _M68K_SWITCH_TO_H | ||
|
||
/* | ||
* switch_to(n) should switch tasks to task ptr, first checking that | ||
* ptr isn't the current task, in which case it does nothing. This | ||
* also clears the TS-flag if the task we switched to has used the | ||
* math co-processor latest. | ||
*/ | ||
/* | ||
* switch_to() saves the extra registers, that are not saved | ||
* automatically by SAVE_SWITCH_STACK in resume(), ie. d0-d5 and | ||
* a0-a1. Some of these are used by schedule() and its predecessors | ||
* and so we might get see unexpected behaviors when a task returns | ||
* with unexpected register values. | ||
* | ||
* syscall stores these registers itself and none of them are used | ||
* by syscall after the function in the syscall has been called. | ||
* | ||
* Beware that resume now expects *next to be in d1 and the offset of | ||
* tss to be in a1. This saves a few instructions as we no longer have | ||
* to push them onto the stack and read them back right after. | ||
* | ||
* 02/17/96 - Jes Sorensen (jds@kom.auc.dk) | ||
* | ||
* Changed 96/09/19 by Andreas Schwab | ||
* pass prev in a0, next in a1 | ||
*/ | ||
asmlinkage void resume(void); | ||
#define switch_to(prev,next,last) do { \ | ||
register void *_prev __asm__ ("a0") = (prev); \ | ||
register void *_next __asm__ ("a1") = (next); \ | ||
register void *_last __asm__ ("d1"); \ | ||
__asm__ __volatile__("jbsr resume" \ | ||
: "=a" (_prev), "=a" (_next), "=d" (_last) \ | ||
: "0" (_prev), "1" (_next) \ | ||
: "d0", "d2", "d3", "d4", "d5"); \ | ||
(last) = _last; \ | ||
} while (0) | ||
|
||
#endif /* _M68K_SWITCH_TO_H */ |
Oops, something went wrong.