* (bug 3268) Replace Mac OS X Carbon API calls with native ones (thanks

to i3enedek).
* remove some spammy Mac OS X printf's regarding local network detection
* replaced a #warning for non-OS X PPC systems with a call to
  msync(..., MS_INVALIDATE).  This needs testing.
This commit is contained in:
Tony J. White = 2007-07-20 14:34:44 +00:00
parent f3e1a64c04
commit e8bbb1f2d1
4 changed files with 11 additions and 23 deletions

View file

@ -340,9 +340,6 @@ ifeq ($(PLATFORM),darwin)
ifeq ($(ARCH),ppc) ifeq ($(ARCH),ppc)
OPTIMIZE += -faltivec -O3 OPTIMIZE += -faltivec -O3
# Carbon is required on PPC only to make a call to MakeDataExecutable
# in the PPC vm (should be a better non-Carbon way).
LDFLAGS += -framework Carbon
endif endif
ifeq ($(ARCH),i386) ifeq ($(ARCH),i386)
OPTIMIZE += -march=prescott -mfpmath=sse OPTIMIZE += -march=prescott -mfpmath=sse

View file

@ -23,10 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// ppc dynamic compiler // ppc dynamic compiler
#include "vm_local.h" #include "vm_local.h"
#include <sys/mman.h>
#ifdef MACOS_X
#include <CoreServices/CoreServices.h>
#endif
#define DEBUG_VM 0 #define DEBUG_VM 0
@ -1725,12 +1722,8 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) {
// go back over it in place now to fixup reletive jump targets // go back over it in place now to fixup reletive jump targets
buf = (unsigned *)vm->codeBase; buf = (unsigned *)vm->codeBase;
} else if ( pass == 1 ) { } else if ( pass == 1 ) {
#ifdef MACOS_X // clear the instruction cache for generated code
// On Mac OS X, the following library routine clears the instruction cache for generated code msync(vm->codeBase, vm->codeLength, MS_INVALIDATE);
MakeDataExecutable(vm->codeBase, vm->codeLength);
#else
#warning Need to clear the instruction cache for generated code
#endif
} }
} }
if(0) if(0)

View file

@ -72,7 +72,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if idppc_altivec #if idppc_altivec
#ifdef MACOS_X #ifdef MACOS_X
#include <Carbon/Carbon.h> #include <sys/sysctl.h>
#endif #endif
#endif #endif
@ -383,11 +383,13 @@ qboolean Sys_DetectAltivec( void )
#if idppc_altivec #if idppc_altivec
#ifdef MACOS_X #ifdef MACOS_X
long feat = 0; int selectors[2] = { CTL_HW, HW_VECTORUNIT };
OSErr err = Gestalt(gestaltPowerPCProcessorFeatures, &feat); int hasVectorUnit = 0;
if ((err==noErr) && ((1 << gestaltPowerPCHasVectorInstructions) & feat)) { size_t length = sizeof(hasVectorUnit);
altivec = qtrue; int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
}
if( 0 == error )
altivec = (hasVectorUnit != 0);
#else #else
void (*handler)(int sig); void (*handler)(int sig);
handler = signal(SIGILL, illegal_instruction); handler = signal(SIGILL, illegal_instruction);

View file

@ -382,8 +382,6 @@ void NET_GetLocalAddress( void ) {
int interfaceSocket; int interfaceSocket;
int family; int family;
Com_Printf("NET_GetLocalAddress: Querying for network interfaces\n");
// Set this early so we can just return if there is an error // Set this early so we can just return if there is an error
numIP = 0; numIP = 0;
@ -405,7 +403,6 @@ void NET_GetLocalAddress( void ) {
return; return;
} }
linkInterface = (struct ifreq *) ifc.ifc_buf; linkInterface = (struct ifreq *) ifc.ifc_buf;
while ((char *) linkInterface < &ifc.ifc_buf[ifc.ifc_len]) { while ((char *) linkInterface < &ifc.ifc_buf[ifc.ifc_len]) {
unsigned int nameLength; unsigned int nameLength;
@ -469,7 +466,6 @@ void NET_GetLocalAddress( void ) {
} }
linkInterface = IFR_NEXT(linkInterface); linkInterface = IFR_NEXT(linkInterface);
} }
Com_Printf("NET_GetLocalAddress: DONE querying for network interfaces\n");
close(interfaceSocket); close(interfaceSocket);
} }