Index: /trunk/ccl/lisp-kernel/lisptypes.h
===================================================================
--- /trunk/ccl/lisp-kernel/lisptypes.h	(revision 5280)
+++ /trunk/ccl/lisp-kernel/lisptypes.h	(revision 5281)
@@ -64,15 +64,23 @@
 
 
-#if defined(DARWIN)
+#ifdef DARWIN
+#include <sys/ucontext.h>
+
+#ifdef PPC
 #if WORD_SIZE == 64
 #ifdef _STRUCT_UCONTEXT64
-typdef _STRUCT_UCONTEXT64 ExceptionInformation;
-#else
+typedef _STRUCT_UCONTEXT64 ExceptionInformation;
+#else /* _STRUCT_UCONTEXT64 */
 typedef struct ucontext64 ExceptionInformation;
-#endif
+#endif /* _STRUCT_UCONTEXT64 */
 #define UC_MCONTEXT(UC) UC->uc_mcontext64
+#else /* WORD_SIZE */
+typedef struct ucontext ExceptionInformation;
+#define UC_MCONTEXT(UC) UC->uc_mcontext
+#endif /* WORD_SIZE */
+#endif /* PPC */
+
 #ifdef X8664
 /* Broken <i386/ucontext.h> in xcode 2.4 */
-#include <sys/ucontext.h>
 #ifndef _STRUCT_MCONTEXT64 /* A guess at what'll be defined when this is fixed */
 struct mcontext64 {
@@ -81,22 +89,21 @@
 	x86_float_state64_t	fs;
 };
-#endif
-#endif
-#else
-typedef struct ucontext ExceptionInformation;
+#endif /* _STRUCT_MCONTEXT64 */
+typedef ucontext_t ExceptionInformation;
 #define UC_MCONTEXT(UC) UC->uc_mcontext
-#endif
-#else  /* #ifdef DARWIN */
+#endif /* X86_64 */
+#endif /* #ifdef DARWIN */
+
 #ifdef LINUX
 typedef struct ucontext ExceptionInformation;
 #endif
+
 #ifdef FREEBSD
 typedef struct __ucontext ExceptionInformation;
 #endif
+
 #ifdef SOLARIS
 typedef struct ucontext ExceptionInformation;
 #endif
-#define UC_MCONTEXT(UC) UC->uc_mcontext
-#endif /* #ifdef DARWIN */
 
 typedef u32_t lisp_char_code;
Index: /trunk/ccl/lisp-kernel/pmcl-kernel.c
===================================================================
--- /trunk/ccl/lisp-kernel/pmcl-kernel.c	(revision 5280)
+++ /trunk/ccl/lisp-kernel/pmcl-kernel.c	(revision 5281)
@@ -556,5 +556,5 @@
   mach_msg_type_number_t vm_info_size = VM_REGION_BASIC_INFO_COUNT;
 #endif
-  port_t vm_object_name = (port_t) 0;
+  mach_port_t vm_object_name = (mach_port_t) 0;
   kern_return_t kret;
 
