Last change
on this file since 400 was 337, checked in by coas-nagasima, 6 years ago |
ASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-chdr;charset=UTF-8
|
File size:
1.0 KB
|
Line | |
---|
1 | #if defined(__SH4A__)
|
---|
2 |
|
---|
3 | #define a_ll a_ll
|
---|
4 | static inline int a_ll(volatile int *p)
|
---|
5 | {
|
---|
6 | int v;
|
---|
7 | __asm__ __volatile__ ("movli.l @%1, %0" : "=z"(v) : "r"(p), "m"(*p));
|
---|
8 | return v;
|
---|
9 | }
|
---|
10 |
|
---|
11 | #define a_sc a_sc
|
---|
12 | static inline int a_sc(volatile int *p, int v)
|
---|
13 | {
|
---|
14 | int r;
|
---|
15 | __asm__ __volatile__ (
|
---|
16 | "movco.l %2, @%3 ; movt %0"
|
---|
17 | : "=r"(r), "=m"(*p) : "z"(v), "r"(p) : "memory", "cc");
|
---|
18 | return r;
|
---|
19 | }
|
---|
20 |
|
---|
21 | #define a_barrier a_barrier
|
---|
22 | static inline void a_barrier()
|
---|
23 | {
|
---|
24 | __asm__ __volatile__ ("synco" ::: "memory");
|
---|
25 | }
|
---|
26 |
|
---|
27 | #define a_pre_llsc a_barrier
|
---|
28 | #define a_post_llsc a_barrier
|
---|
29 |
|
---|
30 | #else
|
---|
31 |
|
---|
32 | #define a_cas a_cas
|
---|
33 | static inline int a_cas(volatile int *p, int t, int s)
|
---|
34 | {
|
---|
35 | #ifndef __c2__
|
---|
36 | __asm__ __volatile__ ("clrpsw i");
|
---|
37 | if (*p == t)
|
---|
38 | *p = s;
|
---|
39 | else
|
---|
40 | s = *p;
|
---|
41 | __asm__ __volatile__ ("setpsw i");
|
---|
42 | return s;
|
---|
43 | #else
|
---|
44 | extern int __attribute__((stdcall)) InterlockedCompareExchange(
|
---|
45 | volatile int *Destination, int Exchange, int Comperand);
|
---|
46 | /*__asm__ __volatile__(
|
---|
47 | "lock ; cmpxchg %3, %1"
|
---|
48 | : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory");
|
---|
49 | return t;*/
|
---|
50 | return InterlockedCompareExchange(p,t,s);
|
---|
51 | #endif
|
---|
52 | }
|
---|
53 |
|
---|
54 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.