Compiles and links for Mac OS X on powerpc. Doesn't run though, trouble with size of packed structures (e.g. fcbrec).

This commit is contained in:
Clifford T. Matthews 2009-06-15 13:27:02 -06:00
parent 0d607a5353
commit e334463d06
22 changed files with 107 additions and 50 deletions

View File

@ -1,13 +1,11 @@
/* Copyright 2000 by Abacus Research and
* Development, Inc. All rights reserved.
*/
#if defined (CFM_PROBLEMS)
#if defined (powerpc)
#warning "No CFM support for now, even though it limped previously."
#if !defined (OMIT_RCSID_STRINGS)
char ROMlib_rcsid_cfm[] =
"$Id: cfm.c 63 2004-12-24 18:19:43Z ctm $";
#endif
#elif defined (powerpc)
/*
* In addition to fleshing this out, it probably makes sense to use mmap
@ -1042,7 +1040,7 @@ load_loader_section (const void *addr,
memset (&init_block, 0xFA, sizeof init_block);
init_routine = (uint32 (*)(uint32)) SYN68K_TO_US (init_addr[0]);
init_toc = (uint32) SYN68K_TO_US (init_addr[1]);
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
retval = ppc_call (init_toc, init_routine, (uint32) &init_block);
#else
warning_unexpected (NULL_STRING);
@ -1159,7 +1157,7 @@ typedef enum { ICACHE } flush_type_t;
PRIVATE void
cacheflush (void *start, uint32 length, flush_type_t flush)
{
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
enum { CACHE_LINE_SIZE = 32, };
char *p, *ep;

View File

@ -13,5 +13,18 @@
extern uint32 ppc_call (uint32 toc, uint32 (*func)(uint32), uint32 arg);
/*
* Using __ppc__ to detect that we're going to have problems with the
* Code Fragment Manager is a "short-term" (heh!) hack to allow us to
* build the Mac OS X PPC version before switching to the GNU Build
* system where we can either use configure to figure out if cfm.c
* will build or have the free time (right!) to figure out what needs
* to be done to get cfm.c "working" again.
*/
#if defined(__ppc__)
# define CFM_PROBLEMS
#endif
#endif /* !_ARCH_POWERPC_H_ */

View File

@ -9,5 +9,15 @@ TARGET_CFLAGS += -D_GNU_SOURCE
# ppc_call.o: ppc_call.c
# $(TARGET_GCC) $(TARGET_CFLAGS) -mcall-aix -c $<
# -mcall-aix was used when we were compiling on Linux and experimenting with
# running powerpc code using a native powerpc processor. The ability to run
# native powerpc code is not likely to work (initially) under the Mac OS X
# port.
ifeq (,$(findstring macosx,$(TARGET)))
CALL_AIX_FLAG = -mcall-aix
endif
ppc_stubs.o: ppc_stubs.c ppc_stubs.h
$(TARGET_GCC) $(TARGET_CFLAGS) -mcall-aix -c $<
$(TARGET_GCC) $(TARGET_CFLAGS) $(CALL_AIX_FLAG) -c $<

View File

@ -19,7 +19,7 @@ char ROMlib_rcsid_sdlwin[] = "$Id: sdlwin.c 63 2004-12-24 18:19:43Z ctm $";
#include "sdlevents.h"
#include "syswm_map.h"
#if defined (linux) && !defined (powerpc)
#if defined (linux) && !defined (powerpc) && !defined (__ppc__)
#define USE_SDL_EVENT_THREAD
#include "sdlX.h"
#endif

View File

@ -36,9 +36,6 @@ static int num_samples;
#define BUFSIZE (1 << (LOGBUFSIZE+1)) /* +1 as bug workaround */
/* Stack size for child thread */
#define STACKSIZE 16384
static int semid = -1; /* Semaphore id */
static int sound_on = 0; /* 1 if we are generating interrupts */
static boolean_t have_sound_p; /* TRUE if sound is supported */