Index: /trunk/ccl/lisp-kernel/x86-exceptions.c
===================================================================
--- /trunk/ccl/lisp-kernel/x86-exceptions.c	(revision 5280)
+++ /trunk/ccl/lisp-kernel/x86-exceptions.c	(revision 5281)
@@ -619,5 +619,10 @@
 {
   if (info->si_code == EXC_I386_SSEEXTERR) {
+#ifdef _STRUCT_MCONTEXT64
+    uint32_t mxcsr = UC_MCONTEXT(xp)->__fs.__fpu_mxcsr;
+#else
     uint32_t mxcsr = UC_MCONTEXT(xp)->fs.fpu_mxcsr;
+#endif
+
 
     decode_vector_fp_exception(info, mxcsr);
@@ -890,10 +895,10 @@
 #ifdef DARWIN
 LispObj *
-copy_darwin_mcontext(struct mcontext64 *context, 
+copy_darwin_mcontext(mcontext_t context, 
                      LispObj *current, 
-                     struct mcontext64 **out)
-{
-  struct mcontext64 *dest = ((struct mcontext64 *)current)-1;
-  dest = (struct mcontext64 *) (((LispObj)dest) & ~15);
+                     mcontext_t *out)
+{
+  mcontext_t dest = ((mcontext_t)current)-1;
+  dest = (mcontext_t) (((LispObj)dest) & ~15);
 
   *dest = *context;
@@ -1063,5 +1068,5 @@
 #endif
 #ifdef DARWIN
-  struct mcontext64 *mcontextp = NULL;
+  mcontext_t mcontextp = NULL;
 #endif
   siginfo_t *info_copy = NULL;
@@ -1155,5 +1160,5 @@
 #endif
 #ifdef DARWIN
-  struct mcontext64 *mcontextp = NULL;
+  mcontext_t mcontextp = NULL;
 #endif
 
@@ -1715,5 +1720,5 @@
   kern_return_t kret;
 #if WORD_SIZE == 64
-  struct mcontext64 *mc = UC_MCONTEXT(pseudosigcontext);
+  mcontext_t mc = UC_MCONTEXT(pseudosigcontext);
 #else
   struct mcontext * mc = UC_MCONTEXT(pseudosigcontext);
@@ -1723,5 +1728,5 @@
   kret = thread_set_state(thread,
                           x86_FLOAT_STATE64,
-                          (thread_state_t)&(mc->fs),
+                          (thread_state_t)&(mc->__fs),
                           x86_FLOAT_STATE64_COUNT);
 
@@ -1732,10 +1737,10 @@
   kret = thread_set_state(thread,
                           x86_THREAD_STATE64,
-                          (thread_state_t)&(mc->ss),
+                          (thread_state_t)&(mc->__ss),
                           x86_THREAD_STATE64_COUNT);
 #else
   kret = thread_set_state(thread, 
                           x86_THREAD_STATE32,
-                          (thread_state_t)&(mc->ss),
+                          (thread_state_t)&(mc->__ss),
                           x86_THREAD_STATE32_COUNT);
 #endif
@@ -1793,5 +1798,5 @@
   ExceptionInformation *pseudosigcontext;
 #ifdef X8664
-  struct mcontext64 *mc;
+  mcontext_t mc;
 #else
   struct mcontext *mc;
@@ -1800,5 +1805,5 @@
 
   
-  stackp = (LispObj) find_foreign_rsp(ts->rsp,tcr->cs_area,tcr);
+  stackp = (LispObj) find_foreign_rsp(ts->__rsp,tcr->cs_area,tcr);
   stackp = TRUNC_DOWN(stackp, C_REDZONE_LEN, C_STK_ALIGN);
   stackp = TRUNC_DOWN(stackp, sizeof(siginfo_t), C_STK_ALIGN);
@@ -1811,15 +1816,15 @@
   stackp = TRUNC_DOWN(stackp, sizeof(*mc), C_STK_ALIGN);
 #ifdef X8664
-  mc = (struct mcontext64 *) ptr_from_lispobj(stackp);
+  mc = (mcontext_t) ptr_from_lispobj(stackp);
 #else
   mc = (struct mcontext *) ptr_from_lispobj(stackp);
 #endif
   
-  bcopy(ts,&(mc->ss),sizeof(*ts));
+  bcopy(ts,&(mc->__ss),sizeof(*ts));
 
   thread_state_count = x86_FLOAT_STATE64_COUNT;
   thread_get_state(thread,
 		   x86_FLOAT_STATE64,
-		   (thread_state_t)&(mc->fs),
+		   (thread_state_t)&(mc->__fs),
 		   &thread_state_count);
 
@@ -1836,5 +1841,5 @@
 		   x86_EXCEPTION_STATE,
 #endif
-		   (thread_state_t)&(mc->es),
+		   (thread_state_t)&(mc->__es),
 		   &thread_state_count);
 
@@ -1894,5 +1899,5 @@
   bzero(info, sizeof(*info));
   info->si_code = code;
-  info->si_addr = (void *)(UC_MCONTEXT(pseudosigcontext)->es.faultvaddr);
+  info->si_addr = (void *)(UC_MCONTEXT(pseudosigcontext)->__es.__faultvaddr);
   info->si_signo = signum;
   pseudosigcontext->uc_onstack = 0;
@@ -1908,13 +1913,13 @@
   */
 
-  new_ts.rip = (natural) handler_address;
+  new_ts.__rip = (natural) handler_address;
   stackpp = (natural *)stackp;
   *--stackpp = (natural)pseudo_sigreturn;
   stackp = (natural)stackpp;
-  new_ts.rdi = signum;
-  new_ts.rsi = (natural)info;
-  new_ts.rdx = (natural)pseudosigcontext;
-  new_ts.rcx = (natural)tcr;
-  new_ts.rsp = stackp;
+  new_ts.__rdi = signum;
+  new_ts.__rsi = (natural)info;
+  new_ts.__rdx = (natural)pseudosigcontext;
+  new_ts.__rcx = (natural)tcr;
+  new_ts.__rsp = stackp;
 
 
@@ -1967,5 +1972,5 @@
 
 #ifdef X8664
-#define ts_pc(t) t.rip
+#define ts_pc(t) t.__rip
 #else
 #define ts_pc(t) t.eip
Index: /trunk/ccl/lisp-kernel/x86-exceptions.h
===================================================================
--- /trunk/ccl/lisp-kernel/x86-exceptions.h	(revision 5280)
+++ /trunk/ccl/lisp-kernel/x86-exceptions.h	(revision 5281)
@@ -31,9 +31,17 @@
 #define DarwinSigReturn(context) syscall(SYS_sigreturn,context)
 #ifdef X8664
+#ifdef _STRUCT_MCONTEXT64
+#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss.__rax)))
+#else
 #define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->ss.rax)))
+#endif
 #define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
 #define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
 #define xpPC(x) (xpGPR(x,Iip))
+#ifdef _STRUCT_MCONTEXT64
+#define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__fs.__fpu_stmm0)))
+#else
 #define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->fs.fp_stmm0)))
+#endif
 #define xpMMXreg(x,n)  (xpFPRvector(x)[gprno])
 #endif
