1 /* $Id: kdebug.h,v 1.10 1997/12/14 23:24:40 ecd Exp $
2 * kdebug.h: Defines and definitions for debugging the Linux kernel
3 * under various kernel debuggers.
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
7 #ifndef _SPARC_KDEBUG_H
8 #define _SPARC_KDEBUG_H
10 #include <asm/openprom.h>
12 /* The debugger lives in 1MB of virtual address space right underneath
16 #define DEBUG_FIRSTVADDR 0xffc00000
17 #define DEBUG_LASTVADDR LINUX_OPPROM_BEGVM
19 /* Breakpoints are enter through trap table entry 126. So in sparc assembly
20 * if you want to drop into the debugger you do:
25 #define DEBUG_BP_TRAP 126
28 /* The debug vector is passed in %o1 at boot time. It is a pointer to
29 * a structure in the debuggers address space. Here is its format.
32 typedef unsigned int (*debugger_funct
)(void);
35 /* First the entry point into the debugger. You jump here
36 * to give control over to the debugger.
38 unsigned long kdebug_entry
;
39 unsigned long kdebug_trapme
; /* Figure out later... */
40 /* The following is the number of pages that the debugger has
41 * taken from to total pool.
43 unsigned long *kdebug_stolen_pages
;
44 /* Ok, after you remap yourself and/or change the trap table
45 * from what you were left with at boot time you have to call
46 * this synchronization function so the debugger can check out
49 debugger_funct teach_debugger
;
50 }; /* I think that is it... */
52 extern struct kernel_debug
*linux_dbvec
;
54 /* Use this macro in C-code to enter the debugger. */
55 extern __inline__
void sp_enter_debugger(void)
57 __asm__
__volatile__("jmpl %0, %%o7\n\t"
59 "r" (linux_dbvec
) : "o7", "memory");
62 #define SP_ENTER_DEBUGGER do { \
63 if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \
64 sp_enter_debugger(); \
67 #endif /* !(__ASSEMBLY__) */
69 /* Some nice offset defines for assembler code. */
70 #define KDEBUG_ENTRY_OFF 0x0
71 #define KDEBUG_DUNNO_OFF 0x4
72 #define KDEBUG_DUNNO2_OFF 0x8
73 #define KDEBUG_TEACH_OFF 0xc
75 #endif /* !(_SPARC_KDEBUG_H) */