]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/db_machdep.h
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 * Mach Operating System
33 * Copyright (c) 1991,1990 Carnegie Mellon University
34 * All Rights Reserved.
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
59 #ifndef _PPC_DB_MACHDEP_H_
60 #define _PPC_DB_MACHDEP_H_
63 * Machine-dependent defines for new kernel debugger.
66 #include <kern/kern_types.h>
67 #include <mach/ppc/vm_types.h>
68 #include <mach/ppc/vm_param.h>
69 #include <kern/thread.h>
71 #include <ppc/proc_reg.h>
72 #include <ppc/savearea.h>
74 typedef addr64_t db_addr_t
; /* address - unsigned */
75 typedef uint64_t db_expr_t
; /* expression - signed??? try unsigned */
77 typedef struct savearea db_regs_t
;
78 extern db_regs_t ddb_regs
; /* register state */
79 #define DDB_REGS (&ddb_regs)
80 extern int db_active
; /* ddb is active */
82 #define PC_REGS(regs) ((db_addr_t)(regs)->save_srr0)
84 #define BKPT_INST 0x7c810808 /* breakpoint instruction */
85 #define BKPT_SIZE (4) /* size of breakpoint inst */
86 #define BKPT_SET(inst) (BKPT_INST)
88 #define db_clear_single_step(regs) ((regs)->save_srr1 &= ~MASK(MSR_SE))
89 #define db_set_single_step(regs) ((regs)->save_srr1 |= MASK(MSR_SE))
91 #define IS_BREAKPOINT_TRAP(type, code) (FALSE)
92 #define IS_WATCHPOINT_TRAP(type, code) (FALSE)
94 #define inst_trap_return(ins) (FALSE)
95 #define inst_return(ins) (FALSE)
96 #define inst_call(ins) (FALSE)
98 int db_inst_load(unsigned long);
99 int db_inst_store(unsigned long);
101 /* access capability and access macros */
103 #define DB_ACCESS_LEVEL DB_ACCESS_ANY /* any space */
104 #define DB_CHECK_ACCESS(addr,size,task) \
105 db_check_access(addr,size,task)
106 #define DB_PHYS_EQ(task1,addr1,task2,addr2) \
107 db_phys_eq(task1,addr1,task2,addr2)
108 #define DB_VALID_KERN_ADDR(addr) \
109 ((addr) >= VM_MIN_KERNEL_ADDRESS && \
110 (addr) < vm_last_addr)
111 #define DB_VALID_ADDRESS(addr,user) \
112 ((!(user) && DB_VALID_KERN_ADDR(addr)) || \
113 ((user) && (addr) < VM_MAX_ADDRESS))
116 * Given pointer to savearea, determine if it represents
117 * a thread executing a) in user space, b) in the kernel, or c)
118 * in a kernel-loaded task. Return true for cases a) and c).
120 #define IS_USER_TRAP(regs) \
121 (USER_MODE(regs->save_srr1))
123 extern boolean_t
db_check_access(
127 extern boolean_t
db_phys_eq(
132 extern db_addr_t
db_disasm(
136 extern void db_read_bytes(
141 extern void db_write_bytes(
146 extern void db_stack_trace_cmd(
151 extern void db_reboot(
157 /* macros for printing OS server dependent task name */
159 #define DB_TASK_NAME(task) db_task_name(task)
160 #define DB_TASK_NAME_TITLE "COMMAND "
161 #define DB_TASK_NAME_LEN 39
162 #define DB_NULL_TASK_NAME "? "
164 extern void db_task_name(
167 /* macro for checking if a thread has used floating-point */
169 #define db_act_fp_used(act) (FALSE)
171 extern void kdb_trap(
173 struct savearea
*regs
);
174 extern boolean_t
db_trap_from_asm(
175 struct savearea
*regs
);
181 extern boolean_t
db_phys_cmp(
186 #endif /* _PPC_DB_MACHDEP_H_ */