View File

@ -3047,7 +3047,11 @@ STUB (QuickTime)
NULL, QuickTime);
}
#if defined (powerpc)
#if defined (__ppc__)
#warning "Need to get CFM going before we can enable this glue."
#elif defined (powerpc)
/*
* modeswitch is special; we don't return to from where we came.

View File

@ -42,7 +42,7 @@ PUBLIC syn68k_addr_t PascalToCCall(syn68k_addr_t ignoreme, ptocblock_t *infop)
{
unsigned short pth, ptv;
LONGINT args[11], retval;
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
Point points[11];
int point_count = 0;
#endif
@ -94,7 +94,7 @@ PUBLIC syn68k_addr_t PascalToCCall(syn68k_addr_t ignoreme, ptocblock_t *infop)
ptv = POPSW();
pth = POPSW();
#if !defined(LITTLEENDIAN)
#if !defined (powerpc)
#if !defined (powerpc) && !defined (__ppc__)
args[count++] = (ptv << 16) | pth;
#else
points[point_count].h = pth;
@ -221,7 +221,7 @@ CToPascalCall_m68k(void *wheretogo, unsigned long long magic, va_list ap)
case 3:
ul = va_arg(ap, ULONGINT);
#if !defined(LITTLEENDIAN)
#if !defined (powerpc)
#if !defined (powerpc) && !defined (__ppc__)
PUSHUW(ul);
PUSHUW(ul >> 16);
#else
@ -277,7 +277,7 @@ CToPascalCall_m68k(void *wheretogo, unsigned long long magic, va_list ap)
return retval;
}
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
PRIVATE long
CToRoutineDescriptorCall (const RoutineDescriptor *p, unsigned long long magic,
@ -344,7 +344,7 @@ CToRoutineDescriptorCall (const RoutineDescriptor *p, unsigned long long magic,
case 3: /* point */
{
arg = (uint32) va_arg (ap, unsigned long);
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
arg = *(uint32 *)arg;
#endif
arg = (CW ((uint16) arg) |
@ -483,7 +483,7 @@ PUBLIC long CToPascalCall(void *wheretogo, unsigned long magic_in, ...)
}
va_start(ap, magic_in);
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
if (is_routine_descriptor_ptr (wheretogo))
retval = CToRoutineDescriptorCall ((RoutineDescriptor *) wheretogo,
magic, ap);

View File

@ -676,7 +676,7 @@ toolstuff_t toolstuff[0x400] = {
{ { _Unimplemented, -1 }, (void *) 0 },
{ { _Unimplemented, -1 }, (void *) 0 },
{ { _Unimplemented, -1 }, (void *) 0 },
#if !defined (powerpc)
#if (!defined (powerpc) && !defined (__ppc__)) || defined (CFM_PROBLEMS)
{ { _Unimplemented, -1 }, (void *) 0 },
{ { _Unimplemented, -1 }, (void *) 0 }, /* AA5A */
#else
@ -846,7 +846,7 @@ toolstuff_t toolstuff[0x400] = {
{ { _Unimplemented, -1 }, (void *) 0 },
{ { _Unimplemented, -1 }, (void *) 0 },
{ { _Unimplemented, -1 }, (void *) 0 },
#if defined (powerpc)
#if defined (powerpc) && !defined (__ppc__)
{ { _modeswitch, -1 }, (void *) 0 },
#else
{ { _Unimplemented, -1 }, (void *) 0 },
@ -1194,7 +1194,7 @@ toolstuff_t pstuff[] = {
{ { _Key1Trans, -1 }, (void *) 0},
{ { _Key2Trans, -1 }, (void *) 0},
{ { NULL /* was C_ROMlib_licensefilt */, NULL /* was PTOC_ROMlib_licensefilt */ }, (void *) 0 },
{ { NULL /* was C_ROMlib_licensefilt */, 0 /* was PTOC_ROMlib_licensefilt */ }, (void *) 0 },
{ { C_unixmount, PTOC_unixmount }, (void *) 0 },
{ { C_GestaltTablesOnly, PTOC_GestaltTablesOnly }, (void *) 0 },
{ { C_sound_timer_handler, 0 }, (void *) 0 },

View File

@ -303,7 +303,7 @@ P_SAVED0D1A0A1_2 (PUBLIC pascal trap, void, ROMlib_Fsetenv, INTEGER *,
asm ("fldenv %0" : : "m" (i387_env));
}
#endif
#elif defined(__alpha) || defined (powerpc)
#elif defined(__alpha) || defined (powerpc) || defined (__ppc__)
#warning ROMlib_Fsetenv not implemented!
signal(SIGFPE, SIG_IGN);
#else
@ -382,7 +382,7 @@ P_SAVED0D1A0A1_2 (PUBLIC pascal trap, void, ROMlib_Fgetenv, INTEGER *,
else
env |= PRECISION_MODE_HIGH_BIT;
#elif defined(__alpha) || defined(powerpc)
#elif defined(__alpha) || defined(powerpc) || defined (__ppc__)
#warning ROMlib_Fgetenv not properly implemented!
env = 0;
#else

View File

@ -127,7 +127,7 @@ PRIVATE gestaltentry_t gtable[] = {
different info on 030*/ },
#endif
#if defined (powerpc)
#if defined (powerpc) || defined(__ppc__)
{ gestaltNativeCPUtype, gestaltCPU750, },
{ gestaltMachineType, gestaltMacQuadra610, }, /* change this */
@ -349,7 +349,7 @@ gestalt_set_physical_gestalt_callback (void)
(long) US_TO_SYN68K (P_PhysicalGestalt), gtable);
}
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
PUBLIC void
gestalt_set_cpu_type (uint32 type)
{

View File

@ -23,6 +23,12 @@
#include <string.h>
#include "rsys/float.h"
/*
* Unlike most of the rest of Executor's source, we're not using __ppc__
* in our tests below, because the code involved won't compile on Mac OS X
* 10.5.7, with gcc 4.0.1.
*/
#if defined (powerpc)
#include <ieee754.h>
#endif

View File

@ -390,7 +390,7 @@ cfm_launch (Handle cfrg0, OSType desired_arch, FSSpecPtr fsp)
--n_descripts, cfirp = (cfir_t *) ((char *) cfirp + CFIR_LENGTH(cfirp)))
;
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
if (CFIR_ISA_X(cfirp) == desired_arch_x)
{
Ptr mainAddr;

View File

@ -8,7 +8,7 @@
#define MIN_SYSZONE_SIZE (128 * 1024)
#define MAX_SYSZONE_SIZE (2047 * 1024 * 1024)
#if !defined (powerpc)
#if !defined (powerpc) && !defined (__ppc__)
#define DEFAULT_SYSZONE_SIZE (512 * 1024)
#else

View File

@ -2,7 +2,7 @@
* Development, Inc. All rights reserved.
*/
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
#if !defined (OMIT_RCSID_STRINGS)
char ROMlib_rcsid_interfacelib[] =
@ -2881,7 +2881,9 @@ interfacelib_map[] =
{ "DisposeHandle", DisposHandle, },
{ "UpdateDialog", C_UpdtDialog, },
{ "TestDeviceAttribute", C_TestDeviceAttribute, },
#if !defined (CFM_PROBLEMS)
{ "CloseConnection", C_CloseConnection, },
#endif
{ "GetControlReference", C_GetCRefCon, },
{ "RemoveResource", C_RmveResource, },
{ "EndUpdate", C_EndUpdate, },
@ -3018,7 +3020,9 @@ interfacelib_map[] =
// { "FSRead", C_FSRead, },
{ "SelectDialogItemText", C_SelIText, },
{ "GetIndResource", C_GetIndResource, },
#if !defined (CFM_PROBLEMS)
{ "GetSharedLibrary", C_GetSharedLibrary, },
#endif
// { "SetEOF", C_SetEOF, },
{ "SystemZone", SystemZone, },
{ "GetWMgrPort", C_GetWMgrPort, },
@ -3440,7 +3444,9 @@ interfacelib_map[] =
{ "LwrText", LowerText_stub, },
{ "FracSqrt", C_FracSqrt, },
{ "GetDefFontSize", GetDefFontSize, },
#if !defined(CFM_PROBLEMS)
{ "GetDiskFragment", C_GetDiskFragment, },
#endif
{ "InvalRgn", C_InvalRgn, },
{ "CloseWindow", C_CloseWindow, },
{ "ShieldCursor", ShieldCursor_PC, },
@ -3688,7 +3694,9 @@ interfacelib_map[] =
{ "LMSetGrayRgn", LMSetGrayRgn, },
{ "GDeviceChanged", C_GDeviceChanged, },
{ "HSV2RGB", C_HSV2RGB, },
#if !defined (CFM_PROBLEMS)
{ "GetMemFragment", C_GetMemFragment, },
#endif
// { "GetComponentVersion", C_GetComponentVersion, },
{ "EraseOval", C_EraseOval, },
{ "GetPattern", C_GetPattern, },
@ -4224,8 +4232,13 @@ ROMlib_GetInterfaceLib (Str63 library, OSType arch, LoadFlags loadflags,
}
else
{
#if !defined (CFM_PROBLEMS)
cid = ROMlib_new_connection (1);
if (!cidp)
#else
#warning "Can't do the right thing without CFM"
cid = 0;
#endif
if (!cid)
retval = fragNoMem;
else
{

View File

@ -440,7 +440,7 @@ cfm_launch (Handle cfrg0, OSType desired_arch, FSSpecPtr fsp)
cfirp = ROMlib_find_cfrg (cfrg0, desired_arch, kApplicationCFrag,
(StringPtr) "");
#if defined (powerpc)
#if (defined (powerpc) || defined (__ppc__)) && !defined (CFM_PROBLEMS)
if (cfirp)
{
Ptr mainAddr;

View File

@ -434,7 +434,7 @@ capable of color.",
"your system.",
opt_no_arg, NULL },
#if defined (RELEASE_INTERNAL) || defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
{ "ppc", "try to execute the PPC native code if possible (UNSUPPORTED)", opt_no_arg, NULL },
#endif

View File

@ -2,7 +2,7 @@
* Development, Inc. All rights reserved.
*/
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
#if !defined (OMIT_RCSID_STRINGS)
char ROMlib_rcsid_mathlib[] =
@ -380,8 +380,13 @@ ROMlib_GetMathLib (Str63 library, OSType arch, LoadFlags loadflags,
}
else
{
#if !defined (CFM_PROBLEMS)
cid = ROMlib_new_connection (1);
if (!cidp)
#else
#warning "Will not work until CFM is viable"
cid = 0;
#endif
if (!cid)
retval = fragNoMem;
else
{

View File

@ -2,7 +2,7 @@
* Development, Inc. All rights reserved.
*/
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
#if !defined (OMIT_RCSID_STRINGS)
char ROMlib_rcsid_mixed_mode[] =

View File

@ -2,11 +2,6 @@
* Development, Inc. All rights reserved.
*/
/* #if !defined (OMIT_RCSID_STRINGS)
char ROMlib_rcsid_mkvol_h[] =
"$Id: mkvol_internal.h 63 2004-12-24 18:19:43Z ctm $";
#endif */
#include <stdio.h>
#include <time.h>
#include <assert.h>
@ -20,7 +15,7 @@ char ROMlib_rcsid_mkvol_h[] =
#if defined(__alpha) || defined(i386) || defined(__BORLANDC__)
#define LITTLEENDIAN
#elif defined(mc68000) || defined (powerpc)
#elif defined(mc68000) || defined (powerpc) || defined (__ppc__)
#else
#error "I don't know enough about this machine"
#endif

View File

@ -103,7 +103,7 @@ guess_good_memory_settings (void)
new_appl_size = physical_memory () / 4;
#if defined (powerpc)
#if defined (powerpc) || defined (__ppc__)
/* This hack prevents Photoshop 5.5 demo from complaining that we don't
have enough memory when we run on a 64 MB Linux machine. Our division
@ -211,10 +211,6 @@ ROMlib_launch_native_app (int n_filenames, char **filenames)
return 0;
}
#if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && ((__GNUC__ == 2 && __GNUC_MINOR__ == 7 && defined (__i386__)) || defined (RELEASE_INTERNAL) || defined (powerpc) || defined (__alpha)))
#warning THIS IS NOT A PRODUCTION BUILD
#endif
/*
* There is a very bad problem associated with the use of the db
* shared libraries under Linux. Specifically, the calling convention
@ -306,7 +302,7 @@ mmap_lowglobals (void)
#if !defined (MACOSX)
#if !defined (powerpc)
#if !defined (powerpc) && !defined (__ppc__)
PRIVATE caddr_t
round_up_to_page_size (unsigned long addr)
{
@ -412,7 +408,7 @@ mmap_permanent_memory (unsigned long amount_wanted)
/ (1024 * 1024) * (1024 * 1024));
}
#if !defined (powerpc)
#if !defined (powerpc) && !defined (__ppc__)
{
caddr_t addr_wanted;

View File

@ -228,7 +228,7 @@ Executor may die without warning because of this mismatch", 0,
0, "OK", NULL, NULL, NULL, NULL, NULL);
break;
case launch_ppc_only:
#if !defined (powerpc)
#if !defined (powerpc) && !defined (__ppc__)
system_error ("That application is PowerPC-only. This version of "
"Executor doesn't run PowerPC applications. "
"You need to find an M68k version of that application.",

View File

@ -225,6 +225,16 @@ case ${canonical_target} in
fi
;;
powerpc-unknown-macosx)
target_os='macosx'
target_syn68k='macosx'
target_arch='powerpc' # how we refer to it
target_gcc_arch='ppc' # how gcc -arch wants us to call it
if [ x"${target_file_format}" = x"" ]; then
# default linux file format; this may change
target_file_format='mach-o'
fi
;;
*)
echo "Fatal error: unknown target \`${canonical_target}'. Exiting."
@ -267,6 +277,12 @@ case ${canonical_host} in
objc='yes'
;;
powerpc-unknown-macosx)
host_os='macosx'
host_arch='powerpc'
objc='yes'
;;
*)
echo "Fatal error: unknown host \`${canonical_host}'. Exiting."
exit 1
@ -496,6 +512,10 @@ ${util_dir}/subst.pl \
@sound_make@:${sound_make} \
@executor_make@:${executor_make} < ${root}/src/config/Makefile.in > ./tmp-Makefile.in
if [ x"${target_gcc_arch}" = x"" ]; then
target_gcc_arch = "$target_arch"
fi
sed -e "s:@symbol_prefix@:${symbol_prefix}:g
s:@target@:${target}:g
@ -520,7 +540,7 @@ sed -e "s:@symbol_prefix@:${symbol_prefix}:g
s:@syn68k_target@:${syn68k_target}:g
s:@cflags@:${cflags}:g
s:@egcs_dcconvert_workaround@:${egcs_dcconvert_workaround}:g
s:@arch@:${target_arch}:g" < ./tmp-Makefile.in > ./Makefile
s:@arch@:${target_gcc_arch}:g" < ./tmp-Makefile.in > ./Makefile
rm -f ./tmp-Makefile.in
if [ x"${syn68k}" = x"yes" ]; then