]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/interrupt.c
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_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 License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 * @APPLE_FREE_COPYRIGHT@
34 #include <kern/misc_protos.h>
35 #include <kern/assert.h>
36 #include <kern/thread.h>
37 #include <kern/counters.h>
38 #include <ppc/misc_protos.h>
40 #include <ppc/proc_reg.h>
41 #include <ppc/exception.h>
42 #include <ppc/savearea.h>
43 #include <pexpert/pexpert.h>
44 #include <sys/kdebug.h>
46 perfCallback perfIntHook
= 0; /* Pointer to CHUD trap hook routine */
48 void unresolved_kernel_trap(int trapno
,
54 struct savearea
* interrupt(
61 struct per_proc_info
*proc_info
;
67 if(perfIntHook
) { /* Is there a hook? */
68 if(perfIntHook(type
, ssp
, dsisr
, dar
) == KERN_SUCCESS
) return ssp
; /* If it succeeds, we are done... */
73 extern void fctx_text(void);
79 current_cpu
= cpu_number();
80 proc_info
= getPerProc();
85 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_DECI
, 0) | DBG_FUNC_NONE
,
86 isync_mfdec(), (unsigned int)ssp
->save_srr0
, 0, 0, 0);
89 if (pcsample_enable
) {
90 if (find_user_regs(current_thread()))
91 add_pcsamples (user_pc(current_thread()));
95 now
= mach_absolute_time(); /* Find out what time it is */
97 if(now
>= proc_info
->pms
.pmsPop
) { /* Is it time for power management state change? */
98 pmsStep(1); /* Yes, advance step */
99 now
= mach_absolute_time(); /* Get the time again since we ran a bit */
102 thread
= current_thread(); /* Find ourselves */
103 if(thread
->machine
.qactTimer
!= 0) { /* Is the timer set? */
104 if (thread
->machine
.qactTimer
<= now
) { /* It is set, has it popped? */
105 thread
->machine
.qactTimer
= 0; /* Clear single shot timer */
106 if((unsigned int)thread
->machine
.vmmControl
& 0xFFFFFFFE) { /* Are there any virtual machines? */
107 vmm_timer_pop(thread
); /* Yes, check out them out... */
116 /* Call the platform interrupt routine */
117 counter_always(c_incoming_interrupts
++);
119 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR
, 0) | DBG_FUNC_START
,
120 current_cpu
, (unsigned int)ssp
->save_srr0
, 0, 0, 0);
122 proc_info
->interrupt_handler(
123 proc_info
->interrupt_target
,
124 proc_info
->interrupt_refCon
,
125 proc_info
->interrupt_nub
,
126 proc_info
->interrupt_source
);
128 KERNEL_DEBUG_CONSTANT(MACHDBG_CODE(DBG_MACH_EXCP_INTR
, 0) | DBG_FUNC_END
,
134 /* Did the other processor signal us? */
135 cpu_signal_handler();
140 panic("returning from cpu_doshutdown()\n");
145 if (!Call_Debugger(type
, ssp
))
146 unresolved_kernel_trap(type
, ssp
, dsisr
, dar
, NULL
);