Skip to content

Commit

Permalink
Beginning of support for x86_64 in 64-bit mode. Still have to deal wi…
Browse files Browse the repository at this point in the history
…th various pointer transformations.
  • Loading branch information
Clifford T. Matthews committed Jun 26, 2009
1 parent a89fd44 commit cb045f3
Show file tree
Hide file tree
Showing 74 changed files with 588 additions and 482 deletions.
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ Windows using mingw32. So far that port hasn't been tried since
putting the code on Github. It probably doesn't work, but probably
could be made to work without much effort.

At one time we had Executor running on the Alpha, a 64-bit
environment. We actually modified gcc to support "pointer bit-fields"
and were able to get Executor to run. Now that 64-bit machines are
more popular, I've begun an experiment in supporting 64-bit machines
without modifying the compiler.

As I continue Executor's transition to a recent gnu build system I may
inadvertantly push versions that don't build when using the above
commands. Don't hesitate to ask me if you're having trouble
Expand Down
2 changes: 2 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Document work in progress on 64-bit port

Yank all the misleading RCS strings

Update the copyright notices to make it that the code is under
Expand Down
5 changes: 5 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ arch_sources = config/arch/powerpc/powerpc.c \
AM_CPPFLAGS += -D_GNU_SOURCE
endif CONFIG_ARCH_POWERPC

if CONFIG_ARCH_X86_64
arch_sources = config/arch/x86_64/x86_64.c
endif CONFIG_ARCH_X86_64


if CONFIG_FRONT_END_DOS
# The DOS port of Executor hasn't ever been built using automake. Most likely
# we'll rip all the DOS support out of the code before ever making it go, but
Expand Down
3 changes: 3 additions & 0 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ AM_CONDITIONAL([CONFIG_ARCH_ALPHA], [test x$host_cpu = xalpha])
AM_CONDITIONAL([CONFIG_ARCH_I386], [test x$host_cpu = xi386])
AM_CONDITIONAL([CONFIG_ARCH_M68K], [test x$host_cpu = xm68k])
AM_CONDITIONAL([CONFIG_ARCH_POWERPC], [test x$host_cpu = xpowerpc])
AM_CONDITIONAL([CONFIG_ARCH_X86_64], [test x$host_cpu = xx86_64])

AM_CONDITIONAL([CONFIG_FRONT_END_DOS], [test x$front_end = xdos])
AM_CONDITIONAL([CONFIG_FRONT_END_NEXTSTEP], [test x$front_end = xnextstep])
Expand All @@ -157,6 +158,8 @@ AM_CONDITIONAL([CONFIG_SOUND_DJGPP], [test x$sound_config = xdjgpp])
AM_CONDITIONAL([CONFIG_SOUND_LINUX], [test x$sound_config = xlinux])
AM_CONDITIONAL([CONFIG_SOUND_SDL], [test x$sound_config = xsdl])

AC_CHECK_SIZEOF([char *])

AC_CONFIG_FILES([Makefile])

