summaryrefslogtreecommitdiff
path: root/src/qcommon
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon')
-rw-r--r--src/qcommon/common.c5
-rw-r--r--src/qcommon/vm_ppc_new.c13
-rw-r--r--src/qcommon/vm_x86.c16
3 files changed, 23 insertions, 11 deletions
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index 68a750c2..a0a66ae7 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -41,9 +41,10 @@ int demo_protocols[] =
#define MIN_COMHUNKMEGS 128
#define DEF_COMHUNKMEGS 128
#define DEF_COMZONEMEGS 24
+#define XSTRING(x) STRING(x)
#define STRING(x) #x
-#define DEF_COMHUNKMEGS_S STRING(DEF_COMHUNKMEGS)
-#define DEF_COMZONEMEGS_S STRING(DEF_COMZONEMEGS)
+#define DEF_COMHUNKMEGS_S XSTRING(DEF_COMHUNKMEGS)
+#define DEF_COMZONEMEGS_S XSTRING(DEF_COMZONEMEGS)
int com_argc;
char *com_argv[MAX_NUM_ARGVS+1];
diff --git a/src/qcommon/vm_ppc_new.c b/src/qcommon/vm_ppc_new.c
index 6d71d2c4..42a03a50 100644
--- a/src/qcommon/vm_ppc_new.c
+++ b/src/qcommon/vm_ppc_new.c
@@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "vm_local.h"
+#ifdef MACOS_X
+#include <CoreServices/CoreServices.h>
+#endif
+
#define DEBUG_VM 0
#if DEBUG_VM
@@ -1715,7 +1719,14 @@ 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
+ }
}
if(0)
{
diff --git a/src/qcommon/vm_x86.c b/src/qcommon/vm_x86.c
index 617c4ac4..c387c216 100644
--- a/src/qcommon/vm_x86.c
+++ b/src/qcommon/vm_x86.c
@@ -171,7 +171,7 @@ _asm {
#else //!_MSC_VER
-#ifdef __MINGW32__ // _ is prepended to compiled symbols
+#if defined(__MINGW32__) || defined(MACOS_X) // _ is prepended to compiled symbols
#define CMANG(sym) "_"#sym
#else
#define CMANG(sym) #sym
@@ -1175,13 +1175,13 @@ int VM_CallCompiled( vm_t *vm, int *args ) {
memOpStack = opStack;
memEntryPoint = entryPoint;
- __asm__(" pushal \r\n" \
- " movl %0,%%esi \r\n" \
- " movl %1,%%edi \r\n" \
- " call *%2 \r\n" \
- " movl %%esi,%0 \r\n" \
- " movl %%edi,%1 \r\n" \
- " popal \r\n" \
+ __asm__(" pushal \n" \
+ " movl %0,%%esi \n" \
+ " movl %1,%%edi \n" \
+ " call *%2 \n" \
+ " movl %%esi,%0 \n" \
+ " movl %%edi,%1 \n" \
+ " popal \n" \
: "=m" (memProgramStack), "=m" (memOpStack) \
: "m" (memEntryPoint), "m" (memProgramStack), "m" (memOpStack) \
: "si", "di" \