aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-07-20 14:34:44 +0000
committertjw <tjw@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-07-20 14:34:44 +0000
commitc7f082760f432b227277b4e1e39fc88c814d2dde (patch)
treeab4f5285a65a3148330bf71733fa850cac8e0974
parent3f0dc06cb4e223abe59708b278d188cbde505e60 (diff)
downloadioquake3-aero-c7f082760f432b227277b4e1e39fc88c814d2dde.tar.gz
ioquake3-aero-c7f082760f432b227277b4e1e39fc88c814d2dde.zip
* (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. git-svn-id: svn://svn.icculus.org/quake3/trunk@1118 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--Makefile3
-rw-r--r--code/qcommon/vm_ppc.c13
-rw-r--r--code/unix/unix_main.c14
-rw-r--r--code/unix/unix_net.c4
4 files changed, 11 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index e1a6904..55bebde 100644
--- a/Makefile
+++ b/Makefile
@@ -340,9 +340,6 @@ ifeq ($(PLATFORM),darwin)
ifeq ($(ARCH),ppc)
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
ifeq ($(ARCH),i386)
OPTIMIZE += -march=prescott -mfpmath=sse
diff --git a/code/qcommon/vm_ppc.c b/code/qcommon/vm_ppc.c
index f6fcc31..c0b1add 100644
--- a/code/qcommon/vm_ppc.c
+++ b/code/qcommon/vm_ppc.c
@@ -23,10 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// ppc dynamic compiler
#include "vm_local.h"
-
-#ifdef MACOS_X
-#include <CoreServices/CoreServices.h>
-#endif
+#include <sys/mman.h>
#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
buf = (unsigned *)vm->codeBase;
} else if ( pass == 1 ) {
- #ifdef MACOS_X
- // On Mac OS X, the following library routine clears the instruction cache for generated code
- MakeDataExecutable(vm->codeBase, vm->codeLength);
- #else
- #warning Need to clear the instruction cache for generated code
- #endif
+ // clear the instruction cache for generated code
+ msync(vm->codeBase, vm->codeLength, MS_INVALIDATE);
}
}
if(0)
diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c
index 7f4b65c..31521de 100644
--- a/code/unix/unix_main.c
+++ b/code/unix/unix_main.c
@@ -72,7 +72,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if idppc_altivec
#ifdef MACOS_X
- #include <Carbon/Carbon.h>
+ #include <sys/sysctl.h>
#endif
#endif
@@ -383,11 +383,13 @@ qboolean Sys_DetectAltivec( void )
#if idppc_altivec
#ifdef MACOS_X
- long feat = 0;
- OSErr err = Gestalt(gestaltPowerPCProcessorFeatures, &feat);
- if ((err==noErr) && ((1 << gestaltPowerPCHasVectorInstructions) & feat)) {
- altivec = qtrue;
- }
+ int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+ int hasVectorUnit = 0;
+ size_t length = sizeof(hasVectorUnit);
+ int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
+
+ if( 0 == error )
+ altivec = (hasVectorUnit != 0);
#else
void (*handler)(int sig);
handler = signal(SIGILL, illegal_instruction);
diff --git a/code/unix/unix_net.c b/code/unix/unix_net.c
index 13dc3fb..5fd1b0c 100644
--- a/code/unix/unix_net.c
+++ b/code/unix/unix_net.c
@@ -382,8 +382,6 @@ void NET_GetLocalAddress( void ) {
int interfaceSocket;
int family;
- Com_Printf("NET_GetLocalAddress: Querying for network interfaces\n");
-
// Set this early so we can just return if there is an error
numIP = 0;
@@ -405,7 +403,6 @@ void NET_GetLocalAddress( void ) {
return;
}
-
linkInterface = (struct ifreq *) ifc.ifc_buf;
while ((char *) linkInterface < &ifc.ifc_buf[ifc.ifc_len]) {
unsigned int nameLength;
@@ -469,7 +466,6 @@ void NET_GetLocalAddress( void ) {
}
linkInterface = IFR_NEXT(linkInterface);
}
- Com_Printf("NET_GetLocalAddress: DONE querying for network interfaces\n");
close(interfaceSocket);
}