Changeset 9067


Ignore:
Timestamp:
Apr 8, 2008, 7:40:35 AM (11 years ago)
Author:
gb
Message:

Let's see: if the point was to build the kernel on Darwin assuming
the traditional (non-leading ) names for exception-related structures
and fields, should we stop using those names and stop trying to guess
when it's necessary to #define them ? It would seem so.

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

Legend:

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

    r9032 r9067  
    106106
    107107
    108 #ifndef _STRUCT_UCONTEXT
    109 #define __ss ss
    110 #define __es es
    111 #define __fs fs
    112 #define __vs vs
    113 
    114 #define __r0 r0
    115 #define __r1 r1
    116 #define __r3 r3
    117 #define __r4 r4
    118 #define __r5 r5
    119 #define __r6 r6
    120 #define __r13 r13
    121 #define __srr0 srr0
    122 #define __srr1 srr1
    123 #define __lr lr
    124 #define __ctr ctr
    125 #define __xer xer
    126 #define __cr cr
    127 #define __dsisr dsisr
    128 #define __dar dar
    129 #define __exception exception
    130 #define __fpscr fpscr
    131 #define __fpregs fpregs
    132 #endif
    133108#endif /* PPC */
    134109
  • trunk/source/lisp-kernel/ppc-exceptions.c

    r8773 r9067  
    23882388  kret = thread_set_state(thread,
    23892389                          PPC_FLOAT_STATE,
    2390                           (thread_state_t)&(mc->__fs),
     2390                          (thread_state_t)&(mc->fs),
    23912391                          PPC_FLOAT_STATE_COUNT);
    23922392
     
    23972397  kret = thread_set_state(thread,
    23982398                          PPC_THREAD_STATE64,
    2399                           (thread_state_t)&(mc->__ss),
     2399                          (thread_state_t)&(mc->ss),
    24002400                          PPC_THREAD_STATE64_COUNT);
    24012401#else
    24022402  kret = thread_set_state(thread,
    24032403                          MACHINE_THREAD_STATE,
    2404                           (thread_state_t)&(mc->__ss),
     2404                          (thread_state_t)&(mc->ss),
    24052405                          MACHINE_THREAD_STATE_COUNT);
    24062406#endif
     
    24752475    Bug(NULL, "Exception thread can't obtain thread state, Mach result = %d", result);
    24762476  }
    2477   stackp = ts.__r1;
     2477  stackp = ts.r1;
    24782478  backlink = stackp;
    24792479  stackp = TRUNC_DOWN(stackp, C_REDZONE_LEN, C_STK_ALIGN);
     
    24832483  stackp = TRUNC_DOWN(stackp, sizeof(*mc), C_STK_ALIGN);
    24842484  mc = (MCONTEXT_T) ptr_from_lispobj(stackp);
    2485   memmove(&(mc->__ss),&ts,sizeof(ts));
     2485  memmove(&(mc->ss),&ts,sizeof(ts));
    24862486
    24872487  thread_state_count = PPC_FLOAT_STATE_COUNT;
    24882488  thread_get_state(thread,
    24892489                   PPC_FLOAT_STATE,
    2490                    (thread_state_t)&(mc->__fs),
     2490                   (thread_state_t)&(mc->fs),
    24912491                   &thread_state_count);
    24922492
     
    25032503                   PPC_EXCEPTION_STATE,
    25042504#endif
    2505                    (thread_state_t)&(mc->__es),
     2505                   (thread_state_t)&(mc->es),
    25062506                   &thread_state_count);
    25072507
     
    25682568  */
    25692569
    2570   ts.__srr0 = (natural) handler_address;
    2571   ts.__srr1 = (int) xpMSR(pseudosigcontext) & ~MSR_FE0_FE1_MASK;
    2572   ts.__r1 = stackp;
    2573   ts.__r3 = signum;
    2574   ts.__r4 = (natural)pseudosigcontext;
    2575   ts.__r5 = (natural)tcr;
    2576   ts.__r6 = (natural)old_valence;
    2577   ts.__lr = (natural)pseudo_sigreturn;
     2570  ts.srr0 = (natural) handler_address;
     2571  ts.srr1 = (int) xpMSR(pseudosigcontext) & ~MSR_FE0_FE1_MASK;
     2572  ts.r1 = stackp;
     2573  ts.r3 = signum;
     2574  ts.r4 = (natural)pseudosigcontext;
     2575  ts.r5 = (natural)tcr;
     2576  ts.r6 = (natural)old_valence;
     2577  ts.lr = (natural)pseudo_sigreturn;
    25782578
    25792579
    25802580#ifdef PPC64
    2581   ts.__r13 = xpGPR(pseudosigcontext,13);
     2581  ts.r13 = xpGPR(pseudosigcontext,13);
    25822582  thread_set_state(thread,
    25832583                   PPC_THREAD_STATE64,
     
    26282628                   &thread_state_count);
    26292629  if (enabled) {
    2630     ts.__srr1 |= MSR_FE0_FE1_MASK;
     2630    ts.srr1 |= MSR_FE0_FE1_MASK;
    26312631  } else {
    2632     ts.__srr1 &= ~MSR_FE0_FE1_MASK;
     2632    ts.srr1 &= ~MSR_FE0_FE1_MASK;
    26332633  }
    26342634  /*
     
    26482648  */
    26492649  {
    2650     lisp_frame *tos = (lisp_frame *)ts.__r1,
     2650    lisp_frame *tos = (lisp_frame *)ts.r1,
    26512651      *next_frame = tos->backlink;
    26522652   
    26532653    if (tos == (next_frame -1)) {
    2654       ts.__srr0 = tos->savelr;
    2655       ts.__r1 = (LispObj) next_frame;
     2654      ts.srr0 = tos->savelr;
     2655      ts.r1 = (LispObj) next_frame;
    26562656    } else {
    2657       ts.__srr0 += 4;
     2657      ts.srr0 += 4;
    26582658    }
    26592659  }
  • trunk/source/lisp-kernel/ppc-exceptions.h

    r8540 r9067  
    6868
    6969#ifdef DARWIN
    70 #define xpGPRvector(x) (&(UC_MCONTEXT(x)->__ss.__r0))
     70#define xpGPRvector(x) (&(UC_MCONTEXT(x)->ss.r0))
    7171#define xpGPR(x,gprno) ((xpGPRvector(x))[gprno])
    7272#define set_xpGPR(x,gpr,new) xpGPR((x),(gpr)) = (UInt32)(new)
    73 #define xpPC(x) (*((pc*) &(UC_MCONTEXT(x)->__ss.__srr0)))
     73#define xpPC(x) (*((pc*) &(UC_MCONTEXT(x)->ss.srr0)))
    7474#define set_xpPC(x,new) (xpPC(x) = (pc)(new))
    75 #define xpLR(x) (*((pc*)(&(UC_MCONTEXT(x)->__ss.__lr))))
    76 #define xpCTR(x) (*(pc*)(&(UC_MCONTEXT(x)->__ss.__ctr)))
    77 #define xpXER(x) (UC_MCONTEXT(x)->__ss.__xer)
    78 #define xpCCR(x) (UC_MCONTEXT(x)->__ss.__cr)
    79 #define xpMSR(x) (UC_MCONTEXT(x)->__ss.__srr1)
    80 #define xpDSISR(x) (UC_MCONTEXT(x)->__es.__dsisr)
    81 #define xpDAR(x) (UC_MCONTEXT(x)->__es.__dar)
    82 #define xpTRAP(x) (UC_MCONTEXT(x)->__es.__exception)
    83 #define xpFPSCR(x) (UC_MCONTEXT(x)->__fs.__fpscr)
    84 #define xpFPRvector(x) (UC_MCONTEXT(x)->__fs.__fpregs)
     75#define xpLR(x) (*((pc*)(&(UC_MCONTEXT(x)->ss.lr))))
     76#define xpCTR(x) (*(pc*)(&(UC_MCONTEXT(x)->ss.ctr)))
     77#define xpXER(x) (UC_MCONTEXT(x)->ss.xer)
     78#define xpCCR(x) (UC_MCONTEXT(x)->ss.cr)
     79#define xpMSR(x) (UC_MCONTEXT(x)->ss.srr1)
     80#define xpDSISR(x) (UC_MCONTEXT(x)->es.dsisr)
     81#define xpDAR(x) (UC_MCONTEXT(x)->es.dar)
     82#define xpTRAP(x) (UC_MCONTEXT(x)->es.exception)
     83#define xpFPSCR(x) (UC_MCONTEXT(x)->fs.fpscr)
     84#define xpFPRvector(x) (UC_MCONTEXT(x)->fs.fpregs)
    8585#define xpFPR(x,fprno) (xpFPRvector(x)[fprno])
    8686/* There's a bug in some versions of Darwin on G5 processors: FP context
     
    126126#define DarwinSigReturn(x)
    127127#else
    128 #define DarwinSigReturn(x) (UC_MCONTEXT(x)->__ss.__xer)^=0x80
     128#define DarwinSigReturn(x) (UC_MCONTEXT(x)->ss.xer)^=0x80
    129129#endif
    130130#endif
Note: See TracChangeset for help on using the changeset viewer.