aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/page.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2006-09-28 10:56:43 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2006-09-28 10:56:43 -0400
commit94c12cc7d196bab34aaa98d38521549fa1e5ef76 (patch)
tree8e0cec0ed44445d74a2cb5160303d6b4dfb1bc31 /include/asm-s390/page.h
parent25d83cbfaa44e1b9170c0941c3ef52ca39f54ccc (diff)
[S390] Inline assembly cleanup.
Major cleanup of all s390 inline assemblies. They now have a common coding style. Quite a few have been shortened, mainly by using register asm variables. Use of the EX_TABLE macro helps as well. The atomic ops, bit ops and locking inlines new use the Q-constraint if a newer gcc is used. That results in slightly better code. Thanks to Christian Borntraeger for proof reading the changes. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include/asm-s390/page.h')
-rw-r--r--include/asm-s390/page.h111
1 files changed, 33 insertions, 78 deletions
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index b2628dc5c490..796c400f2b79 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -22,89 +22,45 @@
22#include <asm/setup.h> 22#include <asm/setup.h>
23#ifndef __ASSEMBLY__ 23#ifndef __ASSEMBLY__
24 24
25#ifndef __s390x__
26
27static inline void clear_page(void *page)
28{
29 register_pair rp;
30
31 rp.subreg.even = (unsigned long) page;
32 rp.subreg.odd = (unsigned long) 4096;
33 asm volatile (" slr 1,1\n"
34 " mvcl %0,0"
35 : "+&a" (rp) : : "memory", "cc", "1" );
36}
37
38static inline void copy_page(void *to, void *from)
39{
40 if (MACHINE_HAS_MVPG)
41 asm volatile (" sr 0,0\n"
42 " mvpg %0,%1"
43 : : "a" ((void *)(to)), "a" ((void *)(from))
44 : "memory", "cc", "0" );
45 else
46 asm volatile (" mvc 0(256,%0),0(%1)\n"
47 " mvc 256(256,%0),256(%1)\n"
48 " mvc 512(256,%0),512(%1)\n"
49 " mvc 768(256,%0),768(%1)\n"
50 " mvc 1024(256,%0),1024(%1)\n"
51 " mvc 1280(256,%0),1280(%1)\n"
52 " mvc 1536(256,%0),1536(%1)\n"
53 " mvc 1792(256,%0),1792(%1)\n"
54 " mvc 2048(256,%0),2048(%1)\n"
55 " mvc 2304(256,%0),2304(%1)\n"
56 " mvc 2560(256,%0),2560(%1)\n"
57 " mvc 2816(256,%0),2816(%1)\n"
58 " mvc 3072(256,%0),3072(%1)\n"
59 " mvc 3328(256,%0),3328(%1)\n"
60 " mvc 3584(256,%0),3584(%1)\n"
61 " mvc 3840(256,%0),3840(%1)\n"
62 : : "a"((void *)(to)),"a"((void *)(from))
63 : "memory" );
64}
65
66#else /* __s390x__ */
67
68static inline void clear_page(void *page) 25static inline void clear_page(void *page)
69{ 26{
70 asm volatile (" lgr 2,%0\n" 27 register unsigned long reg1 asm ("1") = 0;
71 " lghi 3,4096\n" 28 register void *reg2 asm ("2") = page;
72 " slgr 1,1\n" 29 register unsigned long reg3 asm ("3") = 4096;
73 " mvcl 2,0" 30 asm volatile(
74 : : "a" ((void *) (page)) 31 " mvcl 2,0"
75 : "memory", "cc", "1", "2", "3" ); 32 : "+d" (reg2), "+d" (reg3) : "d" (reg1) : "memory", "cc");
76} 33}
77 34
78static inline void copy_page(void *to, void *from) 35static inline void copy_page(void *to, void *from)
79{ 36{
80 if (MACHINE_HAS_MVPG) 37 if (MACHINE_HAS_MVPG) {
81 asm volatile (" sgr 0,0\n" 38 register unsigned long reg0 asm ("0") = 0;
82 " mvpg %0,%1" 39 asm volatile(
83 : : "a" ((void *)(to)), "a" ((void *)(from)) 40 " mvpg %0,%1"
84 : "memory", "cc", "0" ); 41 : : "a" (to), "a" (from), "d" (reg0)
85 else 42 : "memory", "cc");
86 asm volatile (" mvc 0(256,%0),0(%1)\n" 43 } else
87 " mvc 256(256,%0),256(%1)\n" 44 asm volatile(
88 " mvc 512(256,%0),512(%1)\n" 45 " mvc 0(256,%0),0(%1)\n"
89 " mvc 768(256,%0),768(%1)\n" 46 " mvc 256(256,%0),256(%1)\n"
90 " mvc 1024(256,%0),1024(%1)\n" 47 " mvc 512(256,%0),512(%1)\n"
91 " mvc 1280(256,%0),1280(%1)\n" 48 " mvc 768(256,%0),768(%1)\n"
92 " mvc 1536(256,%0),1536(%1)\n" 49 " mvc 1024(256,%0),1024(%1)\n"
93 " mvc 1792(256,%0),1792(%1)\n" 50 " mvc 1280(256,%0),1280(%1)\n"
94 " mvc 2048(256,%0),2048(%1)\n" 51 " mvc 1536(256,%0),1536(%1)\n"
95 " mvc 2304(256,%0),2304(%1)\n" 52 " mvc 1792(256,%0),1792(%1)\n"
96 " mvc 2560(256,%0),2560(%1)\n" 53 " mvc 2048(256,%0),2048(%1)\n"
97 " mvc 2816(256,%0),2816(%1)\n" 54 " mvc 2304(256,%0),2304(%1)\n"
98 " mvc 3072(256,%0),3072(%1)\n" 55 " mvc 2560(256,%0),2560(%1)\n"
99 " mvc 3328(256,%0),3328(%1)\n" 56 " mvc 2816(256,%0),2816(%1)\n"
100 " mvc 3584(256,%0),3584(%1)\n" 57 " mvc 3072(256,%0),3072(%1)\n"
101 " mvc 3840(256,%0),3840(%1)\n" 58 " mvc 3328(256,%0),3328(%1)\n"
102 : : "a"((void *)(to)),"a"((void *)(from)) 59 " mvc 3584(256,%0),3584(%1)\n"
103 : "memory" ); 60 " mvc 3840(256,%0),3840(%1)\n"
61 : : "a" (to), "a" (from) : "memory");
104} 62}
105 63
106#endif /* __s390x__ */
107
108#define clear_user_page(page, vaddr, pg) clear_page(page) 64#define clear_user_page(page, vaddr, pg) clear_page(page)
109#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 65#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
110 66
@@ -159,7 +115,7 @@ extern unsigned int default_storage_key;
159static inline void 115static inline void
160page_set_storage_key(unsigned long addr, unsigned int skey) 116page_set_storage_key(unsigned long addr, unsigned int skey)
161{ 117{
162 asm volatile ( "sske %0,%1" : : "d" (skey), "a" (addr) ); 118 asm volatile("sske %0,%1" : : "d" (skey), "a" (addr));
163} 119}
164 120
165static inline unsigned int 121static inline unsigned int
@@ -167,8 +123,7 @@ page_get_storage_key(unsigned long addr)
167{ 123{
168 unsigned int skey; 124 unsigned int skey;
169 125
170 asm volatile ( "iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0) ); 126 asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr), "0" (0));
171
172 return skey; 127 return skey;
173} 128}
174 129