Linux 2.6.17.7
[linux/fpc-iii.git] / arch / ppc / xmon / privinst.h
blob93978c027ca05d94870f88b3e9522b5afb630dc8
1 /*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4 #include <linux/config.h>
6 #define GETREG(reg) \
7 static inline int get_ ## reg (void) \
8 { int ret; asm volatile ("mf" #reg " %0" : "=r" (ret) :); return ret; }
10 #define SETREG(reg) \
11 static inline void set_ ## reg (int val) \
12 { asm volatile ("mt" #reg " %0" : : "r" (val)); }
14 GETREG(msr)
15 SETREG(msr)
16 GETREG(cr)
18 #define GSETSPR(n, name) \
19 static inline int get_ ## name (void) \
20 { int ret; asm volatile ("mfspr %0," #n : "=r" (ret) : ); return ret; } \
21 static inline void set_ ## name (int val) \
22 { asm volatile ("mtspr " #n ",%0" : : "r" (val)); }
24 GSETSPR(0, mq)
25 GSETSPR(1, xer)
26 GSETSPR(4, rtcu)
27 GSETSPR(5, rtcl)
28 GSETSPR(8, lr)
29 GSETSPR(9, ctr)
30 GSETSPR(18, dsisr)
31 GSETSPR(19, dar)
32 GSETSPR(22, dec)
33 GSETSPR(25, sdr1)
34 GSETSPR(26, srr0)
35 GSETSPR(27, srr1)
36 GSETSPR(272, sprg0)
37 GSETSPR(273, sprg1)
38 GSETSPR(274, sprg2)
39 GSETSPR(275, sprg3)
40 GSETSPR(282, ear)
41 GSETSPR(287, pvr)
42 #ifndef CONFIG_8xx
43 GSETSPR(528, bat0u)
44 GSETSPR(529, bat0l)
45 GSETSPR(530, bat1u)
46 GSETSPR(531, bat1l)
47 GSETSPR(532, bat2u)
48 GSETSPR(533, bat2l)
49 GSETSPR(534, bat3u)
50 GSETSPR(535, bat3l)
51 GSETSPR(1008, hid0)
52 GSETSPR(1009, hid1)
53 GSETSPR(1010, iabr)
54 GSETSPR(1013, dabr)
55 GSETSPR(1023, pir)
56 #else
57 GSETSPR(144, cmpa)
58 GSETSPR(145, cmpb)
59 GSETSPR(146, cmpc)
60 GSETSPR(147, cmpd)
61 GSETSPR(158, ictrl)
62 #endif
64 static inline int get_sr(int n)
66 int ret;
68 asm (" mfsrin %0,%1" : "=r" (ret) : "r" (n << 28));
69 return ret;
72 static inline void set_sr(int n, int val)
74 asm ("mtsrin %0,%1" : : "r" (val), "r" (n << 28));
77 static inline void store_inst(void *p)
79 asm volatile ("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r" (p));
82 static inline void cflush(void *p)
84 asm volatile ("dcbf 0,%0; icbi 0,%0" : : "r" (p));
87 static inline void cinval(void *p)
89 asm volatile ("dcbi 0,%0; icbi 0,%0" : : "r" (p));