Changeset 13207


Ignore:
Timestamp:
Nov 16, 2009, 8:55:48 PM (10 years ago)
Author:
rme
Message:

Changes to make Darwin/ppc lisp kernels build with 10.5 SDK.
This involves using the ""-prefixed member names for
thread state structs, and providing compatibility #defines on
10.4 systems.

Location:
trunk/source/lisp-kernel
Files:
3 edited

Legend:

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

    r13206 r13207  
    8686
    8787#ifdef PPC
     88#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
     89#define __ss ss
     90#define __es es
     91#define __fs fs
     92
     93#define __srr0 srr0
     94#define __srr1 srr1
     95#define __r0 r0
     96#define __r1 r1
     97#define __r3 r3
     98#define __r4 r4
     99#define __r5 r5
     100#define __r6 r6
     101#define __r13 r13
     102#define __cr cr
     103#define __xer xer
     104#define __lr lr
     105#define __ctr ctr
     106
     107#define __dar dar
     108#define __dsisr dsisr
     109#define __exception exception
     110
     111#define __fpregs fpregs
     112#define __fpscr fpscr
     113#endif
     114
    88115#if WORD_SIZE == 64
    89116#ifdef _STRUCT_UCONTEXT64
  • trunk/source/lisp-kernel/ppc-exceptions.c

    r13067 r13207  
    24732473  kret = thread_set_state(thread,
    24742474                          PPC_FLOAT_STATE,
    2475                           (thread_state_t)&(mc->fs),
     2475                          (thread_state_t)&(mc->__fs),
    24762476                          PPC_FLOAT_STATE_COUNT);
    24772477
     
    24822482  kret = thread_set_state(thread,
    24832483                          PPC_THREAD_STATE64,
    2484                           (thread_state_t)&(mc->ss),
     2484                          (thread_state_t)&(mc->__ss),
    24852485                          PPC_THREAD_STATE64_COUNT);
    24862486#else
    24872487  kret = thread_set_state(thread,
    24882488                          MACHINE_THREAD_STATE,
    2489                           (thread_state_t)&(mc->ss),
     2489                          (thread_state_t)&(mc->__ss),
    24902490                          MACHINE_THREAD_STATE_COUNT);
    24912491#endif
     
    25592559    Bug(NULL, "Exception thread can't obtain thread state, Mach result = %d", result);
    25602560  }
    2561   stackp = ts.r1;
     2561  stackp = ts.__r1;
    25622562  backlink = stackp;
    25632563  stackp = TRUNC_DOWN(stackp, C_REDZONE_LEN, C_STK_ALIGN);
     
    25672567  stackp = TRUNC_DOWN(stackp, sizeof(*mc), C_STK_ALIGN);
    25682568  mc = (MCONTEXT_T) ptr_from_lispobj(stackp);
    2569   memmove(&(mc->ss),&ts,sizeof(ts));
     2569  memmove(&(mc->__ss),&ts,sizeof(ts));
    25702570
    25712571  thread_state_count = PPC_FLOAT_STATE_COUNT;
    25722572  thread_get_state(thread,
    25732573                   PPC_FLOAT_STATE,
    2574                    (thread_state_t)&(mc->fs),
     2574                   (thread_state_t)&(mc->__fs),
    25752575                   &thread_state_count);
    25762576
     
    25872587                   PPC_EXCEPTION_STATE,
    25882588#endif
    2589                    (thread_state_t)&(mc->es),
     2589                   (thread_state_t)&(mc->__es),
    25902590                   &thread_state_count);
    25912591
     
    26502650  */
    26512651
    2652   ts.srr0 = (natural) handler_address;
    2653   ts.srr1 = (int) xpMSR(pseudosigcontext) & ~MSR_FE0_FE1_MASK;
    2654   ts.r1 = stackp;
    2655   ts.r3 = signum;
    2656   ts.r4 = (natural)pseudosigcontext;
    2657   ts.r5 = (natural)tcr;
    2658   ts.r6 = (natural)old_valence;
    2659   ts.lr = (natural)pseudo_sigreturn;
     2652  ts.__srr0 = (natural) handler_address;
     2653  ts.__srr1 = (int) xpMSR(pseudosigcontext) & ~MSR_FE0_FE1_MASK;
     2654  ts.__r1 = stackp;
     2655  ts.__r3 = signum;
     2656  ts.__r4 = (natural)pseudosigcontext;
     2657  ts.__r5 = (natural)tcr;
     2658  ts.__r6 = (natural)old_valence;
     2659  ts.__lr = (natural)pseudo_sigreturn;
    26602660
    26612661
    26622662#ifdef PPC64
    2663   ts.r13 = xpGPR(pseudosigcontext,13);
     2663  ts.__r13 = xpGPR(pseudosigcontext,13);
    26642664  thread_set_state(thread,
    26652665                   PPC_THREAD_STATE64,
     
    27102710                   &thread_state_count);
    27112711  if (enabled) {
    2712     ts.srr1 |= MSR_FE0_FE1_MASK;
     2712    ts.__srr1 |= MSR_FE0_FE1_MASK;
    27132713  } else {
    2714     ts.srr1 &= ~MSR_FE0_FE1_MASK;
     2714    ts.__srr1 &= ~MSR_FE0_FE1_MASK;
    27152715  }
    27162716  /*
     
    27302730  */
    27312731  {
    2732     lisp_frame *tos = (lisp_frame *)ts.r1,
     2732    lisp_frame *tos = (lisp_frame *)ts.__r1,
    27332733      *next_frame = tos->backlink;
    27342734   
    27352735    if (tos == (next_frame -1)) {
    2736       ts.srr0 = tos->savelr;
    2737       ts.r1 = (LispObj) next_frame;
     2736      ts.__srr0 = tos->savelr;
     2737      ts.__r1 = (LispObj) next_frame;
    27382738    } else {
    2739       ts.srr0 += 4;
     2739      ts.__srr0 += 4;
    27402740    }
    27412741  }
  • trunk/source/lisp-kernel/ppc-exceptions.h

    r13067 r13207  
    7070
    7171#ifdef DARWIN
    72 #define xpGPRvector(x) (&(UC_MCONTEXT(x)->ss.r0))
     72#define xpGPRvector(x) (&(UC_MCONTEXT(x)->__ss.__r0))
    7373#define xpGPR(x,gprno) ((xpGPRvector(x))[gprno])
    7474#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (UInt32)(new)
    75 #define xpPC(x) (*((pc*) &(UC_MCONTEXT(x)->ss.srr0)))
     75#define xpPC(x) (*((pc*) &(UC_MCONTEXT(x)->__ss.__srr0)))
    7676#define set_xpPC(x,new) (xpPC(x) = (pc)(new))
    77 #define xpLR(x) (*((pc*)(&(UC_MCONTEXT(x)->ss.lr))))
    78 #define xpCTR(x) (*(pc*)(&(UC_MCONTEXT(x)->ss.ctr)))
    79 #define xpXER(x) (UC_MCONTEXT(x)->ss.xer)
    80 #define xpCCR(x) (UC_MCONTEXT(x)->ss.cr)
    81 #define xpMSR(x) (UC_MCONTEXT(x)->ss.srr1)
    82 #define xpDSISR(x) (UC_MCONTEXT(x)->es.dsisr)
    83 #define xpDAR(x) (UC_MCONTEXT(x)->es.dar)
    84 #define xpTRAP(x) (UC_MCONTEXT(x)->es.exception)
    85 #define xpFPSCR(x) (UC_MCONTEXT(x)->fs.fpscr)
    86 #define xpFPRvector(x) (UC_MCONTEXT(x)->fs.fpregs)
     77#define xpLR(x) (*((pc*)(&(UC_MCONTEXT(x)->__ss.__lr))))
     78#define xpCTR(x) (*(pc*)(&(UC_MCONTEXT(x)->__ss.__ctr)))
     79#define xpXER(x) (UC_MCONTEXT(x)->__ss.__xer)
     80#define xpCCR(x) (UC_MCONTEXT(x)->__ss.__cr)
     81#define xpMSR(x) (UC_MCONTEXT(x)->__ss.__srr1)
     82#define xpDSISR(x) (UC_MCONTEXT(x)->__es.__dsisr)
     83#define xpDAR(x) (UC_MCONTEXT(x)->__es.__dar)
     84#define xpTRAP(x) (UC_MCONTEXT(x)->__es.__exception)
     85#define xpFPSCR(x) (UC_MCONTEXT(x)->__fs.__fpscr)
     86#define xpFPRvector(x) (UC_MCONTEXT(x)->__fs.__fpregs)
    8787#define xpFPR(x,fprno) (xpFPRvector(x)[fprno])
    8888/* There's a bug in some versions of Darwin on G5 processors: FP context
     
    128128#define DarwinSigReturn(x)
    129129#else
    130 #define DarwinSigReturn(x) (UC_MCONTEXT(x)->ss.xer)^=0x80
     130#define DarwinSigReturn(x) (UC_MCONTEXT(x)->__ss.__xer)^=0x80
    131131#endif
    132132#define SIGRETURN(context) DarwinSigReturn(context)
Note: See TracChangeset for help on using the changeset viewer.