Skip to contentSkip to conversation

Mac OS X generic support v2

PATCH New Alexander Graf 1 participant 1 message Feb 5, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 Mac OS X generic support v2

This patch implements Mac OS X specific parts that are necessary to get i386 and x86_64 versions of qemu working. Since both hosts need this patch, I seperated it from the architecture specific ones.

It does:

- not force always_inline
- only define [u]intXX types if they are not already defined
- nullify spin-functions using #define instead of inline function
- include osdep.h in host-utils

host-utils.h renamed from host-utils.h.orig +2 -0
Index: host-utils.h
===================================================================
@@ -23,6 +23,8 @@
  * THE SOFTWARE.
  */
 
+#include "osdep.h"
+
 #if defined(__x86_64__)
 #define __HAVE_FAST_MULU64__
 static always_inline void mulu64 (uint64_t *plow, uint64_t *phigh,
osdep.h renamed from osdep.h.orig +2 -0
Index: osdep.h
===================================================================
@@ -33,7 +33,9 @@
 #define always_inline __attribute__ (( always_inline )) __inline__
 #endif
 #endif
+#if !defined(__APPLE__)
 #define inline always_inline
+#endif
 
 #ifdef __i386__
 #define REGPARM __attribute((regparm(3)))
softfloat.h renamed from softfloat.h.orig +6 -0
Index: fpu/softfloat.h
===================================================================
@@ -50,11 +50,17 @@
 typedef uint8_t flag;
 typedef uint8_t uint8;
 typedef int8_t int8;
+#ifndef _UINT16
 typedef int uint16;
+#endif
 typedef int int16;
+#ifndef _UINT32
 typedef unsigned int uint32;
+#endif
 typedef signed int int32;
+#ifndef _UINT64
 typedef uint64_t uint64;
+#endif
 typedef int64_t int64;
 
 /*----------------------------------------------------------------------------
exec-all.h renamed from exec-all.h.orig +7 -0
Index: exec-all.h
===================================================================
@@ -448,6 +448,12 @@
     return !testandset(lock);
 }
 #else
+/* On Darwin the compiler tries to be smart about spinlocking functions and replaces them itself */
+#ifdef __APPLE__
+#define spin_lock(x)
+#define spin_unlock(x)
+#define spin_trylock(x)
+#else
 static inline void spin_lock(spinlock_t *lock)
 {
 }
@@ -461,6 +467,7 @@
     return 1;
 }
 #endif
+#endif
 
 extern spinlock_t tb_lock;