Ignore:
Timestamp:
Jul 13, 2010, 5:58:35 AM (9 years ago)
Author:
gb
Message:

Get the kernel to compile/link/run enough to complain about a missing
image on ios.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/lisp-kernel/arm-exceptions.c

    r13924 r13958  
    18481848{
    18491849  kern_return_t kret;
    1850   MCONTEXT_T mc = UC_MCONTEXT(pseudosigcontext);
     1850  _STRUCT_MCONTEXT *mc = UC_MCONTEXT(pseudosigcontext);
    18511851
    18521852  /* Set the thread's FP state from the pseudosigcontext */
    18531853  kret = thread_set_state(thread,
    1854                           ARM_FLOAT_STATE,
     1854                          ARM_VFP_STATE,
    18551855                          (thread_state_t)&(mc->__fs),
    1856                           ARM_FLOAT_STATE_COUNT);
     1856                          ARM_VFP_STATE_COUNT);
    18571857
    18581858  MACH_CHECK_ERROR("setting thread FP state", kret);
     
    19071907  kern_return_t result;
    19081908  ExceptionInformation *pseudosigcontext;
    1909   MCONTEXT_T mc;
     1909  _STRUCT_MCONTEXT *mc;
    19101910  natural stackp, backlink;
    19111911
     
    19201920    Bug(NULL, "Exception thread can't obtain thread state, Mach result = %d", result);
    19211921  }
    1922   stackp = ts.__r1;
     1922  stackp = ts.__sp;
    19231923  backlink = stackp;
    1924   stackp = TRUNC_DOWN(stackp, C_REDZONE_LEN, C_STK_ALIGN);
     1924
    19251925  stackp -= sizeof(*pseudosigcontext);
    19261926  pseudosigcontext = (ExceptionInformation *) ptr_from_lispobj(stackp);
    19271927
    1928   stackp = TRUNC_DOWN(stackp, sizeof(*mc), C_STK_ALIGN);
    1929   mc = (MCONTEXT_T) ptr_from_lispobj(stackp);
     1928  mc = (_STRUCT_MCONTEXT *) ptr_from_lispobj(stackp);
    19301929  memmove(&(mc->__ss),&ts,sizeof(ts));
    19311930
    1932   thread_state_count = PPC_FLOAT_STATE_COUNT;
     1931  thread_state_count = ARM_VFP_STATE_COUNT;
    19331932  thread_get_state(thread,
    1934                    PPC_FLOAT_STATE,
     1933                   ARM_VFP_STATE,
    19351934                   (thread_state_t)&(mc->__fs),
    19361935                   &thread_state_count);
    19371936
    19381937
    1939 #ifdef PPC64
    1940   thread_state_count = PPC_EXCEPTION_STATE64_COUNT;
    1941 #else
    1942   thread_state_count = PPC_EXCEPTION_STATE_COUNT;
    1943 #endif
     1938  thread_state_count = ARM_EXCEPTION_STATE_COUNT;
    19441939  thread_get_state(thread,
    1945 #ifdef PPC64
    1946                    PPC_EXCEPTION_STATE64,
    1947 #else
    1948                    PPC_EXCEPTION_STATE,
    1949 #endif
     1940                   ARM_EXCEPTION_STATE,
    19501941                   (thread_state_t)&(mc->__es),
    19511942                   &thread_state_count);
     
    19531944
    19541945  UC_MCONTEXT(pseudosigcontext) = mc;
    1955   stackp = TRUNC_DOWN(stackp, C_PARAMSAVE_LEN, C_STK_ALIGN);
    1956   stackp -= C_LINKAGE_LEN;
    1957   *(natural *)ptr_from_lispobj(stackp) = backlink;
    19581946  if (new_stack_top) {
    19591947    *new_stack_top = stackp;
     
    19861974                   TCR *tcr)
    19871975{
    1988 #ifdef PPC64
    1989   ppc_thread_state64_t ts;
    1990 #else
    1991   ppc_thread_state_t ts;
    1992 #endif
     1976  arm_thread_state_t ts;
    19931977  ExceptionInformation *pseudosigcontext;
    19941978  int old_valence = tcr->valence;
     
    20111995  */
    20121996
    2013   ts.__srr0 = (natural) handler_address;
    2014   ts.__srr1 = (int) xpMSR(pseudosigcontext) & ~MSR_FE0_FE1_MASK;
    2015   ts.__r1 = stackp;
    2016   ts.__r3 = signum;
    2017   ts.__r4 = (natural)pseudosigcontext;
    2018   ts.__r5 = (natural)tcr;
    2019   ts.__r6 = (natural)old_valence;
     1997  ts.__pc = (natural) handler_address;
     1998  ts.__sp = stackp;
     1999  ts.__r[0] = signum;
     2000  ts.__r[1] = (natural)pseudosigcontext;
     2001  ts.__r[2] = (natural)tcr;
     2002  ts.__r[3] = (natural)old_valence;
    20202003  ts.__lr = (natural)pseudo_sigreturn;
    20212004
    20222005
    2023 #ifdef PPC64
    2024   ts.__r13 = xpGPR(pseudosigcontext,13);
    2025   thread_set_state(thread,
    2026                    PPC_THREAD_STATE64,
    2027                    (thread_state_t)&ts,
    2028                    PPC_THREAD_STATE64_COUNT);
    2029 #else
    20302006  thread_set_state(thread,
    20312007                   MACHINE_THREAD_STATE,
    20322008                   (thread_state_t)&ts,
    20332009                   MACHINE_THREAD_STATE_COUNT);
    2034 #endif
    20352010#ifdef DEBUG_MACH_EXCEPTIONS
    20362011  fprintf(dbgout,"Set up exception context for 0x%x at 0x%x\n", tcr, tcr->pending_exception_context);
     
    20432018pseudo_signal_handler(int signum, ExceptionInformation *context, TCR *tcr, int old_valence)
    20442019{
    2045   signal_handler(signum, NULL, context, tcr, old_valence);
     2020  signal_handler(signum, NULL, context, tcr, old_valence, 0);
    20462021}
    20472022
     
    20502025thread_set_fp_exceptions_enabled(mach_port_t thread, Boolean enabled)
    20512026{
    2052 #ifdef PPC64
    2053   ppc_thread_state64_t ts;
    2054 #else
    2055   ppc_thread_state_t ts;
    2056 #endif
    2057   mach_msg_type_number_t thread_state_count;
    2058 
    2059 #ifdef PPC64
    2060   thread_state_count = PPC_THREAD_STATE64_COUNT;
    2061 #else
    2062   thread_state_count = PPC_THREAD_STATE_COUNT;
    2063 #endif
    2064   thread_get_state(thread,
    2065 #ifdef PPC64
    2066                    PPC_THREAD_STATE64,  /* GPRs, some SPRs  */
    2067 #else
    2068                    PPC_THREAD_STATE,    /* GPRs, some SPRs  */
    2069 #endif
    2070                    (thread_state_t)&ts,
    2071                    &thread_state_count);
    2072   if (enabled) {
    2073     ts.__srr1 |= MSR_FE0_FE1_MASK;
    2074   } else {
    2075     ts.__srr1 &= ~MSR_FE0_FE1_MASK;
    2076   }
    2077   /*
    2078      Hack-o-rama warning (isn't it about time for such a warning?):
    2079      pthread_kill() seems to want to lose the MSR's FE0/FE1 bits.
    2080      Our handler for lisp's use of pthread_kill() pushes a phony
    2081      lisp frame on the stack and force the context to resume at
    2082      the UUO in enable_fp_exceptions(); the "saveLR" field of that
    2083      lisp frame contains the -real- address that process_interrupt
    2084      should have returned to, and the fact that it's in a lisp
    2085      frame should convince the GC to notice that address if it
    2086      runs in the tiny time window between returning from our
    2087      interrupt handler and ... here.
    2088      If the top frame on the stack is a lisp frame, discard it
    2089      and set ts.srr0 to the saveLR field in that frame.  Otherwise,
    2090      just adjust ts.srr0 to skip over the UUO.
    2091   */
    2092   {
    2093     lisp_frame *tos = (lisp_frame *)ts.__r1,
    2094       *next_frame = tos->backlink;
    2095    
    2096     if (tos == (next_frame -1)) {
    2097       ts.__srr0 = tos->savelr;
    2098       ts.__r1 = (LispObj) next_frame;
    2099     } else {
    2100       ts.__srr0 += 4;
    2101     }
    2102   }
    2103   thread_set_state(thread,
    2104 #ifdef PPC64
    2105                    PPC_THREAD_STATE64,  /* GPRs, some SPRs  */
    2106 #else
    2107                    PPC_THREAD_STATE,    /* GPRs, some SPRs  */
    2108 #endif
    2109                    (thread_state_t)&ts,
    2110 #ifdef PPC64
    2111                    PPC_THREAD_STATE64_COUNT
    2112 #else
    2113                    PPC_THREAD_STATE_COUNT
    2114 #endif
    2115                    );
    2116 
     2027  /* Likely hopeless. */
    21172028  return 0;
    21182029}
     
    21562067  }
    21572068  if ((exception == EXC_BAD_INSTRUCTION) &&
    2158       (code_vector[0] == EXC_PPC_UNIPL_INST) &&
    2159       (((code1 = code_vector[1]) == (int)pseudo_sigreturn) ||
    2160        (code1 == (int)enable_fp_exceptions) ||
    2161        (code1 == (int)disable_fp_exceptions))) {
    2162     if (code1 == (int)pseudo_sigreturn) {
    2163       kret = do_pseudo_sigreturn(thread, tcr);
    2164 #if 0
    2165       fprintf(dbgout, "Exception return in 0x%x\n",tcr);
    2166 #endif
    2167        
    2168     } else if (code1 == (int)enable_fp_exceptions) {
    2169       kret = thread_set_fp_exceptions_enabled(thread, true);
    2170     } else kret =  thread_set_fp_exceptions_enabled(thread, false);
     2069      (code_vector[0] == EXC_ARM_UNDEFINED) &&
     2070      (((code1 = code_vector[1]) == (int)pseudo_sigreturn))) {
     2071    kret = do_pseudo_sigreturn(thread, tcr);
    21712072  } else if (tcr->flags & (1<<TCR_FLAG_BIT_PROPAGATE_EXCEPTION)) {
    21722073    CLR_TCR_FLAG(tcr,TCR_FLAG_BIT_PROPAGATE_EXCEPTION);
     
    21822083      break;
    21832084     
    2184     case EXC_SOFTWARE:
    2185       if (code == EXC_PPC_TRAP) {
    2186         signum = SIGTRAP;
    2187       }
    21882085      break;
    21892086     
Note: See TracChangeset for help on using the changeset viewer.