]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/interrupt.c
72dfe9cd6c7d6e23660921afdf9b3a115d29b84d
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * @APPLE_FREE_COPYRIGHT@
36 #include <kern/misc_protos.h>
37 #include <kern/assert.h>
38 #include <kern/thread.h>
39 #include <kern/counters.h>
40 #include <ppc/misc_protos.h>
42 #include <ppc/proc_reg.h>
43 #include <ppc/exception.h>
44 #include <ppc/savearea.h>
45 #include <pexpert/pexpert.h>
46 #include <sys/kdebug.h>
48 perfCallback perfIntHook
= 0; /* Pointer to CHUD trap hook routine */
50 void unresolved_kernel_trap(int trapno
,
56 struct savearea
* interrupt(
63 struct per_proc_info
*proc_info
;
69 if(perfIntHook
) { /* Is there a hook? */
70 if(perfIntHook(type
, ssp
, dsisr
, dar
) == KERN_SUCCESS
) return ssp
; /* If it succeeds, we are done... */
75 extern void fctx_text(void);
81 current_cpu
= cpu_number();
82 proc_info
= getPerProc();
87 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_DECI
, 0) | DBG_FUNC_NONE
,
88 isync_mfdec(), (unsigned int)ssp
->save_srr0
, 0, 0, 0);
91 if (pcsample_enable
) {
92 if (find_user_regs(current_thread()))
93 add_pcsamples (user_pc(current_thread()));
97 now
= mach_absolute_time(); /* Find out what time it is */
99 if(now
>= proc_info
->pms
.pmsPop
) { /* Is it time for power management state change? */
100 pmsStep(1); /* Yes, advance step */
101 now
= mach_absolute_time(); /* Get the time again since we ran a bit */
104 thread
= current_thread(); /* Find ourselves */
105 if(thread
->machine
.qactTimer
!= 0) { /* Is the timer set? */
106 if (thread
->machine
.qactTimer
<= now
) { /* It is set, has it popped? */
107 thread
->machine
.qactTimer
= 0; /* Clear single shot timer */
108 if((unsigned int)thread
->machine
.vmmControl
& 0xFFFFFFFE) { /* Are there any virtual machines? */
109 vmm_timer_pop(thread
); /* Yes, check out them out... */
118 /* Call the platform interrupt routine */
119 counter_always(c_incoming_interrupts
++);
121 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR
, 0) | DBG_FUNC_START
,
122 current_cpu
, (unsigned int)ssp
->save_srr0
, 0, 0, 0);
124 proc_info
->interrupt_handler(
125 proc_info
->interrupt_target
,
126 proc_info
->interrupt_refCon
,
127 proc_info
->interrupt_nub
,
128 proc_info
->interrupt_source
);
130 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR
, 0) | DBG_FUNC_END
,
136 /* Did the other processor signal us? */
137 cpu_signal_handler();
142 panic("returning from cpu_doshutdown()\n");
147 if (!Call_Debugger(type
, ssp
))
148 unresolved_kernel_trap(type
, ssp
, dsisr
, dar
, NULL
);