1
/******************************************************************************
2
* Copyright (c) 2004, 2008 IBM Corporation
4
* This program and the accompanying materials
5
* are made available under the terms of the BSD License
6
* which accompanies this distribution, and is available at
7
* http://www.opensource.org/licenses/bsd-license.php
10
* IBM Corporation - initial implementation
11
*****************************************************************************/
14
// This file contains the implementation of the Forth code words specific
15
// to PowerPC64. Some of this is 970-only.
17
// 970-specific CPU registers.
20
unsigned long hid0 = TOS.u;
21
asm volatile("sync ; mtspr 1008,%0 ; mfspr %0,1008 ; mfspr %0,1008 ; mfspr %0,1008 ; mfspr %0,1008 ; mfspr %0,1008 ; mfspr %0,1008" : "+r"(hid0));
27
asm volatile("mfspr %0,1008" : "=r"(TOS));
31
unsigned long hid1 = TOS.u;
32
asm volatile("mtspr 1009,%0 ; mtspr 1009,%0 ; isync" : : "r"(hid1));
38
asm volatile("mfspr %0,1009" : "=r"(TOS));
42
unsigned long hid4 = TOS.u;
43
asm volatile("sync ; mtspr 1012,%0 ; isync" : : "r"(hid4));
49
asm volatile("mfspr %0,1012" : "=r"(TOS));
53
unsigned long hid5 = TOS.u;
54
asm volatile("mtspr 1014,%0" : : "r"(hid5));
60
asm volatile("mfspr %0,1014" : "=r"(TOS));
63
// PowerPC special registers.
65
unsigned long msr = TOS.u;
66
asm volatile("mtmsrd %0" : : "r"(msr));
72
asm volatile("mfmsr %0" : "=r"(TOS));
76
unsigned long sdr1 = TOS.u;
77
asm volatile("mtsdr1 %0" : : "r"(sdr1));
83
asm volatile("mfsdr1 %0" : "=r"(TOS));
88
asm volatile("mfpvr %0" : "=r"(TOS));
93
asm volatile("mfspr %0,1023" : "=r"(TOS));
98
asm volatile("mftbl %0" : "=r"(TOS));
103
asm volatile("mftbu %0" : "=r"(TOS));
107
unsigned long dabr = TOS.u;
108
asm volatile("mtspr 1013,%0" : : "r"(dabr));
114
asm volatile("mfspr %0,1013" : "=r"(TOS));
118
unsigned long dabr = TOS.u;
119
asm volatile("mtspr 311,%0" : : "r"(dabr));
125
asm volatile("mfspr %0,311" : "=r"(TOS));
131
unsigned long sprg0 = TOS.u;
132
asm volatile("mtsprg0 %0" : "+r"(sprg0));
138
asm volatile("mfsprg0 %0" : "=r"(TOS));
142
unsigned long sprg1 = TOS.u;
143
asm volatile("mtsprg1 %0" : "+r"(sprg1));
149
asm volatile("mfsprg1 %0" : "=r"(TOS));
153
unsigned long sprg2 = TOS.u;
154
asm volatile("mtsprg2 %0" : "+r"(sprg2));
160
asm volatile("mfsprg2 %0" : "=r"(TOS));
164
unsigned long sprg3 = TOS.u;
165
asm volatile("mtsprg3 %0" : "+r"(sprg3));
171
asm volatile("mfsprg3 %0" : "=r"(TOS));
175
unsigned long hsprg0 = TOS.u;
176
asm volatile("mtspr 304,%0" : "+r"(hsprg0));
182
asm volatile("mfspr %0,304" : "=r"(TOS));
186
unsigned long hsprg1 = TOS.u;
187
asm volatile("mtspr 305,%0" : "+r"(hsprg1));
193
asm volatile("mfspr %0,305" : "=r"(TOS));
198
unsigned long mmcr0 = TOS.u;
199
asm volatile("sync ; mtspr 795,%0 ; isync" : : "r"(mmcr0));
205
asm volatile("sync ; mfspr %0,787" : "=r"(TOS));
209
asm volatile("dcbst 0,%0 ; sync ; icbi 0,%0 ; sync ; isync" : : "r"(TOS));
213
// Call into the client program.
214
PRIM(JUMP_X2d_CLIENT)
215
TOS.u = call_client(TOS);
219
// Hang. Useful for debugging, believe it or not.
228
TOS.u = call_c(p0, p1, (cell)0UL, e);
236
TOS.u = call_c(p0, p1, p2, e);
240
type_u n = TOS.u; POP;
241
unsigned char* p = TOS.a; POP;
246
unsigned long dec = TOS.u;
247
asm volatile("mtdec %0" : "+r"(dec));
253
asm volatile("mfdec %0" : "=r"(TOS));
256
PRIM(BM_X2d_ALLOCATOR_X2d_INIT)
257
unsigned long blocksize = TOS.u; POP;
258
unsigned long size = TOS.u; POP;
259
unsigned long start = TOS.u;
260
TOS.u = SLOF_bm_allocator_init(start, size, blocksize);
264
unsigned long size = TOS.u; POP;
265
unsigned long handle = TOS.u;
266
TOS.u = SLOF_bm_alloc(handle, size);
270
unsigned long size = TOS.u; POP;
271
unsigned long addr = TOS.u; POP;
272
unsigned long handle = TOS.u; POP;
273
SLOF_bm_free(handle, addr, size);
b'\\ No newline at end of file'