r1118 - in trunk: . code/qcommon code/unix

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Jul 20 10:34:44 EDT 2007


Author: tjw
Date: 2007-07-20 10:34:44 -0400 (Fri, 20 Jul 2007)
New Revision: 1118

Modified:
   trunk/Makefile
   trunk/code/qcommon/vm_ppc.c
   trunk/code/unix/unix_main.c
   trunk/code/unix/unix_net.c
Log:
* (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.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2007-07-19 08:10:32 UTC (rev 1117)
+++ trunk/Makefile	2007-07-20 14:34:44 UTC (rev 1118)
@@ -340,9 +340,6 @@
 
   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

Modified: trunk/code/qcommon/vm_ppc.c
===================================================================
--- trunk/code/qcommon/vm_ppc.c	2007-07-19 08:10:32 UTC (rev 1117)
+++ trunk/code/qcommon/vm_ppc.c	2007-07-20 14:34:44 UTC (rev 1118)
@@ -23,11 +23,8 @@
 // ppc dynamic compiler
 
 #include "vm_local.h"
+#include <sys/mman.h>
 
-#ifdef MACOS_X
-#include <CoreServices/CoreServices.h>
-#endif
-
 #define DEBUG_VM 0
 
 #if DEBUG_VM
@@ -1725,12 +1722,8 @@
 	    // 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)

Modified: trunk/code/unix/unix_main.c
===================================================================
--- trunk/code/unix/unix_main.c	2007-07-19 08:10:32 UTC (rev 1117)
+++ trunk/code/unix/unix_main.c	2007-07-20 14:34:44 UTC (rev 1118)
@@ -72,7 +72,7 @@
 
 #if idppc_altivec
   #ifdef MACOS_X
-    #include <Carbon/Carbon.h>
+    #include <sys/sysctl.h>
   #endif
 #endif
 
@@ -383,11 +383,13 @@
 
 #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);

Modified: trunk/code/unix/unix_net.c
===================================================================
--- trunk/code/unix/unix_net.c	2007-07-19 08:10:32 UTC (rev 1117)
+++ trunk/code/unix/unix_net.c	2007-07-20 14:34:44 UTC (rev 1118)
@@ -382,8 +382,6 @@
         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 @@
             return;
         }
 
-
         linkInterface = (struct ifreq *) ifc.ifc_buf;
         while ((char *) linkInterface < &ifc.ifc_buf[ifc.ifc_len]) {
             unsigned int nameLength;
@@ -469,7 +466,6 @@
             }
             linkInterface = IFR_NEXT(linkInterface);
         }
-        Com_Printf("NET_GetLocalAddress: DONE querying for network interfaces\n");
 
         close(interfaceSocket);
 }




More information about the quake3-commits mailing list