xref: /netbsd-src/sys/arch/mips/include/kdbparam.h (revision 5e4c038a45edbc7d63b7c2daa76e29f88b64a4e3)
1 /*	$NetBSD: kdbparam.h,v 1.6 2002/03/05 14:12:29 simonb Exp $	*/
2 
3 /*-
4  * Copyright (c) 1992, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Ralph Campbell.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the University of
21  *	California, Berkeley and its contributors.
22  * 4. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  *	@(#)kdbparam.h	8.1 (Berkeley) 6/10/93
39  */
40 
41 /*
42  * Machine dependent definitions for kdb.
43  */
44 
45 #if BYTE_ORDER == LITTLE_ENDIAN
46 #define kdbshorten(w)	((w) & 0xFFFF)
47 #define	kdbbyte(w)	((w) & 0xFF)
48 #define	kdbitol(a,b)	((long)(((b) << 16) | ((a) & 0xFFFF)))
49 #define	kdbbtol(a)	((long)(a))
50 #endif
51 
52 #define LPRMODE		"%R"
53 #define OFFMODE		"+%R"
54 
55 #define	SETBP(ins)	MIPS_BREAK_BRKPT
56 
57 /* return the program counter value modified if we are in a delay slot */
58 #define	kdbgetpc(pcb)		(kdbvar[kdbvarchk('t')] < 0 ? \
59 	(pcb).pcb_regs[34] + 4 : (pcb).pcb_regs[34])
60 #define	kdbishiddenreg(p)	((p) >= &kdbreglist[33])
61 #define	kdbisbreak(type)	(((type) & MIPS_CR_EXC_CODE) == 0x24)
62 
63 /* check for address wrap around */
64 #define	kdbaddrwrap(addr,newaddr)	(((addr)^(newaddr)) >> 31)
65 
66 /* declare machine dependent routines defined in kadb.c */
67 void	kdbprinttrap(unsigned, unsigned);
68 void	kdbsetsstep(void);
69 void	kdbclrsstep(void);
70 void	kdbreadc(char *);
71 void	kdbwrite(char *, int);
72 void	kdbprintins(int, long);
73 void	kdbstacktrace(int);
74 char	*kdbmalloc(int);
75