]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/chud/chud_bsd_callback.c
xnu-517.7.7.tar.gz
[apple/xnu.git] / bsd / dev / ppc / chud / chud_bsd_callback.c
1 /*
2 * Copyright (c) 2003 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 #include <stdint.h>
24 #include <mach/boolean.h>
25 #include <mach/mach_types.h>
26
27 #include <sys/syscall.h>
28 #include <sys/types.h> /* u_int */
29 #include <sys/proc.h> /* struct proc */
30 #include <sys/systm.h> /* struct sysent */
31
32 struct exit_args {
33 int rval;
34 };
35 extern void exit(struct proc *p, struct exit_args *uap, int *retval);
36 extern struct sysent sysent[];
37
38 #pragma mark **** kern debug ****
39 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);
40 static chudxnu_kdebug_callback_func_t kdebug_callback_fn = NULL;
41
42 extern void kdbg_control_chudxnu(int val, void *fn);
43 extern unsigned int kdebug_enable;
44
45 static void chudxnu_private_kdebug_callback(unsigned int debugid, unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4)
46 {
47 if(kdebug_callback_fn) {
48 (kdebug_callback_fn)(debugid, arg0, arg1, arg2, arg3, arg4);
49 }
50 }
51
52 __private_extern__
53 kern_return_t chudxnu_kdebug_callback_enter(chudxnu_kdebug_callback_func_t func)
54 {
55 kdebug_callback_fn = func;
56
57 kdbg_control_chud(TRUE, (void *)chudxnu_private_kdebug_callback);
58 kdebug_enable |= 0x10;
59
60 return KERN_SUCCESS;
61 }
62
63 __private_extern__
64 kern_return_t chudxnu_kdebug_callback_cancel(void)
65 {
66 kdebug_callback_fn = NULL;
67 kdbg_control_chud(FALSE, NULL);
68 kdebug_enable &= ~(0x10);
69
70 return KERN_SUCCESS;
71 }
72
73 #pragma mark **** task will exit ****
74
75 typedef kern_return_t (*chudxnu_exit_callback_func_t)(int pid);
76
77 __private_extern__
78 kern_return_t chudxnu_exit_callback_enter(chudxnu_exit_callback_func_t func)
79 {
80
81 return KERN_FAILURE;
82
83 }
84
85 __private_extern__
86 kern_return_t chudxnu_exit_callback_cancel(void)
87 {
88
89 return KERN_FAILURE;
90
91 }