This source file includes following definitions.
- xchg_u32
- xchg_u64
- xchg_ptr
1 #ifndef __ALPHA_SYSTEM_H
2 #define __ALPHA_SYSTEM_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #define BOOT_PCB 0x20000000
17 #define BOOT_ADDR 0x20000000
18 #define BOOT_SIZE (16*1024)
19
20 #define KERNEL_START 0xfffffc0000300000
21 #define SWAPPER_PGD 0xfffffc0000300000
22 #define INIT_STACK 0xfffffc0000302000
23 #define EMPTY_PGT 0xfffffc0000304000
24 #define EMPTY_PGE 0xfffffc0000308000
25 #define ZERO_PGE 0xfffffc000030A000
26
27 #define START_ADDR 0xfffffc0000310000
28 #define START_SIZE (1024*1024)
29
30
31
32
33 #define PAL_halt 0
34 #define PAL_cflush 1
35 #define PAL_draina 2
36 #define PAL_cobratt 9
37 #define PAL_bpt 128
38 #define PAL_bugchk 129
39 #define PAL_chmk 131
40 #define PAL_callsys 131
41 #define PAL_imb 134
42 #define PAL_rduniq 158
43 #define PAL_wruniq 159
44 #define PAL_gentrap 170
45 #define PAL_nphalt 190
46
47
48
49
50 #define PAL_swppal 10
51 #define PAL_mfpr_vptb 41
52
53
54
55
56 #define PAL_mtpr_mces 17
57 #define PAL_wrfen 43
58 #define PAL_wrvptptr 45
59 #define PAL_jtopal 46
60 #define PAL_swpctx 48
61 #define PAL_wrval 49
62 #define PAL_rdval 50
63 #define PAL_tbi 51
64 #define PAL_wrent 52
65 #define PAL_swpipl 53
66 #define PAL_rdps 54
67 #define PAL_wrkgp 55
68 #define PAL_wrusp 56
69 #define PAL_wrperfmon 57
70 #define PAL_rdusp 58
71 #define PAL_whami 60
72 #define PAL_rtsys 61
73 #define PAL_rti 63
74
75 #ifndef __ASSEMBLY__
76
77 extern void wrent(void *, unsigned long);
78 extern void wrkgp(unsigned long);
79 extern void wrusp(unsigned long);
80 extern unsigned long rdusp(void);
81
82 #define halt() __asm__ __volatile__(".long 0");
83
84 #define switch_to(x) panic("switch_to() not yet done")
85
86 #ifndef mb
87 #define mb() __asm__ __volatile__("mb": : :"memory")
88 #endif
89
90 #define swpipl(__new_ipl) \
91 ({ unsigned long __old_ipl; \
92 __asm__ __volatile__( \
93 "bis %1,%1,$16\n\t" \
94 ".long 53\n\t" \
95 "bis $0,$0,%0" \
96 : "=r" (__old_ipl) \
97 : "r" (__new_ipl) \
98 : "$0", "$1", "$16", "$22", "$23", "$24", "$25"); \
99 __old_ipl; })
100
101 #define cli() swpipl(7)
102 #define sti() swpipl(0)
103 #define save_flags(flags) do { flags = swpipl(7); } while (0)
104 #define restore_flags(flags) swpipl(flags)
105
106 extern inline unsigned long xchg_u32(int * m, unsigned long val)
107 {
108 unsigned long dummy, dummy2;
109
110 __asm__ __volatile__(
111 "\n1:\t"
112 "ldl_l %0,%1\n\t"
113 "bis %2,%2,%3\n\t"
114 "stl_c %3,%1\n\t"
115 "beq %3,1b\n"
116 : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
117 : "1" (*m), "2" (val));
118 return val;
119 }
120
121 extern inline unsigned long xchg_u64(long * m, unsigned long val)
122 {
123 unsigned long dummy, dummy2;
124
125 __asm__ __volatile__(
126 "\n1:\t"
127 "ldq_l %0,%1\n\t"
128 "bis %2,%2,%3\n\t"
129 "stq_c %3,%1\n\t"
130 "beq %3,1b\n"
131 : "=r" (val), "=m" (*m), "=r" (dummy), "=r" (dummy2)
132 : "1" (*m), "2" (val));
133 return val;
134 }
135
136 extern inline void * xchg_ptr(void *m, void *val)
137 {
138 return (void *) xchg_u64((long *) m, (unsigned long) val);
139 }
140
141 #endif
142
143 #endif