aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/xmon/privinst.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/xmon/privinst.h')
-rw-r--r--arch/ppc/xmon/privinst.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/arch/ppc/xmon/privinst.h b/arch/ppc/xmon/privinst.h
new file mode 100644
index 000000000000..93978c027ca0
--- /dev/null
+++ b/arch/ppc/xmon/privinst.h
@@ -0,0 +1,91 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4#include <linux/config.h>
5
6#define GETREG(reg) \
7 static inline int get_ ## reg (void) \
8 { int ret; asm volatile ("mf" #reg " %0" : "=r" (ret) :); return ret; }
9
10#define SETREG(reg) \
11 static inline void set_ ## reg (int val) \
12 { asm volatile ("mt" #reg " %0" : : "r" (val)); }
13
14GETREG(msr)
15SETREG(msr)
16GETREG(cr)
17
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)); }
23
24GSETSPR(0, mq)
25GSETSPR(1, xer)
26GSETSPR(4, rtcu)
27GSETSPR(5, rtcl)
28GSETSPR(8, lr)
29GSETSPR(9, ctr)
30GSETSPR(18, dsisr)
31GSETSPR(19, dar)
32GSETSPR(22, dec)
33GSETSPR(25, sdr1)
34GSETSPR(26, srr0)
35GSETSPR(27, srr1)
36GSETSPR(272, sprg0)
37GSETSPR(273, sprg1)
38GSETSPR(274, sprg2)
39GSETSPR(275, sprg3)
40GSETSPR(282, ear)
41GSETSPR(287, pvr)
42#ifndef CONFIG_8xx
43GSETSPR(528, bat0u)
44GSETSPR(529, bat0l)
45GSETSPR(530, bat1u)
46GSETSPR(531, bat1l)
47GSETSPR(532, bat2u)
48GSETSPR(533, bat2l)
49GSETSPR(534, bat3u)
50GSETSPR(535, bat3l)
51GSETSPR(1008, hid0)
52GSETSPR(1009, hid1)
53GSETSPR(1010, iabr)
54GSETSPR(1013, dabr)
55GSETSPR(1023, pir)
56#else
57GSETSPR(144, cmpa)
58GSETSPR(145, cmpb)
59GSETSPR(146, cmpc)
60GSETSPR(147, cmpd)
61GSETSPR(158, ictrl)
62#endif
63
64static inline int get_sr(int n)
65{
66 int ret;
67
68 asm (" mfsrin %0,%1" : "=r" (ret) : "r" (n << 28));
69 return ret;
70}
71
72static inline void set_sr(int n, int val)
73{
74 asm ("mtsrin %0,%1" : : "r" (val), "r" (n << 28));
75}
76
77static inline void store_inst(void *p)
78{
79 asm volatile ("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r" (p));
80}
81
82static inline void cflush(void *p)
83{
84 asm volatile ("dcbf 0,%0; icbi 0,%0" : : "r" (p));
85}
86
87static inline void cinval(void *p)
88{
89 asm volatile ("dcbi 0,%0; icbi 0,%0" : : "r" (p));
90}
91