xref: /haiku/src/system/kernel/arch/m68k/arch_cpu_asm.S (revision b30304acc8c37e678a1bf66976d15bdab103f931)
1/*
2** Copyright 2003, Axel D�fler, axeld@pinc-software.de. All rights reserved.
3** Distributed under the terms of the OpenBeOS License.
4*/
5
6#define FUNCTION(x) .global x; .type x,@function; x
7
8.text
9
10#if 0 /* PPC stuff ahead... */
11/* uint32 get_sdr1(void);
12 */
13FUNCTION(get_sdr1):
14	mfsdr1	%r3
15	blr
16
17/* void set_sdr1(uint32 value);
18 *				 r3
19 */
20FUNCTION(set_sdr1):
21	mtsdr1	%r3
22	blr
23
24/* uint32 get_sr(void *virtualAddress);
25 *				 r3
26 */
27FUNCTION(get_sr):
28	mfsrin	%r3, %r3
29	blr
30
31/* void set_sr(void *virtualAddress, uint32 value);
32 *			   r3					 r4
33 */
34FUNCTION(set_sr):
35	mtsrin	%r4, %r3
36	blr
37
38/* uint32 get_msr(void);
39 */
40FUNCTION(get_msr):
41	mfmsr	%r3
42	blr
43
44/* uint32 set_msr(uint32 value);
45 *				  r3
46 */
47FUNCTION(set_msr):
48	mtmsr	%r3
49	blr
50
51/* uint32 get_pvr(void);
52 */
53FUNCTION(get_pvr):
54	mfpvr	%r3
55	blr
56
57
58#define get_ibat(num) \
59	mfibatu	%r4, num; \
60	stw		%r4, 0(%r3); \
61	mfibatl	%r4, num; \
62	stw		%r4, 4(%r3); \
63
64#define set_ibat(num); \
65	lwz		%r4, 0(%r3); \
66	mtibatu num, %r4; \
67	lwz		%r4, 4(%r3); \
68	mtibatl	num, %r4;
69
70/* void get_ibat0-3(block_address_translation *bat);
71 *					r3
72 */
73FUNCTION(get_ibat0):
74	get_ibat(0)
75	blr
76FUNCTION(get_ibat1):
77	get_ibat(1)
78	blr
79FUNCTION(get_ibat2):
80	get_ibat(2)
81	blr
82FUNCTION(get_ibat3):
83	get_ibat(3)
84	blr
85
86/* void set_ibat0-3(block_address_translation *bat);
87 *					r3
88 */
89FUNCTION(set_ibat0):
90	set_ibat(0)
91	blr
92FUNCTION(set_ibat1):
93	set_ibat(1)
94	blr
95FUNCTION(set_ibat2):
96	set_ibat(2)
97	blr
98FUNCTION(set_ibat3):
99	set_ibat(3)
100	blr
101
102/* void reset_ibats(void)
103 */
104FUNCTION(reset_ibats):
105	li		%r3, 0
106	mtibatu	0, %r3
107	mtibatl 0, %r3
108	mtibatu	1, %r3
109	mtibatl 1, %r3
110	mtibatu	2, %r3
111	mtibatl 2, %r3
112	mtibatu	3, %r3
113	mtibatl 3, %r3
114	blr
115
116#define get_dbat(num) \
117	mfdbatu	%r4, num; \
118	stw		%r4, 0(%r3); \
119	mfdbatl	%r4, num; \
120	stw		%r4, 4(%r3);
121
122#define set_dbat(num) \
123	lwz		%r4, 0(%r3); \
124	mtdbatu num, %r4; \
125	lwz		%r4, 4(%r3); \
126	mtdbatl	num, %r4;
127
128/* void get_dbat0-3(block_address_translation *bat);
129 *					r3
130 */
131FUNCTION(get_dbat0):
132	get_dbat(0)
133	blr
134FUNCTION(get_dbat1):
135	get_dbat(1)
136	blr
137FUNCTION(get_dbat2):
138	get_dbat(2)
139	blr
140FUNCTION(get_dbat3):
141	get_dbat(3)
142	blr
143
144/* void set_dbat0-3(block_address_translation *bat);
145 *					r3
146 */
147FUNCTION(set_dbat0):
148	set_dbat(0)
149	blr
150FUNCTION(set_dbat1):
151	set_dbat(1)
152	blr
153FUNCTION(set_dbat2):
154	set_dbat(2)
155	blr
156FUNCTION(set_dbat3):
157	set_dbat(3)
158	blr
159
160/* void reset_dbats(void)
161 */
162FUNCTION(reset_dbats):
163	li		%r3, 0
164	mtdbatu	0, %r3
165	mtdbatl 0, %r3
166	mtdbatu	1, %r3
167	mtdbatl 1, %r3
168	mtdbatu	2, %r3
169	mtdbatl 2, %r3
170	mtdbatu	3, %r3
171	mtdbatl 3, %r3
172	blr
173
174/* void __eieio(void)
175 */
176FUNCTION(__eieio):
177	eieio
178	blr
179#endif
180