FindLibSymbol() returns an address in MacOS address space. Likewise for

Mac_sysalloc(). i.e. make it return an uint32.
This commit is contained in:
gbeauche 2004-12-19 09:01:04 +00:00
parent ec8304c597
commit 7944aaf2de
7 changed files with 63 additions and 57 deletions

View File

@ -259,7 +259,7 @@ void EmulOp(M68kRegisters *r, uint32 pc, int selector)
InstallDrivers(); InstallDrivers();
// Patch MakeExecutable() // Patch MakeExecutable()
MakeExecutableTvec = (uint32)FindLibSymbol("\023PrivateInterfaceLib", "\016MakeExecutable"); MakeExecutableTvec = FindLibSymbol("\023PrivateInterfaceLib", "\016MakeExecutable");
D(bug("MakeExecutable TVECT at %08x\n", MakeExecutableTvec)); D(bug("MakeExecutable TVECT at %08x\n", MakeExecutableTvec));
WriteMacInt32(MakeExecutableTvec, NativeFunction(NATIVE_MAKE_EXECUTABLE)); WriteMacInt32(MakeExecutableTvec, NativeFunction(NATIVE_MAKE_EXECUTABLE));
#if !EMULATED_PPC #if !EMULATED_PPC

View File

@ -37,6 +37,9 @@
#define DEBUG 0 #define DEBUG 0
#include "debug.h" #include "debug.h"
#if DIRECT_ADDRESSING
#warning "This code is not direct addressing clean"
#endif
// Packet types // Packet types
enum { enum {
@ -86,7 +89,7 @@ struct DLPIStream {
void AddMulticast(uint8 *addr) void AddMulticast(uint8 *addr)
{ {
multicast_node *n = (multicast_node *)Mac_sysalloc(sizeof(multicast_node)); multicast_node *n = (multicast_node *)Mac2HostAddr(Mac_sysalloc(sizeof(multicast_node)));
memcpy(n->addr, addr, kEnetPhysicalAddressLength); memcpy(n->addr, addr, kEnetPhysicalAddressLength);
n->next = multicast_list; n->next = multicast_list;
multicast_list = n; multicast_list = n;
@ -106,7 +109,7 @@ struct DLPIStream {
while (q) { while (q) {
if (q->next == p) { if (q->next == p) {
q->next = p->next; q->next = p->next;
Mac_sysfree(p); Mac_sysfree(Host2MacAddr((uint8 *)p));
return; return;
} }
q = q->next; q = q->next;
@ -318,75 +321,75 @@ uint8 InitStreamModule(void *theID)
ether_driver_opened = false; ether_driver_opened = false;
// Import functions from OTKernelLib // Import functions from OTKernelLib
allocb_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\006allocb"); allocb_tvect = FindLibSymbol("\013OTKernelLib", "\006allocb");
D(bug("allocb TVECT at %08lx\n", allocb_tvect)); D(bug("allocb TVECT at %08lx\n", allocb_tvect));
if (allocb_tvect == 0) if (allocb_tvect == 0)
return false; return false;
freeb_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\005freeb"); freeb_tvect = FindLibSymbol("\013OTKernelLib", "\005freeb");
D(bug("freeb TVECT at %08lx\n", freeb_tvect)); D(bug("freeb TVECT at %08lx\n", freeb_tvect));
if (freeb_tvect == 0) if (freeb_tvect == 0)
return false; return false;
freemsg_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\007freemsg"); freemsg_tvect = FindLibSymbol("\013OTKernelLib", "\007freemsg");
D(bug("freemsg TVECT at %08lx\n", freemsg_tvect)); D(bug("freemsg TVECT at %08lx\n", freemsg_tvect));
if (freemsg_tvect == 0) if (freemsg_tvect == 0)
return false; return false;
copyb_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\005copyb"); copyb_tvect = FindLibSymbol("\013OTKernelLib", "\005copyb");
D(bug("copyb TVECT at %08lx\n", copyb_tvect)); D(bug("copyb TVECT at %08lx\n", copyb_tvect));
if (copyb_tvect == 0) if (copyb_tvect == 0)
return false; return false;
dupmsg_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\006dupmsg"); dupmsg_tvect = FindLibSymbol("\013OTKernelLib", "\006dupmsg");
D(bug("dupmsg TVECT at %08lx\n", dupmsg_tvect)); D(bug("dupmsg TVECT at %08lx\n", dupmsg_tvect));
if (dupmsg_tvect == 0) if (dupmsg_tvect == 0)
return false; return false;
getq_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\004getq"); getq_tvect = FindLibSymbol("\013OTKernelLib", "\004getq");
D(bug("getq TVECT at %08lx\n", getq_tvect)); D(bug("getq TVECT at %08lx\n", getq_tvect));
if (getq_tvect == 0) if (getq_tvect == 0)
return false; return false;
putq_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\004putq"); putq_tvect = FindLibSymbol("\013OTKernelLib", "\004putq");
D(bug("putq TVECT at %08lx\n", putq_tvect)); D(bug("putq TVECT at %08lx\n", putq_tvect));
if (putq_tvect == 0) if (putq_tvect == 0)
return false; return false;
putnext_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\007putnext"); putnext_tvect = FindLibSymbol("\013OTKernelLib", "\007putnext");
D(bug("putnext TVECT at %08lx\n", putnext_tvect)); D(bug("putnext TVECT at %08lx\n", putnext_tvect));
if (putnext_tvect == 0) if (putnext_tvect == 0)
return false; return false;
putnextctl1_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\013putnextctl1"); putnextctl1_tvect = FindLibSymbol("\013OTKernelLib", "\013putnextctl1");
D(bug("putnextctl1 TVECT at %08lx\n", putnextctl1_tvect)); D(bug("putnextctl1 TVECT at %08lx\n", putnextctl1_tvect));
if (putnextctl1_tvect == 0) if (putnextctl1_tvect == 0)
return false; return false;
canputnext_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\012canputnext"); canputnext_tvect = FindLibSymbol("\013OTKernelLib", "\012canputnext");
D(bug("canputnext TVECT at %08lx\n", canputnext_tvect)); D(bug("canputnext TVECT at %08lx\n", canputnext_tvect));
if (canputnext_tvect == 0) if (canputnext_tvect == 0)
return false; return false;
qreply_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\006qreply"); qreply_tvect = FindLibSymbol("\013OTKernelLib", "\006qreply");
D(bug("qreply TVECT at %08lx\n", qreply_tvect)); D(bug("qreply TVECT at %08lx\n", qreply_tvect));
if (qreply_tvect == 0) if (qreply_tvect == 0)
return false; return false;
flushq_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\006flushq"); flushq_tvect = FindLibSymbol("\013OTKernelLib", "\006flushq");
D(bug("flushq TVECT at %08lx\n", flushq_tvect)); D(bug("flushq TVECT at %08lx\n", flushq_tvect));
if (flushq_tvect == 0) if (flushq_tvect == 0)
return false; return false;
msgdsize_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\010msgdsize"); msgdsize_tvect = FindLibSymbol("\013OTKernelLib", "\010msgdsize");
D(bug("msgdsize TVECT at %08lx\n", msgdsize_tvect)); D(bug("msgdsize TVECT at %08lx\n", msgdsize_tvect));
if (msgdsize_tvect == 0) if (msgdsize_tvect == 0)
return false; return false;
otenterint_tvect = (uint32)FindLibSymbol("\017OTKernelUtilLib", "\020OTEnterInterrupt"); otenterint_tvect = FindLibSymbol("\017OTKernelUtilLib", "\020OTEnterInterrupt");
D(bug("OTEnterInterrupt TVECT at %08lx\n", otenterint_tvect)); D(bug("OTEnterInterrupt TVECT at %08lx\n", otenterint_tvect));
if (otenterint_tvect == 0) if (otenterint_tvect == 0)
return false; return false;
otleaveint_tvect = (uint32)FindLibSymbol("\017OTKernelUtilLib", "\020OTLeaveInterrupt"); otleaveint_tvect = FindLibSymbol("\017OTKernelUtilLib", "\020OTLeaveInterrupt");
D(bug("OTLeaveInterrupt TVECT at %08lx\n", otleaveint_tvect)); D(bug("OTLeaveInterrupt TVECT at %08lx\n", otleaveint_tvect));
if (otleaveint_tvect == 0) if (otleaveint_tvect == 0)
return false; return false;
mi_open_comm_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\014mi_open_comm"); mi_open_comm_tvect = FindLibSymbol("\013OTKernelLib", "\014mi_open_comm");
D(bug("mi_open_comm TVECT at %08lx\n", mi_open_comm_tvect)); D(bug("mi_open_comm TVECT at %08lx\n", mi_open_comm_tvect));
if (mi_open_comm_tvect == 0) if (mi_open_comm_tvect == 0)
return false; return false;
mi_close_comm_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\015mi_close_comm"); mi_close_comm_tvect = FindLibSymbol("\013OTKernelLib", "\015mi_close_comm");
D(bug("mi_close_comm TVECT at %08lx\n", mi_close_comm_tvect)); D(bug("mi_close_comm TVECT at %08lx\n", mi_close_comm_tvect));
if (mi_close_comm_tvect == 0) if (mi_close_comm_tvect == 0)
return false; return false;
mi_next_ptr_tvect = (uint32)FindLibSymbol("\013OTKernelLib", "\013mi_next_ptr"); mi_next_ptr_tvect = FindLibSymbol("\013OTKernelLib", "\013mi_next_ptr");
D(bug("mi_next_ptr TVECT at %08lx\n", mi_next_ptr_tvect)); D(bug("mi_next_ptr TVECT at %08lx\n", mi_next_ptr_tvect));
if (mi_next_ptr_tvect == 0) if (mi_next_ptr_tvect == 0)
return false; return false;
@ -1542,7 +1545,7 @@ static void DLPI_enable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp)
AO_enable_multicast(reqaddr); AO_enable_multicast(reqaddr);
// Add new address to multicast list // Add new address to multicast list
uint8 *addr = (uint8 *)Mac_sysalloc(kEnetPhysicalAddressLength); uint8 *addr = Mac2HostAddr(Mac_sysalloc(kEnetPhysicalAddressLength));
OTCopy48BitAddress(reqaddr, addr); OTCopy48BitAddress(reqaddr, addr);
the_stream->AddMulticast(addr); the_stream->AddMulticast(addr);
@ -1580,7 +1583,7 @@ static void DLPI_disable_multi(DLPIStream *the_stream, queue_t *q, mblk_t *mp)
// Found, then remove // Found, then remove
the_stream->RemoveMulticast(addr); the_stream->RemoveMulticast(addr);
Mac_sysfree(addr); Mac_sysfree(Host2MacAddr(addr));
// Tell add-on to disable multicast address // Tell add-on to disable multicast address
AO_disable_multicast(reqaddr); AO_disable_multicast(reqaddr);

View File

@ -353,12 +353,12 @@ extern void Enqueue(uint32 elem, uint32 list); // Enqueue QElem to list
extern int FindFreeDriveNumber(int num); // Find first free drive number, starting at "num" extern int FindFreeDriveNumber(int num); // Find first free drive number, starting at "num"
extern void MountVolume(void *fh); // Mount volume with given file handle (see sys.h) extern void MountVolume(void *fh); // Mount volume with given file handle (see sys.h)
extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size); // Calculate disk image file layout given file size and first 256 data bytes extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size); // Calculate disk image file layout given file size and first 256 data bytes
extern void *FindLibSymbol(char *lib, char *sym); // Find symbol in shared library extern uint32 FindLibSymbol(char *lib, char *sym); // Find symbol in shared library
extern void InitCallUniversalProc(void); // Init CallUniversalProc() extern void InitCallUniversalProc(void); // Init CallUniversalProc()
extern long CallUniversalProc(void *upp, uint32 info); // CallUniversalProc() extern long CallUniversalProc(void *upp, uint32 info); // CallUniversalProc()
extern uint32 TimeToMacTime(time_t t); // Convert time_t value to MacOS time extern uint32 TimeToMacTime(time_t t); // Convert time_t value to MacOS time
extern void *Mac_sysalloc(uint32 size); // Allocate block in MacOS system heap zone extern uint32 Mac_sysalloc(uint32 size); // Allocate block in MacOS system heap zone
extern void Mac_sysfree(void * p); // Release block occupied by the nonrelocatable block p extern void Mac_sysfree(uint32 addr); // Release block occupied by the nonrelocatable block p
// Construct four-character-code from string // Construct four-character-code from string
#define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d)) #define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d))

View File

@ -58,15 +58,15 @@ static inline int16 CloseConnection(uint32 *arg1)
{ {
return (int16)CallMacOS1(cc_ptr, cc_tvect, arg1); return (int16)CallMacOS1(cc_ptr, cc_tvect, arg1);
} }
typedef void *(*nps_ptr)(uint32); typedef uint32 (*nps_ptr)(uint32);
static uint32 nps_tvect = 0; static uint32 nps_tvect = 0;
static inline void *NewPtrSys(uint32 arg1) static inline uint32 NewPtrSys(uint32 arg1)
{ {
return (void *)CallMacOS1(nps_ptr, nps_tvect, arg1); return CallMacOS1(nps_ptr, nps_tvect, arg1);
} }
typedef void (*d_ptr)(void *); typedef void (*d_ptr)(uint32);
static uint32 d_tvect = 0; static uint32 d_tvect = 0;
static inline void DisposePtr(void *arg1) static inline void DisposePtr(uint32 arg1)
{ {
CallMacOS1(d_ptr, d_tvect, arg1); CallMacOS1(d_ptr, d_tvect, arg1);
} }
@ -163,7 +163,7 @@ void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_s
* lib and sym must be Pascal strings! * lib and sym must be Pascal strings!
*/ */
void *FindLibSymbol(char *lib_str, char *sym_str) uint32 FindLibSymbol(char *lib_str, char *sym_str)
{ {
SheepVar32 conn_id = 0; SheepVar32 conn_id = 0;
SheepVar32 main_addr = 0; SheepVar32 main_addr = 0;
@ -202,7 +202,7 @@ void *FindLibSymbol(char *lib_str, char *sym_str)
Execute68k(proc1, &r); Execute68k(proc1, &r);
D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", (int16)r.d[0], conn_id.value(), main_addr.value())); D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", (int16)r.d[0], conn_id.value(), main_addr.value()));
if (r.d[0]) if (r.d[0])
return NULL; return 0;
// Find symbol // Find symbol
static const uint8 proc2_template[] = { static const uint8 proc2_template[] = {
@ -225,9 +225,9 @@ void *FindLibSymbol(char *lib_str, char *sym_str)
D(bug(" FindSymbol1: ret %d, sym_addr %p, sym_class %ld\n", (int16)r.d[0], sym_addr.value(), sym_class.value())); D(bug(" FindSymbol1: ret %d, sym_addr %p, sym_class %ld\n", (int16)r.d[0], sym_addr.value(), sym_class.value()));
//!! CloseConnection()? //!! CloseConnection()?
if (r.d[0]) if (r.d[0])
return NULL; return 0;
else else
return (void *)sym_addr.value(); return sym_addr.value();
} else { } else {
@ -239,14 +239,14 @@ void *FindLibSymbol(char *lib_str, char *sym_str)
res = GetSharedLibrary(lib.addr(), FOURCC('p','w','p','c'), 1, conn_id.addr(), main_addr.addr(), err.addr()); res = GetSharedLibrary(lib.addr(), FOURCC('p','w','p','c'), 1, conn_id.addr(), main_addr.addr(), err.addr());
D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", res, conn_id.value(), main_addr.value())); D(bug(" GetSharedLibrary: ret %d, connection ID %ld, main %p\n", res, conn_id.value(), main_addr.value()));
if (res) if (res)
return NULL; return 0;
res = FindSymbol(conn_id.value(), sym.addr(), sym_addr.addr(), sym_class.addr()); res = FindSymbol(conn_id.value(), sym.addr(), sym_addr.addr(), sym_class.addr());
D(bug(" FindSymbol: ret %d, sym_addr %p, sym_class %ld\n", res, sym_addr.value(), sym_class.value())); D(bug(" FindSymbol: ret %d, sym_addr %p, sym_class %ld\n", res, sym_addr.value(), sym_class.value()));
//!!?? CloseConnection(&conn_id); //!!?? CloseConnection(&conn_id);
if (res) if (res)
return NULL; return 0;
else else
return (void *)sym_addr.value(); return sym_addr.value();
} }
} }
@ -257,42 +257,42 @@ void *FindLibSymbol(char *lib_str, char *sym_str)
void InitCallUniversalProc() void InitCallUniversalProc()
{ {
cu_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\021CallUniversalProc"); cu_tvect = FindLibSymbol("\014InterfaceLib", "\021CallUniversalProc");
D(bug("CallUniversalProc TVECT at %08lx\n", cu_tvect)); D(bug("CallUniversalProc TVECT at %08lx\n", cu_tvect));
if (cu_tvect == 0) { if (cu_tvect == 0) {
printf("FATAL: Can't find CallUniversalProc()\n"); printf("FATAL: Can't find CallUniversalProc()\n");
QuitEmulator(); QuitEmulator();
} }
gsl_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\020GetSharedLibrary"); gsl_tvect = FindLibSymbol("\014InterfaceLib", "\020GetSharedLibrary");
D(bug("GetSharedLibrary TVECT at %08lx\n", gsl_tvect)); D(bug("GetSharedLibrary TVECT at %08lx\n", gsl_tvect));
if (gsl_tvect == 0) { if (gsl_tvect == 0) {
printf("FATAL: Can't find GetSharedLibrary()\n"); printf("FATAL: Can't find GetSharedLibrary()\n");
QuitEmulator(); QuitEmulator();
} }
fs_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\012FindSymbol"); fs_tvect = FindLibSymbol("\014InterfaceLib", "\012FindSymbol");
D(bug("FindSymbol TVECT at %08lx\n", fs_tvect)); D(bug("FindSymbol TVECT at %08lx\n", fs_tvect));
if (fs_tvect == 0) { if (fs_tvect == 0) {
printf("FATAL: Can't find FindSymbol()\n"); printf("FATAL: Can't find FindSymbol()\n");
QuitEmulator(); QuitEmulator();
} }
cc_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\017CloseConnection"); cc_tvect = FindLibSymbol("\014InterfaceLib", "\017CloseConnection");
D(bug("CloseConnection TVECT at %08lx\n", cc_tvect)); D(bug("CloseConnection TVECT at %08lx\n", cc_tvect));
if (cc_tvect == 0) { if (cc_tvect == 0) {
printf("FATAL: Can't find CloseConnection()\n"); printf("FATAL: Can't find CloseConnection()\n");
QuitEmulator(); QuitEmulator();
} }
nps_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\011NewPtrSys"); nps_tvect = FindLibSymbol("\014InterfaceLib", "\011NewPtrSys");
D(bug("NewPtrSys TVECT at %08lx\n", nps_tvect)); D(bug("NewPtrSys TVECT at %08lx\n", nps_tvect));
if (nps_tvect == 0) { if (nps_tvect == 0) {
printf("FATAL: Can't find NewPtrSys()\n"); printf("FATAL: Can't find NewPtrSys()\n");
QuitEmulator(); QuitEmulator();
} }
d_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\012DisposePtr"); d_tvect = FindLibSymbol("\014InterfaceLib", "\012DisposePtr");
D(bug("DisposePtr TVECT at %08lx\n", d_tvect)); D(bug("DisposePtr TVECT at %08lx\n", d_tvect));
if (d_tvect == 0) { if (d_tvect == 0) {
printf("FATAL: Can't find DisposePtr()\n"); printf("FATAL: Can't find DisposePtr()\n");
@ -343,12 +343,12 @@ uint32 TimeToMacTime(time_t t)
* Memory allocators in MacOS system heap zone * Memory allocators in MacOS system heap zone
*/ */
void *Mac_sysalloc(uint32 size) uint32 Mac_sysalloc(uint32 size)
{ {
return NewPtrSys(size); return NewPtrSys(size);
} }
void Mac_sysfree(void *p) void Mac_sysfree(uint32 addr)
{ {
DisposePtr(p); DisposePtr(addr);
} }

View File

@ -343,9 +343,9 @@ void DoPatchNameRegistry(void)
void PatchNameRegistry(void) void PatchNameRegistry(void)
{ {
// Find RegistryCStrEntryCreate() and RegistryPropertyCreate() TVECTs // Find RegistryCStrEntryCreate() and RegistryPropertyCreate() TVECTs
rcec_tvect = (uint32)FindLibSymbol("\017NameRegistryLib", "\027RegistryCStrEntryCreate"); rcec_tvect = FindLibSymbol("\017NameRegistryLib", "\027RegistryCStrEntryCreate");
D(bug("RegistryCStrEntryCreate TVECT at %08x\n", rcec_tvect)); D(bug("RegistryCStrEntryCreate TVECT at %08x\n", rcec_tvect));
rpc_tvect = (uint32)FindLibSymbol("\017NameRegistryLib", "\026RegistryPropertyCreate"); rpc_tvect = FindLibSymbol("\017NameRegistryLib", "\026RegistryPropertyCreate");
D(bug("RegistryPropertyCreate TVECT at %08x\n", rpc_tvect)); D(bug("RegistryPropertyCreate TVECT at %08x\n", rpc_tvect));
if (rcec_tvect == 0 || rpc_tvect == 0) { if (rcec_tvect == 0 || rpc_tvect == 0) {
ErrorAlert(GetString(STR_NO_NAME_REGISTRY_ERR)); ErrorAlert(GetString(STR_NO_NAME_REGISTRY_ERR));

View File

@ -59,7 +59,7 @@ int16 SerialOpen(uint32 pb, uint32 dce)
D(bug("SerialOpen pb %08lx, dce %08lx\n", pb, dce)); D(bug("SerialOpen pb %08lx, dce %08lx\n", pb, dce));
// Get IOCommandIsComplete function // Get IOCommandIsComplete function
iocic_tvect = (uint32)FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete"); iocic_tvect = FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete");
D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect)); D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect));
if (iocic_tvect == 0) { if (iocic_tvect == 0) {
printf("FATAL: SerialOpen(): Can't find IOCommandIsComplete()\n"); printf("FATAL: SerialOpen(): Can't find IOCommandIsComplete()\n");
@ -82,8 +82,10 @@ int16 SerialOpen(uint32 pb, uint32 dce)
return res; return res;
// Allocate Deferred Task structures // Allocate Deferred Task structures
uint32 input_dt = the_port->input_dt = (uint32)the_port->dt_store; if ((the_port->dt_store = Mac_sysalloc(SIZEOF_serdt * 2)) == 0)
uint32 output_dt = the_port->output_dt = (uint32)the_port->dt_store + SIZEOF_serdt; return openErr;
uint32 input_dt = the_port->input_dt = the_port->dt_store;
uint32 output_dt = the_port->output_dt = the_port->dt_store + SIZEOF_serdt;
D(bug(" input_dt %08lx, output_dt %08lx\n", input_dt, output_dt)); D(bug(" input_dt %08lx, output_dt %08lx\n", input_dt, output_dt));
WriteMacInt16(input_dt + qType, dtQType); WriteMacInt16(input_dt + qType, dtQType);
@ -270,6 +272,7 @@ int16 SerialClose(uint32 pb, uint32 dce)
// Close port if open // Close port if open
SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1]; SERDPort *the_port = the_serd_port[(-(int16)ReadMacInt16(dce + dCtlRefNum)-6) >> 1];
if (the_port->is_open) { if (the_port->is_open) {
Mac_sysfree(the_port->dt_store);
int16 res = the_port->close(); int16 res = the_port->close();
the_port->is_open = false; the_port->is_open = false;
return res; return res;

View File

@ -889,35 +889,35 @@ int16 VideoDoDriverIO(uint32 spaceID, uint32 commandID, uint32 commandContents,
delete private_data->gammaTable; delete private_data->gammaTable;
delete private_data; delete private_data;
iocic_tvect = (uint32)FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete"); iocic_tvect = FindLibSymbol("\021DriverServicesLib", "\023IOCommandIsComplete");
D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect)); D(bug("IOCommandIsComplete TVECT at %08lx\n", iocic_tvect));
if (iocic_tvect == 0) { if (iocic_tvect == 0) {
printf("FATAL: VideoDoDriverIO(): Can't find IOCommandIsComplete()\n"); printf("FATAL: VideoDoDriverIO(): Can't find IOCommandIsComplete()\n");
err = -1; err = -1;
break; break;
} }
vslnewis_tvect = (uint32)FindLibSymbol("\020VideoServicesLib", "\026VSLNewInterruptService"); vslnewis_tvect = FindLibSymbol("\020VideoServicesLib", "\026VSLNewInterruptService");
D(bug("VSLNewInterruptService TVECT at %08lx\n", vslnewis_tvect)); D(bug("VSLNewInterruptService TVECT at %08lx\n", vslnewis_tvect));
if (vslnewis_tvect == 0) { if (vslnewis_tvect == 0) {
printf("FATAL: VideoDoDriverIO(): Can't find VSLNewInterruptService()\n"); printf("FATAL: VideoDoDriverIO(): Can't find VSLNewInterruptService()\n");
err = -1; err = -1;
break; break;
} }
vsldisposeis_tvect = (uint32)FindLibSymbol("\020VideoServicesLib", "\032VSLDisposeInterruptService"); vsldisposeis_tvect = FindLibSymbol("\020VideoServicesLib", "\032VSLDisposeInterruptService");
D(bug("VSLDisposeInterruptService TVECT at %08lx\n", vsldisposeis_tvect)); D(bug("VSLDisposeInterruptService TVECT at %08lx\n", vsldisposeis_tvect));
if (vsldisposeis_tvect == 0) { if (vsldisposeis_tvect == 0) {
printf("FATAL: VideoDoDriverIO(): Can't find VSLDisposeInterruptService()\n"); printf("FATAL: VideoDoDriverIO(): Can't find VSLDisposeInterruptService()\n");
err = -1; err = -1;
break; break;
} }
vsldois_tvect = (uint32)FindLibSymbol("\020VideoServicesLib", "\025VSLDoInterruptService"); vsldois_tvect = FindLibSymbol("\020VideoServicesLib", "\025VSLDoInterruptService");
D(bug("VSLDoInterruptService TVECT at %08lx\n", vsldois_tvect)); D(bug("VSLDoInterruptService TVECT at %08lx\n", vsldois_tvect));
if (vsldois_tvect == 0) { if (vsldois_tvect == 0) {
printf("FATAL: VideoDoDriverIO(): Can't find VSLDoInterruptService()\n"); printf("FATAL: VideoDoDriverIO(): Can't find VSLDoInterruptService()\n");
err = -1; err = -1;
break; break;
} }
nqdmisc_tvect = (uint32)FindLibSymbol("\014InterfaceLib", "\007NQDMisc"); nqdmisc_tvect = FindLibSymbol("\014InterfaceLib", "\007NQDMisc");
D(bug("NQDMisc TVECT at %08lx\n", nqdmisc_tvect)); D(bug("NQDMisc TVECT at %08lx\n", nqdmisc_tvect));
if (nqdmisc_tvect == 0) { if (nqdmisc_tvect == 0) {
printf("FATAL: VideoDoDriverIO(): Can't find NQDMisc()\n"); printf("FATAL: VideoDoDriverIO(): Can't find NQDMisc()\n");