Changeset 5281


Ignore:
Timestamp:
Oct 2, 2006, 1:33:40 AM (18 years ago)
Author:
Gary Byers
Message:

Change things so that they compile for x86-64 on systems later than 10.4.
Almost certainly break 10.4 compilation in the process.
(Thanks, Apple! Any time I can cause you to waste hours on crap like
this, just let me know!)

Location:
trunk/ccl/lisp-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/lisptypes.h

    r5239 r5281  
    6464
    6565
    66 #if defined(DARWIN)
     66#ifdef DARWIN
     67#include <sys/ucontext.h>
     68
     69#ifdef PPC
    6770#if WORD_SIZE == 64
    6871#ifdef _STRUCT_UCONTEXT64
    69 typdef _STRUCT_UCONTEXT64 ExceptionInformation;
    70 #else
     72typedef _STRUCT_UCONTEXT64 ExceptionInformation;
     73#else /* _STRUCT_UCONTEXT64 */
    7174typedef struct ucontext64 ExceptionInformation;
    72 #endif
     75#endif /* _STRUCT_UCONTEXT64 */
    7376#define UC_MCONTEXT(UC) UC->uc_mcontext64
     77#else /* WORD_SIZE */
     78typedef struct ucontext ExceptionInformation;
     79#define UC_MCONTEXT(UC) UC->uc_mcontext
     80#endif /* WORD_SIZE */
     81#endif /* PPC */
     82
    7483#ifdef X8664
    7584/* Broken <i386/ucontext.h> in xcode 2.4 */
    76 #include <sys/ucontext.h>
    7785#ifndef _STRUCT_MCONTEXT64 /* A guess at what'll be defined when this is fixed */
    7886struct mcontext64 {
     
    8189        x86_float_state64_t     fs;
    8290};
    83 #endif
    84 #endif
    85 #else
    86 typedef struct ucontext ExceptionInformation;
     91#endif /* _STRUCT_MCONTEXT64 */
     92typedef ucontext_t ExceptionInformation;
    8793#define UC_MCONTEXT(UC) UC->uc_mcontext
    88 #endif
    89 #else  /* #ifdef DARWIN */
     94#endif /* X86_64 */
     95#endif /* #ifdef DARWIN */
     96
    9097#ifdef LINUX
    9198typedef struct ucontext ExceptionInformation;
    9299#endif
     100
    93101#ifdef FREEBSD
    94102typedef struct __ucontext ExceptionInformation;
    95103#endif
     104
    96105#ifdef SOLARIS
    97106typedef struct ucontext ExceptionInformation;
    98107#endif
    99 #define UC_MCONTEXT(UC) UC->uc_mcontext
    100 #endif /* #ifdef DARWIN */
    101108
    102109typedef u32_t lisp_char_code;
  • trunk/ccl/lisp-kernel/pmcl-kernel.c

    r5241 r5281  
    556556  mach_msg_type_number_t vm_info_size = VM_REGION_BASIC_INFO_COUNT;
    557557#endif
    558   port_t vm_object_name = (port_t) 0;
     558  mach_port_t vm_object_name = (mach_port_t) 0;
    559559  kern_return_t kret;
    560560
  • trunk/ccl/lisp-kernel/x86-exceptions.c

    r5274 r5281  
    619619{
    620620  if (info->si_code == EXC_I386_SSEEXTERR) {
     621#ifdef _STRUCT_MCONTEXT64
     622    uint32_t mxcsr = UC_MCONTEXT(xp)->__fs.__fpu_mxcsr;
     623#else
    621624    uint32_t mxcsr = UC_MCONTEXT(xp)->fs.fpu_mxcsr;
     625#endif
     626
    622627
    623628    decode_vector_fp_exception(info, mxcsr);
     
    890895#ifdef DARWIN
    891896LispObj *
    892 copy_darwin_mcontext(struct mcontext64 *context,
     897copy_darwin_mcontext(mcontext_t context,
    893898                     LispObj *current,
    894                      struct mcontext64 **out)
    895 {
    896   struct mcontext64 *dest = ((struct mcontext64 *)current)-1;
    897   dest = (struct mcontext64 *) (((LispObj)dest) & ~15);
     899                     mcontext_t *out)
     900{
     901  mcontext_t dest = ((mcontext_t)current)-1;
     902  dest = (mcontext_t) (((LispObj)dest) & ~15);
    898903
    899904  *dest = *context;
     
    10631068#endif
    10641069#ifdef DARWIN
    1065   struct mcontext64 *mcontextp = NULL;
     1070  mcontext_t mcontextp = NULL;
    10661071#endif
    10671072  siginfo_t *info_copy = NULL;
     
    11551160#endif
    11561161#ifdef DARWIN
    1157   struct mcontext64 *mcontextp = NULL;
     1162  mcontext_t mcontextp = NULL;
    11581163#endif
    11591164
     
    17151720  kern_return_t kret;
    17161721#if WORD_SIZE == 64
    1717   struct mcontext64 *mc = UC_MCONTEXT(pseudosigcontext);
     1722  mcontext_t mc = UC_MCONTEXT(pseudosigcontext);
    17181723#else
    17191724  struct mcontext * mc = UC_MCONTEXT(pseudosigcontext);
     
    17231728  kret = thread_set_state(thread,
    17241729                          x86_FLOAT_STATE64,
    1725                           (thread_state_t)&(mc->fs),
     1730                          (thread_state_t)&(mc->__fs),
    17261731                          x86_FLOAT_STATE64_COUNT);
    17271732
     
    17321737  kret = thread_set_state(thread,
    17331738                          x86_THREAD_STATE64,
    1734                           (thread_state_t)&(mc->ss),
     1739                          (thread_state_t)&(mc->__ss),
    17351740                          x86_THREAD_STATE64_COUNT);
    17361741#else
    17371742  kret = thread_set_state(thread,
    17381743                          x86_THREAD_STATE32,
    1739                           (thread_state_t)&(mc->ss),
     1744                          (thread_state_t)&(mc->__ss),
    17401745                          x86_THREAD_STATE32_COUNT);
    17411746#endif
     
    17931798  ExceptionInformation *pseudosigcontext;
    17941799#ifdef X8664
    1795   struct mcontext64 *mc;
     1800  mcontext_t mc;
    17961801#else
    17971802  struct mcontext *mc;
     
    18001805
    18011806 
    1802   stackp = (LispObj) find_foreign_rsp(ts->rsp,tcr->cs_area,tcr);
     1807  stackp = (LispObj) find_foreign_rsp(ts->__rsp,tcr->cs_area,tcr);
    18031808  stackp = TRUNC_DOWN(stackp, C_REDZONE_LEN, C_STK_ALIGN);
    18041809  stackp = TRUNC_DOWN(stackp, sizeof(siginfo_t), C_STK_ALIGN);
     
    18111816  stackp = TRUNC_DOWN(stackp, sizeof(*mc), C_STK_ALIGN);
    18121817#ifdef X8664
    1813   mc = (struct mcontext64 *) ptr_from_lispobj(stackp);
     1818  mc = (mcontext_t) ptr_from_lispobj(stackp);
    18141819#else
    18151820  mc = (struct mcontext *) ptr_from_lispobj(stackp);
    18161821#endif
    18171822 
    1818   bcopy(ts,&(mc->ss),sizeof(*ts));
     1823  bcopy(ts,&(mc->__ss),sizeof(*ts));
    18191824
    18201825  thread_state_count = x86_FLOAT_STATE64_COUNT;
    18211826  thread_get_state(thread,
    18221827                   x86_FLOAT_STATE64,
    1823                    (thread_state_t)&(mc->fs),
     1828                   (thread_state_t)&(mc->__fs),
    18241829                   &thread_state_count);
    18251830
     
    18361841                   x86_EXCEPTION_STATE,
    18371842#endif
    1838                    (thread_state_t)&(mc->es),
     1843                   (thread_state_t)&(mc->__es),
    18391844                   &thread_state_count);
    18401845
     
    18941899  bzero(info, sizeof(*info));
    18951900  info->si_code = code;
    1896   info->si_addr = (void *)(UC_MCONTEXT(pseudosigcontext)->es.faultvaddr);
     1901  info->si_addr = (void *)(UC_MCONTEXT(pseudosigcontext)->__es.__faultvaddr);
    18971902  info->si_signo = signum;
    18981903  pseudosigcontext->uc_onstack = 0;
     
    19081913  */
    19091914
    1910   new_ts.rip = (natural) handler_address;
     1915  new_ts.__rip = (natural) handler_address;
    19111916  stackpp = (natural *)stackp;
    19121917  *--stackpp = (natural)pseudo_sigreturn;
    19131918  stackp = (natural)stackpp;
    1914   new_ts.rdi = signum;
    1915   new_ts.rsi = (natural)info;
    1916   new_ts.rdx = (natural)pseudosigcontext;
    1917   new_ts.rcx = (natural)tcr;
    1918   new_ts.rsp = stackp;
     1919  new_ts.__rdi = signum;
     1920  new_ts.__rsi = (natural)info;
     1921  new_ts.__rdx = (natural)pseudosigcontext;
     1922  new_ts.__rcx = (natural)tcr;
     1923  new_ts.__rsp = stackp;
    19191924
    19201925
     
    19671972
    19681973#ifdef X8664
    1969 #define ts_pc(t) t.rip
     1974#define ts_pc(t) t.__rip
    19701975#else
    19711976#define ts_pc(t) t.eip
  • trunk/ccl/lisp-kernel/x86-exceptions.h

    r5274 r5281  
    3131#define DarwinSigReturn(context) syscall(SYS_sigreturn,context)
    3232#ifdef X8664
     33#ifdef _STRUCT_MCONTEXT64
     34#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__ss.__rax)))
     35#else
    3336#define xpGPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->ss.rax)))
     37#endif
    3438#define xpGPR(x,gprno) (xpGPRvector(x)[gprno])
    3539#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (natural)(new)
    3640#define xpPC(x) (xpGPR(x,Iip))
     41#ifdef _STRUCT_MCONTEXT64
     42#define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->__fs.__fpu_stmm0)))
     43#else
    3744#define xpFPRvector(x) ((natural *)(&(UC_MCONTEXT(x)->fs.fp_stmm0)))
     45#endif
    3846#define xpMMXreg(x,n)  (xpFPRvector(x)[gprno])
    3947#endif
Note: See TracChangeset for help on using the changeset viewer.