1 |
|
/* |
2 |
|
* name_registry.cpp - Name Registry handling |
3 |
|
* |
4 |
< |
* SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig |
4 |
> |
* SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
35 |
|
// Function pointers |
36 |
|
typedef int16 (*rcec_ptr)(const RegEntryID *, const char *, RegEntryID *); |
37 |
|
static uint32 rcec_tvect = 0; |
38 |
< |
static inline int16 RegistryCStrEntryCreate(const RegEntryID *arg1, const char *arg2, RegEntryID *arg3) |
38 |
> |
static inline int16 RegistryCStrEntryCreate(uintptr arg1, const char *arg2, uint32 arg3) |
39 |
|
{ |
40 |
< |
return (int16)CallMacOS3(rcec_ptr, rcec_tvect, arg1, arg2, arg3); |
40 |
> |
SheepString arg2str(arg2); |
41 |
> |
return (int16)CallMacOS3(rcec_ptr, rcec_tvect, (const RegEntryID *)arg1, arg2str.addr(), arg3); |
42 |
|
} |
43 |
|
typedef int16 (*rpc_ptr)(const RegEntryID *, const char *, const void *, uint32); |
44 |
|
static uint32 rpc_tvect = 0; |
45 |
< |
static inline int16 RegistryPropertyCreate(const RegEntryID *arg1, const char *arg2, const void *arg3, uint32 arg4) |
45 |
> |
static inline int16 RegistryPropertyCreate(uintptr arg1, const char *arg2, uintptr arg3, uint32 arg4) |
46 |
|
{ |
47 |
< |
return (int16)CallMacOS4(rpc_ptr, rpc_tvect, arg1, arg2, arg3, arg4); |
47 |
> |
SheepString arg2str(arg2); |
48 |
> |
return (int16)CallMacOS4(rpc_ptr, rpc_tvect, (const RegEntryID *)arg1, arg2str.addr(), (const void *)arg3, arg4); |
49 |
> |
} |
50 |
> |
static inline int16 RegistryPropertyCreateStr(uintptr arg1, const char *arg2, const char *arg3) |
51 |
> |
{ |
52 |
> |
SheepString arg3str(arg3); |
53 |
> |
return RegistryPropertyCreate(arg1, arg2, arg3str.addr(), strlen(arg3) + 1); |
54 |
|
} |
48 |
– |
#define RegistryPropertyCreateStr(e,n,s) RegistryPropertyCreate(e,n,s,strlen(s)+1) |
55 |
|
|
56 |
|
// Video driver stub |
57 |
|
static const uint8 video_driver[] = { |
64 |
|
}; |
65 |
|
|
66 |
|
// Helper for RegEntryID |
67 |
< |
struct SheepRegEntryID : public SheepArray<sizeof(RegEntryID)> { |
62 |
< |
RegEntryID *ptr() const { return (RegEntryID *)addr(); } |
63 |
< |
}; |
67 |
> |
typedef SheepArray<sizeof(RegEntryID)> SheepRegEntryID; |
68 |
|
|
69 |
|
// Helper for a <uint32, uint32> pair |
70 |
|
struct SheepPair : public SheepArray<8> { |
71 |
|
SheepPair(uint32 base, uint32 size) : SheepArray<8>() |
72 |
|
{ WriteMacInt32(addr(), base); WriteMacInt32(addr() + 4, size); } |
69 |
– |
uint32 *ptr() const |
70 |
– |
{ return (uint32 *)addr(); } |
73 |
|
}; |
74 |
|
|
75 |
|
|
84 |
|
|
85 |
|
// Create "device-tree" |
86 |
|
SheepRegEntryID device_tree; |
87 |
< |
if (!RegistryCStrEntryCreate(NULL, "Devices:device-tree", device_tree.ptr())) { |
87 |
> |
if (!RegistryCStrEntryCreate(0, "Devices:device-tree", device_tree.addr())) { |
88 |
|
u32.set_value(BusClockSpeed); |
89 |
< |
RegistryPropertyCreate(device_tree.ptr(), "clock-frequency", u32.ptr(), 4); |
90 |
< |
RegistryPropertyCreateStr(device_tree.ptr(), "model", "Power Macintosh"); |
89 |
> |
RegistryPropertyCreate(device_tree.addr(), "clock-frequency", u32.addr(), 4); |
90 |
> |
RegistryPropertyCreateStr(device_tree.addr(), "model", "Power Macintosh"); |
91 |
|
|
92 |
|
// Create "AAPL,ROM" |
93 |
|
SheepRegEntryID aapl_rom; |
94 |
< |
if (!RegistryCStrEntryCreate(device_tree.ptr(), "AAPL,ROM", aapl_rom.ptr())) { |
95 |
< |
RegistryPropertyCreateStr(aapl_rom.ptr(), "device_type", "rom"); |
94 |
> |
if (!RegistryCStrEntryCreate(device_tree.addr(), "AAPL,ROM", aapl_rom.addr())) { |
95 |
> |
RegistryPropertyCreateStr(aapl_rom.addr(), "device_type", "rom"); |
96 |
|
SheepPair reg(ROM_BASE, ROM_SIZE); |
97 |
< |
RegistryPropertyCreate(aapl_rom.ptr(), "reg", reg.ptr(), 8); |
97 |
> |
RegistryPropertyCreate(aapl_rom.addr(), "reg", reg.addr(), 8); |
98 |
|
} |
99 |
|
|
100 |
|
// Create "PowerPC,60x" |
131 |
|
case 80: // 860 |
132 |
|
str = "PowerPC,860"; |
133 |
|
break; |
134 |
+ |
case 12: // 7400, 7410, 7450, 7455, 7457 |
135 |
+ |
case 0x800c: |
136 |
+ |
case 0x8000: |
137 |
+ |
case 0x8001: |
138 |
+ |
case 0x8002: |
139 |
+ |
str = "PowerPC,G4"; |
140 |
+ |
break; |
141 |
|
default: |
142 |
|
str = "PowerPC,???"; |
143 |
|
break; |
144 |
|
} |
145 |
< |
if (!RegistryCStrEntryCreate(device_tree.ptr(), str, power_pc.ptr())) { |
145 |
> |
if (!RegistryCStrEntryCreate(device_tree.addr(), str, power_pc.addr())) { |
146 |
|
u32.set_value(CPUClockSpeed); |
147 |
< |
RegistryPropertyCreate(power_pc.ptr(), "clock-frequency", u32.ptr(), 4); |
147 |
> |
RegistryPropertyCreate(power_pc.addr(), "clock-frequency", u32.addr(), 4); |
148 |
|
u32.set_value(BusClockSpeed); |
149 |
< |
RegistryPropertyCreate(power_pc.ptr(), "bus-frequency", u32.ptr(), 4); |
149 |
> |
RegistryPropertyCreate(power_pc.addr(), "bus-frequency", u32.addr(), 4); |
150 |
|
u32.set_value(TimebaseSpeed); |
151 |
< |
RegistryPropertyCreate(power_pc.ptr(), "timebase-frequency", u32.ptr(), 4); |
151 |
> |
RegistryPropertyCreate(power_pc.addr(), "timebase-frequency", u32.addr(), 4); |
152 |
|
u32.set_value(PVR); |
153 |
< |
RegistryPropertyCreate(power_pc.ptr(), "cpu-version", u32.ptr(), 4); |
154 |
< |
RegistryPropertyCreateStr(power_pc.ptr(), "device_type", "cpu"); |
153 |
> |
RegistryPropertyCreate(power_pc.addr(), "cpu-version", u32.addr(), 4); |
154 |
> |
RegistryPropertyCreateStr(power_pc.addr(), "device_type", "cpu"); |
155 |
|
switch (PVR >> 16) { |
156 |
|
case 1: // 601 |
157 |
|
u32.set_value(64); |
158 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
158 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
159 |
|
u32.set_value(128); |
160 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
160 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
161 |
|
u32.set_value(0x8000); |
162 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
162 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
163 |
|
u32.set_value(64); |
164 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
164 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
165 |
|
u32.set_value(128); |
166 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
166 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
167 |
|
u32.set_value(0x8000); |
168 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
168 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
169 |
|
u32.set_value(128); |
170 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
170 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
171 |
|
u32.set_value(256); |
172 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
172 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
173 |
|
break; |
174 |
|
case 3: // 603 |
175 |
|
u32.set_value(32); |
176 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
176 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
177 |
|
u32.set_value(64); |
178 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
178 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
179 |
|
u32.set_value(0x2000); |
180 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
180 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
181 |
|
u32.set_value(32); |
182 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
182 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
183 |
|
u32.set_value(64); |
184 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
184 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
185 |
|
u32.set_value(0x2000); |
186 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
186 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
187 |
|
u32.set_value(32); |
188 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
188 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
189 |
|
u32.set_value(64); |
190 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
190 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
191 |
|
break; |
192 |
|
case 4: // 604 |
193 |
|
u32.set_value(32); |
194 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
194 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
195 |
|
u32.set_value(128); |
196 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
196 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
197 |
|
u32.set_value(0x4000); |
198 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
198 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
199 |
|
u32.set_value(32); |
200 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
200 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
201 |
|
u32.set_value(128); |
202 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
202 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
203 |
|
u32.set_value(0x4000); |
204 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
204 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
205 |
|
u32.set_value(64); |
206 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
206 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
207 |
|
u32.set_value(128); |
208 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
208 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
209 |
|
break; |
210 |
|
case 6: // 603e |
211 |
|
case 7: // 603ev |
212 |
|
u32.set_value(32); |
213 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
213 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
214 |
|
u32.set_value(128); |
215 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
215 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
216 |
|
u32.set_value(0x4000); |
217 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
217 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
218 |
|
u32.set_value(32); |
219 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
219 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
220 |
|
u32.set_value(128); |
221 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
221 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
222 |
|
u32.set_value(0x4000); |
223 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
223 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
224 |
|
u32.set_value(32); |
225 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
225 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
226 |
|
u32.set_value(64); |
227 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
227 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
228 |
|
break; |
229 |
|
case 8: // 750, 750FX |
230 |
|
case 0x7000: |
231 |
|
u32.set_value(32); |
232 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
232 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
233 |
|
u32.set_value(256); |
234 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
234 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
235 |
|
u32.set_value(0x8000); |
236 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
236 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
237 |
|
u32.set_value(32); |
238 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
238 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
239 |
|
u32.set_value(256); |
240 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
240 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
241 |
|
u32.set_value(0x8000); |
242 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
242 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
243 |
|
u32.set_value(64); |
244 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
244 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
245 |
|
u32.set_value(128); |
246 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
246 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
247 |
|
break; |
248 |
|
case 9: // 604e |
249 |
|
case 10: // 604ev5 |
250 |
|
u32.set_value(32); |
251 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
251 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
252 |
|
u32.set_value(256); |
253 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
253 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
254 |
|
u32.set_value(0x8000); |
255 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
255 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
256 |
|
u32.set_value(32); |
257 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
257 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
258 |
|
u32.set_value(256); |
259 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
259 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
260 |
|
u32.set_value(0x8000); |
261 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
261 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
262 |
|
u32.set_value(64); |
263 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
263 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
264 |
|
u32.set_value(128); |
265 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
265 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
266 |
|
break; |
267 |
|
case 12: // 7400, 7410, 7450, 7455, 7457 |
268 |
|
case 0x800c: |
270 |
|
case 0x8001: |
271 |
|
case 0x8002: |
272 |
|
u32.set_value(32); |
273 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
273 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
274 |
|
u32.set_value(128); |
275 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
275 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
276 |
|
u32.set_value(0x8000); |
277 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
277 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
278 |
|
u32.set_value(32); |
279 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
279 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
280 |
|
u32.set_value(128); |
281 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
281 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
282 |
|
u32.set_value(0x8000); |
283 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
283 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
284 |
|
u32.set_value(64); |
285 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
285 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
286 |
|
u32.set_value(128); |
287 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
287 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
288 |
|
break; |
289 |
|
case 0x39: // 970 |
290 |
|
u32.set_value(128); |
291 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-block-size", u32.ptr(), 4); |
291 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-block-size", u32.addr(), 4); |
292 |
|
u32.set_value(128); |
293 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-sets", u32.ptr(), 4); |
293 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-sets", u32.addr(), 4); |
294 |
|
u32.set_value(0x8000); |
295 |
< |
RegistryPropertyCreate(power_pc.ptr(), "d-cache-size", u32.ptr(), 4); |
295 |
> |
RegistryPropertyCreate(power_pc.addr(), "d-cache-size", u32.addr(), 4); |
296 |
|
u32.set_value(128); |
297 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-block-size", u32.ptr(), 4); |
297 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-block-size", u32.addr(), 4); |
298 |
|
u32.set_value(512); |
299 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-sets", u32.ptr(), 4); |
299 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-sets", u32.addr(), 4); |
300 |
|
u32.set_value(0x10000); |
301 |
< |
RegistryPropertyCreate(power_pc.ptr(), "i-cache-size", u32.ptr(), 4); |
301 |
> |
RegistryPropertyCreate(power_pc.addr(), "i-cache-size", u32.addr(), 4); |
302 |
|
u32.set_value(256); |
303 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-sets", u32.ptr(), 4); |
303 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-sets", u32.addr(), 4); |
304 |
|
u32.set_value(0x1000); |
305 |
< |
RegistryPropertyCreate(power_pc.ptr(), "tlb-size", u32.ptr(), 4); |
305 |
> |
RegistryPropertyCreate(power_pc.addr(), "tlb-size", u32.addr(), 4); |
306 |
|
break; |
307 |
|
default: |
308 |
|
break; |
309 |
|
} |
310 |
|
u32.set_value(32); |
311 |
< |
RegistryPropertyCreate(power_pc.ptr(), "reservation-granularity", u32.ptr(), 4); |
311 |
> |
RegistryPropertyCreate(power_pc.addr(), "reservation-granularity", u32.addr(), 4); |
312 |
|
SheepPair reg(0, 0); |
313 |
< |
RegistryPropertyCreate(power_pc.ptr(), "reg", reg.ptr(), 8); |
313 |
> |
RegistryPropertyCreate(power_pc.addr(), "reg", reg.addr(), 8); |
314 |
|
} |
315 |
|
|
316 |
|
// Create "memory" |
317 |
|
SheepRegEntryID memory; |
318 |
< |
if (!RegistryCStrEntryCreate(device_tree.ptr(), "memory", memory.ptr())) { |
318 |
> |
if (!RegistryCStrEntryCreate(device_tree.addr(), "memory", memory.addr())) { |
319 |
|
SheepPair reg(RAMBase, RAMSize); |
320 |
< |
RegistryPropertyCreateStr(memory.ptr(), "device_type", "memory"); |
321 |
< |
RegistryPropertyCreate(memory.ptr(), "reg", reg.ptr(), 8); |
320 |
> |
RegistryPropertyCreateStr(memory.addr(), "device_type", "memory"); |
321 |
> |
RegistryPropertyCreate(memory.addr(), "reg", reg.addr(), 8); |
322 |
|
} |
323 |
|
|
324 |
|
// Create "video" |
325 |
|
SheepRegEntryID video; |
326 |
< |
if (!RegistryCStrEntryCreate(device_tree.ptr(), "video", video.ptr())) { |
327 |
< |
RegistryPropertyCreateStr(video.ptr(), "AAPL,connector", "monitor"); |
328 |
< |
RegistryPropertyCreateStr(video.ptr(), "device_type", "display"); |
329 |
< |
RegistryPropertyCreate(video.ptr(), "driver,AAPL,MacOS,PowerPC", video_driver, sizeof(video_driver)); |
330 |
< |
RegistryPropertyCreateStr(video.ptr(), "model", "SheepShaver Video"); |
326 |
> |
if (!RegistryCStrEntryCreate(device_tree.addr(), "video", video.addr())) { |
327 |
> |
RegistryPropertyCreateStr(video.addr(), "AAPL,connector", "monitor"); |
328 |
> |
RegistryPropertyCreateStr(video.addr(), "device_type", "display"); |
329 |
> |
SheepArray<sizeof(video_driver)> the_video_driver; |
330 |
> |
Host2Mac_memcpy(the_video_driver.addr(), video_driver, sizeof(video_driver)); |
331 |
> |
RegistryPropertyCreate(video.addr(), "driver,AAPL,MacOS,PowerPC", the_video_driver.addr(), sizeof(video_driver)); |
332 |
> |
RegistryPropertyCreateStr(video.addr(), "model", "SheepShaver Video"); |
333 |
|
} |
334 |
|
|
335 |
|
// Create "ethernet" |
336 |
+ |
// XXX the current ethernet driver is not direct addressing clean |
337 |
+ |
#if REAL_ADDRESSING |
338 |
|
SheepRegEntryID ethernet; |
339 |
< |
if (!RegistryCStrEntryCreate(device_tree.ptr(), "ethernet", ethernet.ptr())) { |
340 |
< |
RegistryPropertyCreateStr(ethernet.ptr(), "AAPL,connector", "ethernet"); |
341 |
< |
RegistryPropertyCreateStr(ethernet.ptr(), "device_type", "network"); |
342 |
< |
RegistryPropertyCreate(ethernet.ptr(), "driver,AAPL,MacOS,PowerPC", ethernet_driver, sizeof(ethernet_driver)); |
339 |
> |
if (!RegistryCStrEntryCreate(device_tree.addr(), "ethernet", ethernet.addr())) { |
340 |
> |
RegistryPropertyCreateStr(ethernet.addr(), "AAPL,connector", "ethernet"); |
341 |
> |
RegistryPropertyCreateStr(ethernet.addr(), "device_type", "network"); |
342 |
> |
SheepArray<sizeof(ethernet_driver)> the_ethernet_driver; |
343 |
> |
Host2Mac_memcpy(the_ethernet_driver.addr(), ethernet_driver, sizeof(ethernet_driver)); |
344 |
> |
RegistryPropertyCreate(ethernet.addr(), "driver,AAPL,MacOS,PowerPC", the_ethernet_driver.addr(), sizeof(ethernet_driver)); |
345 |
|
// local-mac-address |
346 |
|
// max-frame-size 2048 |
347 |
|
} |
348 |
+ |
#endif |
349 |
|
} |
350 |
|
D(bug("done.\n")); |
351 |
|
} |
353 |
|
void PatchNameRegistry(void) |
354 |
|
{ |
355 |
|
// Find RegistryCStrEntryCreate() and RegistryPropertyCreate() TVECTs |
356 |
< |
rcec_tvect = (uint32)FindLibSymbol("\017NameRegistryLib", "\027RegistryCStrEntryCreate"); |
356 |
> |
rcec_tvect = FindLibSymbol("\017NameRegistryLib", "\027RegistryCStrEntryCreate"); |
357 |
|
D(bug("RegistryCStrEntryCreate TVECT at %08x\n", rcec_tvect)); |
358 |
< |
rpc_tvect = (uint32)FindLibSymbol("\017NameRegistryLib", "\026RegistryPropertyCreate"); |
358 |
> |
rpc_tvect = FindLibSymbol("\017NameRegistryLib", "\026RegistryPropertyCreate"); |
359 |
|
D(bug("RegistryPropertyCreate TVECT at %08x\n", rpc_tvect)); |
360 |
|
if (rcec_tvect == 0 || rpc_tvect == 0) { |
361 |
|
ErrorAlert(GetString(STR_NO_NAME_REGISTRY_ERR)); |