The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/osfmk/ppc/interrupt.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * The contents of this file constitute Original Code as defined in and
    7  * are subject to the Apple Public Source License Version 1.1 (the
    8  * "License").  You may not use this file except in compliance with the
    9  * License.  Please obtain a copy of the License at
   10  * http://www.apple.com/publicsource and read it before using this file.
   11  * 
   12  * This Original Code and all software distributed under the License are
   13  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   14  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   15  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   16  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
   17  * License for the specific language governing rights and limitations
   18  * under the License.
   19  * 
   20  * @APPLE_LICENSE_HEADER_END@
   21  */
   22 /*
   23  * @OSF_COPYRIGHT@
   24  */
   25 /*
   26  * @APPLE_FREE_COPYRIGHT@
   27  */
   28 #include <kern/misc_protos.h>
   29 #include <kern/assert.h>
   30 #include <kern/thread.h>
   31 #include <kern/counters.h>
   32 #include <ppc/misc_protos.h>
   33 #include <ppc/trap.h>
   34 #include <ppc/proc_reg.h>
   35 #include <ppc/exception.h>
   36 #include <ppc/savearea.h>
   37 #include <pexpert/pexpert.h>
   38 #include <sys/kdebug.h>
   39 
   40 perfCallback perfIntHook = 0;                                           /* Pointer to CHUD trap hook routine */
   41 
   42 void unresolved_kernel_trap(int trapno,
   43                                    struct savearea *ssp,
   44                                    unsigned int dsisr,
   45                                    addr64_t dar,
   46                                    const char *message);
   47 
   48 struct savearea * interrupt(
   49         int type,
   50         struct savearea *ssp,
   51         unsigned int dsisr,
   52         unsigned int dar)
   53 {
   54         int     current_cpu;
   55         struct per_proc_info    *proc_info;
   56         uint64_t                now;
   57         thread_t                thread;
   58 
   59         disable_preemption();
   60 
   61         if(perfIntHook) {                                                       /* Is there a hook? */
   62                 if(perfIntHook(type, ssp, dsisr, dar) == KERN_SUCCESS) return ssp;      /* If it succeeds, we are done... */
   63         }
   64         
   65 #if 0
   66         {
   67                 extern void fctx_text(void);
   68                 fctx_test();
   69         }
   70 #endif
   71 
   72 
   73         current_cpu = cpu_number();
   74         proc_info = getPerProc();
   75 
   76         switch (type) {
   77 
   78                 case T_DECREMENTER:
   79                         KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_DECI, 0) | DBG_FUNC_NONE,
   80                                   isync_mfdec(), (unsigned int)ssp->save_srr0, 0, 0, 0);
   81         
   82 #if 0
   83                         if (pcsample_enable) {
   84                                 if (find_user_regs(current_thread()))
   85                                   add_pcsamples (user_pc(current_thread()));
   86                         }
   87 #endif
   88 
   89                         now = mach_absolute_time();                             /* Find out what time it is */
   90                         
   91                         if(now >= proc_info->pms.pmsPop) {              /* Is it time for power management state change? */
   92                                 pmsStep(1);                                                     /* Yes, advance step */
   93                                 now = mach_absolute_time();                     /* Get the time again since we ran a bit */
   94                         }
   95 
   96                         thread = current_thread();                                      /* Find ourselves */
   97                         if(thread->machine.qactTimer != 0) {    /* Is the timer set? */
   98                                 if (thread->machine.qactTimer <= now) { /* It is set, has it popped? */
   99                                         thread->machine.qactTimer = 0;          /* Clear single shot timer */
  100                                         if((unsigned int)thread->machine.vmmControl & 0xFFFFFFFE) {     /* Are there any virtual machines? */
  101                                                 vmm_timer_pop(thread);                  /* Yes, check out them out... */
  102                                         }
  103                                 }
  104                         }
  105 
  106                         rtclock_intr(ssp);
  107                         break;
  108         
  109                 case T_INTERRUPT:
  110                         /* Call the platform interrupt routine */
  111                         counter_always(c_incoming_interrupts++);
  112         
  113                         KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR, 0) | DBG_FUNC_START,
  114                            current_cpu, (unsigned int)ssp->save_srr0, 0, 0, 0);
  115         
  116                         proc_info->interrupt_handler(
  117                                 proc_info->interrupt_target, 
  118                                 proc_info->interrupt_refCon,
  119                                 proc_info->interrupt_nub, 
  120                                 proc_info->interrupt_source);
  121         
  122                         KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR, 0) | DBG_FUNC_END,
  123                            0, 0, 0, 0, 0);
  124         
  125                         break;
  126         
  127                 case T_SIGP:
  128                         /* Did the other processor signal us? */ 
  129                         cpu_signal_handler();
  130                         break;
  131         
  132                 case T_SHUTDOWN:
  133                         cpu_doshutdown();
  134                         panic("returning from cpu_doshutdown()\n");
  135                         break;
  136         
  137                                 
  138                 default:
  139                         if (!Call_Debugger(type, ssp))
  140                                 unresolved_kernel_trap(type, ssp, dsisr, dar, NULL);
  141                         break;
  142         }
  143 
  144         enable_preemption();
  145         return ssp;
  146 }

Cache object: f9b5bc184dd1635bd6fc549261493cda


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.