This now builds fine on darwin if you say make 9vx/9vx in vx32/src - vx32 - Local 9vx git repository for patches. (DIR) Log (DIR) Files (DIR) Refs --- (DIR) commit 4493abdf56ae497d8a3c79c136f7f56f0dd818b1 (DIR) parent bea13c27623fb389d20cb90d0e26fffb1da10534 (HTM) Author: rminnich@gmail.com <none@none> Date: Tue, 18 Jan 2011 18:31:25 -0800 This now builds fine on darwin if you say make 9vx/9vx in vx32/src Add oscmpswap -- builds will now break on Linux but that's because you have to fix it. Diffstat: src/9vx/Makefrag | 2 +- src/9vx/a/fns.h | 1 + src/9vx/main.c | 1 + src/9vx/osx/cmpswap.c | 9 +++++++++ src/Makefrag | 10 ++++++---- 5 files changed, 18 insertions(+), 5 deletions(-) --- (DIR) diff --git a/src/9vx/Makefrag b/src/9vx/Makefrag @@ -97,7 +97,7 @@ PLAN9_OBJS = \ ) ifeq ($(OS),darwin) -PLAN9_OBJS := $(PLAN9_OBJS) 9vx/osx/signal.o +PLAN9_OBJS := $(PLAN9_OBJS) 9vx/osx/signal.o 9vx/osx/cmpswap.o endif PLAN9_A_OBJS = \ (DIR) diff --git a/src/9vx/a/fns.h b/src/9vx/a/fns.h @@ -8,6 +8,7 @@ ulong cankaddr(ulong); void clockintr(Ureg*, void*); int (*cmpswap)(long*, long, long); int cmpswap486(long*, long, long); +int oscmpswap(long*, long, long); void (*coherence)(void); void cpuid(int, ulong regs[]); int cpuidentify(void); (DIR) diff --git a/src/9vx/main.c b/src/9vx/main.c @@ -88,6 +88,7 @@ main(int argc, char **argv) #endif setmach(&mach0); coherence = nop; + cmpswap = oscmpswap; quotefmtinstall(); cpulimit = 0; (DIR) diff --git a/src/9vx/osx/cmpswap.c b/src/9vx/osx/cmpswap.c @@ -0,0 +1,9 @@ +#include <libkern/OSAtomic.h> + +int +oscmpswap(long *addr, long oldValue, long newValue) +{ + if (OSAtomicCompareAndSwapLong(oldValue, newValue, addr)) + return 1; + return 0; +} (DIR) diff --git a/src/Makefrag b/src/Makefrag @@ -5,14 +5,14 @@ COMMON_CFLAGS = -g -O2 -MD -std=gnu99 -I. -fno-stack-protector $(CFLAGS) COMMON_LDFLAGS = -g -L. $(LDFLAGS) ifeq ($(OS),darwin) -COMMON_CFLAGS += -m32 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -DARCH=i386 -COMMON_LDFLAGS += -m32 + COMMON_CFLAGS += -m32 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -DARCH=i386 + COMMON_LDFLAGS += -m32 endif # Host environment compiler options HOST_CC := $(CC) -fno-inline ifeq ($(OS),darwin) - HOST_CC := $(HOST_CC) -D_XOPEN_SOURCE -arch i386 -m32 + HOST_CC := $(HOST_CC) -D_XOPEN_SOURCE -arch i386 -m32 -DARCH=i386 endif HOST_LD := $(LD) -arch i386 HOST_AR := $(AR) @@ -48,8 +48,10 @@ endif INSTALL = install +# there's only one thing we really care about. 9vx +9vx/9vx: # Make sure that 'all' is the first target -all: +all: # Install libvx32 too install: 9vx/install libvxc/install vxlinux/install vxrun/install