AC_OUTPUT
6 changes: 3 additions & 3 deletions src/ctlInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ P2(PUBLIC pascal trap, ControlHandle, GetNewControl, /* IMI-321 */
INTEGER, cid, WindowPtr, wst)
{
typedef contrlrestype *wp;
typedef struct { wp p PACKED_P; } HIDDEN_wp;
MAKE_HIDDEN(wp);
HIDDEN_wp *wh;
ControlHandle retval;
Handle ctab_res_h;
Expand Down Expand Up @@ -170,9 +170,9 @@ P2 (PUBLIC pascal trap, void, SetCtlColor, ControlHandle, ctl, CCTabHandle, ctab

P1(PUBLIC pascal trap, void, DisposeControl, ControlHandle, c) /* IMI-321 */
{
typedef struct { ControlHandle p PACKED_P; } HIDDEN_ControlHandle;
MAKE_HIDDEN(ControlHandle);
HIDDEN_ControlHandle *t;
typedef struct { AuxCtlHandle p PACKED_P; } HIDDEN_AuxCtlHandle;
MAKE_HIDDEN(AuxCtlHandle);
HIDDEN_AuxCtlHandle *auxhp;
AuxCtlHandle saveauxh;

Expand Down
2 changes: 1 addition & 1 deletion src/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ A2(PRIVATE, void, mungfmo, ctrip, cp, FMOutput *, fmop)

A1(PRIVATE, BOOLEAN, widthlistmatch, FMInput *, fmip)
{
typedef struct { WHandle p PACKED_P; } HIDDEN_WHandle;
MAKE_HIDDEN(WHandle);
HIDDEN_WHandle *whp, *ewhp;

for (whp = (HIDDEN_WHandle *) STARH(WIDTHLISTHAND), ewhp = whp + MAXTABLES; whp != ewhp; whp++) {
Expand Down
13 changes: 8 additions & 5 deletions src/gestalt.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,20 @@ PRIVATE gestaltentry_t gtable[] = {
/* gestaltTermMgrAttr, 0, */
/* gestaltParityAttr, 0, */

#if defined(BINCOMPAT) && !defined(__alpha)
/*
* TODO: instead of casting these to LONGINT, shouldn't we be using something
* like US_TO_SYN68K here, or if not, soemthing that takes ROMlib_offset
* into account?
*/

#if defined(BINCOMPAT) && SIZEOF_CHAR_P == 4
{ gestaltExtToolboxTable, (LONGINT) (tooltraptable + 0x200), },
{ gestaltToolboxTable, (LONGINT) tooltraptable, },
{ gestaltOSTable, (LONGINT) ostraptable, },
#else
{ gestaltExtToolboxTable, UNKNOWN, },
{ gestaltOSTable, UNKNOWN, },
{ gestaltToolboxTable, UNKNOWN, },
#endif

#if defined(__alpha)
#warning gestalt{ExtToolboxTable,ToolboxTable,OSTable} not initialized
#endif

Expand Down Expand Up @@ -229,7 +232,7 @@ gestaltPhysicalRAMSize 'ram '
PRIVATE gestaltentry_t phystable[] =
{
{ gestaltSystemVersion, EXECUTOR_VERSION_NUMERIC },
#if !defined (__alpha)
#if SIZEOF_CHAR_P == 4
{ gestaltExecutorVersionString, (long) EXECUTOR_VERSION },
#else
#warning gestaltExecutorVersionString not currently available
Expand Down
8 changes: 4 additions & 4 deletions src/include/ADB.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ typedef struct PACKED
{
SignedByte devType;
SignedByte origADBAddr;
Ptr dbServiceRtPtr PACKED_P;
Ptr dbDataAreaAddr PACKED_P;
PACKED_MEMBER(Ptr, dbServiceRtPtr);
PACKED_MEMBER(Ptr, dbDataAreaAddr);
} ADBDataBlock;

typedef struct PACKED
{
Ptr siServiceRtPtr PACKED_P;
Ptr siDataAreaAddr PACKED_P;
PACKED_MEMBER(Ptr, siServiceRtPtr);
PACKED_MEMBER(Ptr, siDataAreaAddr);
} ADBSetInfoBlock;

extern void ADBReInit (void);
Expand Down
20 changes: 10 additions & 10 deletions src/include/AppleEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ typedef ProcPtr EventFilterProcPtr;

typedef struct PACKED AE_hdlr
{
ProcPtr fn PACKED_P;
PACKED_MEMBER(ProcPtr, fn);
int32 refcon;
} AE_hdlr_t;

Expand Down Expand Up @@ -158,14 +158,14 @@ typedef struct PACKED AE_hdlr_table
} AE_hdlr_table_t;

typedef AE_hdlr_table_t *AE_hdlr_table_ptr;
typedef struct { AE_hdlr_table_ptr p PACKED_P; } HIDDEN_AE_hdlr_table_ptr;
MAKE_HIDDEN(AE_hdlr_table_ptr);
typedef HIDDEN_AE_hdlr_table_ptr *AE_hdlr_table_h;

typedef struct PACKED AE_zone_tables
{
AE_hdlr_table_h event_hdlr_table PACKED_P;
AE_hdlr_table_h coercion_hdlr_table PACKED_P;
AE_hdlr_table_h special_hdlr_table PACKED_P;
PACKED_MEMBER(AE_hdlr_table_h, event_hdlr_table);
PACKED_MEMBER(AE_hdlr_table_h, coercion_hdlr_table);
PACKED_MEMBER(AE_hdlr_table_h, special_hdlr_table);

char pad_1[28];

Expand All @@ -175,30 +175,30 @@ typedef struct PACKED AE_zone_tables

/* points to a 32byte handle of unknown contents (at least,
sometimes) */
Handle unknown_sys_handle PACKED_P;
PACKED_MEMBER(Handle, unknown_sys_handle);
} AE_zone_tables_t;

typedef AE_zone_tables_t *AE_zone_tables_ptr;
typedef struct { AE_zone_tables_ptr p PACKED_P; } HIDDEN_AE_zone_tables_ptr;
MAKE_HIDDEN(AE_zone_tables_ptr);
typedef HIDDEN_AE_zone_tables_ptr *AE_zone_tables_h;

typedef struct PACKED AE_info
{
char pad_1[340];

/* offset of `appl_zone_tables' is 340; handle to a `struct tables' */
AE_zone_tables_h appl_zone_tables PACKED_P;
PACKED_MEMBER(AE_zone_tables_h, appl_zone_tables);

char pad_2[36];

/* offset of `system_zone_tables' is 380; handle to a `struct tables' */
AE_zone_tables_h system_zone_tables PACKED_P;
PACKED_MEMBER(AE_zone_tables_h, system_zone_tables);

char pad_3[212];
} AE_info_t;

typedef AE_info_t *AE_info_ptr;
typedef struct { AE_info_ptr p PACKED_P; } HIDDEN_AE_info_ptr;
MAKE_HIDDEN(AE_info_ptr);

extern pascal trap OSErr C__AE_hdlr_table_alloc (int32, int32, int32, int8,
AE_hdlr_table_h *);
Expand Down
83 changes: 45 additions & 38 deletions src/include/CQuickDraw.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

#include "WindowMgr.h"

typedef struct
{
HIDDEN_CGrafPtr *p PACKED_P;
} HIDDEN_CGrafPtr_Ptr;
typedef HIDDEN_CGrafPtr *HIDDEN_CGrafPtr_Ptr;
MAKE_HIDDEN(HIDDEN_CGrafPtr_Ptr);


#define theCPort (STARH (STARH ((HIDDEN_CGrafPtr_Ptr *) SYN68K_TO_US(a5))))
#define theCPortX ((*STARH ((HIDDEN_CGrafPtr_Ptr *) SYN68K_TO_US(a5))).p)
#define theCPort (STARH (STARH ((HIDDEN_HIDDEN_CGrafPtr_Ptr *) SYN68K_TO_US(a5))))
#define theCPortX ((*STARH ((HIDDEN_HIDDEN_CGrafPtr_Ptr *) SYN68K_TO_US(a5))).p)

#define minSeed 1024

Expand All @@ -24,29 +23,33 @@ typedef struct PACKED
unsigned char iTTable[1];
} ITab, *ITabPtr;

typedef struct { ITabPtr p PACKED_P; } HIDDEN_ITabPtr;
MAKE_HIDDEN(ITabPtr);
typedef HIDDEN_ITabPtr *ITabHandle;

typedef struct GDevice *GDPtr;
typedef struct { GDPtr p PACKED_P; } HIDDEN_GDevicePtr;
typedef GDPtr GDevicePtr;
MAKE_HIDDEN(GDevicePtr);
typedef HIDDEN_GDevicePtr *GDHandle;
typedef struct { GDHandle p PACKED_P; } HIDDEN_GDHandle;
MAKE_HIDDEN(GDHandle);

typedef struct { struct SProcRec *p PACKED_P; } HIDDEN_SProcPtr;
typedef struct PACKED SProcRec *SProcPtr;
MAKE_HIDDEN(SProcPtr);
typedef HIDDEN_SProcPtr *SProcHndl;
typedef struct PACKED SProcRec
{
SProcHndl nxtSrch PACKED_P;
ProcPtr srchProc PACKED_P;
} SProcRec, *SProcPtr;
PACKED_MEMBER(SProcHndl, nxtSrch);
PACKED_MEMBER(ProcPtr, srchProc);
} SProcRec;

typedef struct PACKED CProcRec *CProcPtr;
MAKE_HIDDEN(CProcPtr);

typedef struct { struct CProcRec *p PACKED_P; } HIDDEN_CProcPtr;
typedef HIDDEN_CProcPtr *CProcHndl;
typedef struct PACKED CProcRec
{
CProcHndl nxtComp PACKED_P;
ProcPtr compProc PACKED_P;
} CProcRec, *CProcPtr;
PACKED_MEMBER(CProcHndl, nxtComp);
PACKED_MEMBER(ProcPtr, compProc);
} CProcRec;

typedef void *DeviceLoopDrawingProcPtr;

Expand All @@ -55,20 +58,20 @@ typedef struct PACKED GDevice
INTEGER gdRefNum;
INTEGER gdID;
INTEGER gdType;
ITabHandle gdITable PACKED_P;
PACKED_MEMBER(ITabHandle, gdITable);
INTEGER gdResPref;
SProcHndl gdSearchProc PACKED_P;
CProcHndl gdCompProc PACKED_P;
PACKED_MEMBER(SProcHndl, gdSearchProc);
PACKED_MEMBER(CProcHndl, gdCompProc);
INTEGER gdFlags;
PixMapHandle gdPMap PACKED_P;
PACKED_MEMBER(PixMapHandle, gdPMap);
LONGINT gdRefCon;
GDHandle gdNextGD PACKED_P;
PACKED_MEMBER(GDHandle, gdNextGD);
Rect gdRect;
LONGINT gdMode;
INTEGER gdCCBytes;
INTEGER gdCCDepth;
Handle gdCCXData PACKED_P;
Handle gdCCXMask PACKED_P;
PACKED_MEMBER(Handle, gdCCXData);
PACKED_MEMBER(Handle, gdCCXMask);
LONGINT gdReserved;
} GDevice;

Expand All @@ -91,10 +94,10 @@ typedef struct PACKED ColorInfo
typedef struct PACKED Palette
{
INTEGER pmEntries;
GrafPtr pmWindow PACKED_P;
PACKED_MEMBER(GrafPtr, pmWindow);
INTEGER pmPrivate;
LONGINT /* Handle? */ pmDevices;
Handle pmSeeds PACKED_P;
PACKED_MEMBER(Handle,pmSeeds);
ColorInfo pmInfo[1];
} Palette, *PalettePtr;

Expand Down Expand Up @@ -129,7 +132,7 @@ typedef enum
#define pmFgUpdates ((INTEGER) pmFgUpdates_enum)
#define pmAllUpdates ((INTEGER) pmAllUpdates_enum)

typedef struct { PalettePtr p PACKED_P; } HIDDEN_PalettePtr;
MAKE_HIDDEN(PalettePtr);
typedef HIDDEN_PalettePtr *PaletteHandle;

/* return TRUE if `maybe_graphics_world' points to a graphics world,
Expand Down Expand Up @@ -169,7 +172,7 @@ typedef struct PACKED CommonSpec
} CommentSpec;

typedef CommentSpec *CommentSpecPtr;
typedef struct { CommentSpecPtr p PACKED_P; } HIDDEN_CommentSpecPtr;
MAKE_HIDDEN(CommentSpecPtr);
typedef HIDDEN_CommentSpecPtr *CommentSpecHandle;

typedef struct PACKED FontSpec
Expand All @@ -182,15 +185,15 @@ typedef struct PACKED FontSpec
} FontSpec;

typedef FontSpec *FontSpecPtr;
typedef struct { FontSpecPtr p PACKED_P; } HIDDEN_FontSpecPtr;
MAKE_HIDDEN(FontSpecPtr);
typedef HIDDEN_FontSpecPtr *FontSpecHandle;

typedef struct PACKED PictInfo
{
int16 version; /* 0 */
int32 uniqueColors; /* 2 */
PaletteHandle thePalette PACKED_P; /* 6 */
CTabHandle theColorTable PACKED_P; /* 10 */
PACKED_MEMBER(PaletteHandle, thePalette); /* 6 */
PACKED_MEMBER(CTabHandle, theColorTable); /* 10 */
Fixed hRes; /* 14 */
Fixed vRes; /* 18 */
INTEGER depth; /* 22 */
Expand All @@ -208,19 +211,19 @@ typedef struct PACKED PictInfo
int32 commentCount;

int32 uniqueComments;
CommentSpecHandle commentHandle PACKED_P;
PACKED_MEMBER(CommentSpecHandle, commentHandle);

int32 uniqueFonts;
FontSpecHandle fontHandle PACKED_P;
PACKED_MEMBER(FontSpecHandle, fontHandle);

Handle fontNamesHandle PACKED_P;
PACKED_MEMBER(Handle, fontNamesHandle);

int32 reserved1;
int32 reserved2;
} PictInfo;

typedef PictInfo *PictInfoPtr;
typedef struct { PictInfoPtr p PACKED_P; } HIDDEN_PictInfoPtr;
MAKE_HIDDEN(PictInfoPtr);
typedef HIDDEN_PictInfoPtr *PictInfoHandle;

typedef int32 PictInfoID;
Expand Down Expand Up @@ -452,8 +455,12 @@ extern HIDDEN_GDHandle MainDevice_H;
extern HIDDEN_GDHandle DeviceList_H;
#endif

#define TheGDevice (TheGDevice_H.p)
#define MainDevice (MainDevice_H.p)
#define DeviceList (DeviceList_H.p)
# define TheGDevice (TheGDevice_H.p)
# define MainDevice (MainDevice_H.p)
# define DeviceList (DeviceList_H.p)

#if SIZEOF_CHAR_P == 8
# warning "no type info in TheGDevice, MainDevice, DeviceList"
#endif

#endif /* _CQUICKDRAW_H_ */
8 changes: 4 additions & 4 deletions src/include/CommTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

typedef struct PACKED
{
QElemPtr qLink PACKED_P;
PACKED_MEMBER(QElemPtr, qLink);
INTEGER qType;
INTEGER crmVersion;
LONGINT crmPrivate;
Expand All @@ -35,9 +35,9 @@ enum { crmSerialDevice = 1 };
typedef struct PACKED
{
INTEGER version;
StringHandle inputDriverName PACKED_P;
StringHandle outputDriverName PACKED_P;
StringHandle name PACKED_P;
PACKED_MEMBER(StringHandle, inputDriverName);
PACKED_MEMBER(StringHandle, outputDriverName);
PACKED_MEMBER(StringHandle, name);
Handle deviceIcon ;
LONGINT ratedSpeed;
LONGINT maxSpeed;
Expand Down
Loading

0 comments on commit cb045f3

Please sign in to comment.