Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion multiversal
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,12 @@ set(prefs_sources

source_group(Prefs FILES ${prefs_sources})

set(mactcp_sources
mactcp/mactcp.cpp
)

source_group(MacTCP FILES ${mactcp_sources})

set(util_sources
util/macstrings.h
util/macstrings.cpp
Expand Down Expand Up @@ -536,6 +542,7 @@ set(include_sources
include/rsys/icon.h
include/rsys/keyboard.h
include/rsys/launch.h
include/rsys/mactcp.h
include/rsys/macros.h
include/rsys/noreturn.h
include/rsys/osutil.h
Expand Down Expand Up @@ -567,6 +574,7 @@ set(sources ${base_sources} ${mman_sources} ${vdriver_sources}
${sound_sources} ${num_sources} ${misc_sources}
${file_sources} ${hfs_sources} ${time_sources} ${osevent_sources}
${error_sources} ${commandline_sources} ${prefs_sources}
${mactcp_sources}
${util_sources} ${debug_sources}
${api_headers} ${trap_instance_sources} ${host_os_sources}
${mpw_sources}
Expand Down
13 changes: 13 additions & 0 deletions src/desk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ void Executor::C_SystemTask()
for(i = 0; i < LM(UnitNtryCnt); ++i)
{
dctlh = LM(UTableBase)[i];
/* The unit table is sparse: native drivers install themselves at
* fixed unit numbers (serial at 5..8) and leave the slots in
* between empty. Skip empty slots rather than dereference them.
*
* NOTE: LM(UnitNtryCnt) is set to 0 in init.cpp and never
* updated, so this loop never actually runs -- meaning accRun is
* never delivered to any driver. Fixing that is a Device
* Manager design question; this guard is what makes raising
* UnitNtryCnt safe when someone does. */
if(!dctlh || !*dctlh)
continue;
if(((*dctlh)->dCtlFlags & NEEDTIMEBIT) && TickCount() >= (*dctlh)->dCtlCurTicks)
{
Control(itorn(i), accRun, (Ptr)0);
Expand Down Expand Up @@ -241,6 +252,8 @@ void Executor::C_SystemMenu(LONGINT menu)
for(i = 0; i < LM(UnitNtryCnt); ++i)
{
dctlh = LM(UTableBase)[i];
if(!dctlh || !*dctlh) /* sparse unit table -- see C_SystemTask */
continue;
if((*dctlh)->dCtlMenu == LM(MBarEnable))
{
menu_s = menu;
Expand Down
13 changes: 13 additions & 0 deletions src/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <rsys/device.h>
#include <file/file.h>
#include <rsys/serial.h>
#include <rsys/mactcp.h>
#include <base/cpu.h>
#include <base/functions.impl.h>

using namespace Executor;
Expand Down Expand Up @@ -258,9 +260,20 @@ void Executor::RegisterDriver(const driverinfo& di)
knowndrivers.push_back(di);
}

/* Re-enter emulated code to run a driver call's completion routine.
* A0 = param block, A1 = the routine, D0 = result. */
void Executor::callcomp(ParmBlkPtr pbp, ProcPtr comp, OSErr err)
{
EM_A0 = US_TO_SYN68K(pbp);
EM_A1 = US_TO_SYN68K(comp);
EM_D0 = (unsigned short)err; /* TODO: unsigned short ? */
execute68K((syn68k_addr_t)(uintptr_t)comp);
}

static void InitBuiltinDrivers()
{
InitSerialDriver();
InitMacTCPDriver();
}

/*
Expand Down
6 changes: 6 additions & 0 deletions src/include/rsys/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ struct driverinfo
};

void RegisterDriver(const driverinfo& di);

/* Re-enter emulated code to run a driver call's completion routine.
* A0 = param block, A1 = the routine, D0 = result -- the completion
* routine ABI. Any native driver implementing asynchronous calls
* needs this, so it lives here rather than in one driver's .cpp. */
void callcomp(ParmBlkPtr pbp, ProcPtr comp, OSErr err);
}
11 changes: 11 additions & 0 deletions src/include/rsys/mactcp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* rsys/mactcp.h — native MacTCP (.IPP) driver for Executor 2000.
*/
#if !defined(_RSYS_MACTCP_H_)
#define _RSYS_MACTCP_H_

namespace Executor
{
void InitMacTCPDriver();
}
#endif
Loading
Loading