58 |
|
{ |
59 |
|
return (int16)CallMacOS1(cc_ptr, cc_tvect, arg1); |
60 |
|
} |
61 |
< |
typedef void *(*nps_ptr)(uint32); |
61 |
> |
typedef uint32 (*nps_ptr)(uint32); |
62 |
|
static uint32 nps_tvect = 0; |
63 |
< |
static inline void *NewPtrSys(uint32 arg1) |
63 |
> |
static inline uint32 NewPtrSys(uint32 arg1) |
64 |
|
{ |
65 |
< |
return (void *)CallMacOS1(nps_ptr, nps_tvect, arg1); |
65 |
> |
return CallMacOS1(nps_ptr, nps_tvect, arg1); |
66 |
|
} |
67 |
< |
typedef void (*d_ptr)(void *); |
67 |
> |
typedef void (*d_ptr)(uint32); |
68 |
|
static uint32 d_tvect = 0; |
69 |
< |
static inline void DisposePtr(void *arg1) |
69 |
> |
static inline void DisposePtr(uint32 arg1) |
70 |
|
{ |
71 |
|
CallMacOS1(d_ptr, d_tvect, arg1); |
72 |
|
} |
163 |
|
* lib and sym must be Pascal strings! |
164 |
|
*/ |
165 |
|
|
166 |
< |
void *FindLibSymbol(char *lib_str, char *sym_str) |
166 |
> |
uint32 FindLibSymbol(char *lib_str, char *sym_str) |
167 |
|
{ |
168 |
|
SheepVar32 conn_id = 0; |
169 |
|
SheepVar32 main_addr = 0; |
202 |
|
Execute68k(proc1, &r); |
203 |
|
D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", (int16)r.d[0], conn_id.value(), main_addr.value())); |
204 |
|
if (r.d[0]) |
205 |
< |
return NULL; |
205 |
> |
return 0; |
206 |
|
|
207 |
|
// Find symbol |
208 |
|
static const uint8 proc2_template[] = { |
225 |
|
D(bug(" FindSymbol1: ret %d, sym_addr %p, sym_class %ld\n", (int16)r.d[0], sym_addr.value(), sym_class.value())); |
226 |
|
//!! CloseConnection()? |
227 |
|
if (r.d[0]) |
228 |
< |
return NULL; |
228 |
> |
return 0; |
229 |
|
else |
230 |
< |
return (void *)sym_addr.value(); |
230 |
> |
return sym_addr.value(); |
231 |
|
|
232 |
|
} else { |
233 |
|
|
239 |
|
res = GetSharedLibrary(lib.addr(), FOURCC('p','w','p','c'), 1, conn_id.addr(), main_addr.addr(), err.addr()); |
240 |
|
D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", res, conn_id.value(), main_addr.value())); |
241 |
|
if (res) |
242 |
< |
return NULL; |
242 |
> |
return 0; |
243 |
|
res = FindSymbol(conn_id.value(), sym.addr(), sym_addr.addr(), sym_class.addr()); |
244 |
|
D(bug(" FindSymbol: ret %d, sym_addr %p, sym_class %ld\n", res, sym_addr.value(), sym_class.value())); |
245 |
|
//!!?? CloseConnection(&conn_id); |
246 |
|
if (res) |
247 |
< |
return NULL; |
247 |
> |
return 0; |
248 |
|
else |
249 |
< |
return (void *)sym_addr.value(); |
249 |
> |
return sym_addr.value(); |
250 |
|
} |
251 |
|
} |
252 |
|
|
257 |
|
|
258 |
|
void InitCallUniversalProc() |
259 |
|
{ |
260 |
< |
cu_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\021CallUniversalProc"); |
260 |
> |
cu_tvect = FindLibSymbol("\014InterfaceLib", "\021CallUniversalProc"); |
261 |
|
D(bug("CallUniversalProc TVECT at %08lx\n", cu_tvect)); |
262 |
|
if (cu_tvect == 0) { |
263 |
|
printf("FATAL: Can't find CallUniversalProc()\n"); |
264 |
|
QuitEmulator(); |
265 |
|
} |
266 |
|
|
267 |
< |
gsl_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\020GetSharedLibrary"); |
267 |
> |
gsl_tvect = FindLibSymbol("\014InterfaceLib", "\020GetSharedLibrary"); |
268 |
|
D(bug("GetSharedLibrary TVECT at %08lx\n", gsl_tvect)); |
269 |
|
if (gsl_tvect == 0) { |
270 |
|
printf("FATAL: Can't find GetSharedLibrary()\n"); |
271 |
|
QuitEmulator(); |
272 |
|
} |
273 |
|
|
274 |
< |
fs_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\012FindSymbol"); |
274 |
> |
fs_tvect = FindLibSymbol("\014InterfaceLib", "\012FindSymbol"); |
275 |
|
D(bug("FindSymbol TVECT at %08lx\n", fs_tvect)); |
276 |
|
if (fs_tvect == 0) { |
277 |
|
printf("FATAL: Can't find FindSymbol()\n"); |
278 |
|
QuitEmulator(); |
279 |
|
} |
280 |
|
|
281 |
< |
cc_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\017CloseConnection"); |
281 |
> |
cc_tvect = FindLibSymbol("\014InterfaceLib", "\017CloseConnection"); |
282 |
|
D(bug("CloseConnection TVECT at %08lx\n", cc_tvect)); |
283 |
|
if (cc_tvect == 0) { |
284 |
|
printf("FATAL: Can't find CloseConnection()\n"); |
285 |
|
QuitEmulator(); |
286 |
|
} |
287 |
|
|
288 |
< |
nps_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\011NewPtrSys"); |
288 |
> |
nps_tvect = FindLibSymbol("\014InterfaceLib", "\011NewPtrSys"); |
289 |
|
D(bug("NewPtrSys TVECT at %08lx\n", nps_tvect)); |
290 |
|
if (nps_tvect == 0) { |
291 |
|
printf("FATAL: Can't find NewPtrSys()\n"); |
292 |
|
QuitEmulator(); |
293 |
|
} |
294 |
|
|
295 |
< |
d_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\012DisposePtr"); |
295 |
> |
d_tvect = FindLibSymbol("\014InterfaceLib", "\012DisposePtr"); |
296 |
|
D(bug("DisposePtr TVECT at %08lx\n", d_tvect)); |
297 |
|
if (d_tvect == 0) { |
298 |
|
printf("FATAL: Can't find DisposePtr()\n"); |
343 |
|
* Memory allocators in MacOS system heap zone |
344 |
|
*/ |
345 |
|
|
346 |
< |
void *Mac_sysalloc(uint32 size) |
346 |
> |
uint32 Mac_sysalloc(uint32 size) |
347 |
|
{ |
348 |
|
return NewPtrSys(size); |
349 |
|
} |
350 |
|
|
351 |
< |
void Mac_sysfree(void *p) |
351 |
> |
void Mac_sysfree(uint32 addr) |
352 |
|
{ |
353 |
< |
DisposePtr(p); |
353 |
> |
DisposePtr(addr); |
354 |
|
} |