2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 #include <mach/boolean.h>
26 #include <mach/mach_types.h>
28 #include <sys/syscall.h>
29 #include <sys/types.h> /* u_int */
30 #include <sys/proc.h> /* struct proc */
31 #include <sys/systm.h> /* struct sysent */
32 #include <sys/sysproto.h>
34 #pragma mark **** kern debug ****
35 typedef void (*chudxnu_kdebug_callback_func_t
)(uint32_t debugid
, uint32_t arg0
, uint32_t arg1
, uint32_t arg2
, uint32_t arg3
, uint32_t arg4
);
36 static chudxnu_kdebug_callback_func_t kdebug_callback_fn
= NULL
;
38 extern void kdbg_control_chudxnu(int val
, void *fn
);
39 extern unsigned int kdebug_enable
;
41 static void chudxnu_private_kdebug_callback(unsigned int debugid
, unsigned int arg0
, unsigned int arg1
, unsigned int arg2
, unsigned int arg3
, unsigned int arg4
)
43 if(kdebug_callback_fn
) {
44 (kdebug_callback_fn
)(debugid
, arg0
, arg1
, arg2
, arg3
, arg4
);
49 kern_return_t
chudxnu_kdebug_callback_enter(chudxnu_kdebug_callback_func_t func
)
51 kdebug_callback_fn
= func
;
53 kdbg_control_chud(TRUE
, (void *)chudxnu_private_kdebug_callback
);
54 kdebug_enable
|= 0x10;
60 kern_return_t
chudxnu_kdebug_callback_cancel(void)
62 kdebug_callback_fn
= NULL
;
63 kdbg_control_chud(FALSE
, NULL
);
64 kdebug_enable
&= ~(0x10);