Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * kdebug.h:  Defines and definitions for debugging the Linux kernel
0004  *            under various kernel debuggers.
0005  *
0006  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
0007  */
0008 #ifndef _SPARC_KDEBUG_H
0009 #define _SPARC_KDEBUG_H
0010 
0011 #include <asm/openprom.h>
0012 #include <asm/vaddrs.h>
0013 
0014 /* Breakpoints are enter through trap table entry 126.  So in sparc assembly
0015  * if you want to drop into the debugger you do:
0016  *
0017  * t DEBUG_BP_TRAP
0018  */
0019 
0020 #define DEBUG_BP_TRAP     126
0021 
0022 #ifndef __ASSEMBLY__
0023 /* The debug vector is passed in %o1 at boot time.  It is a pointer to
0024  * a structure in the debuggers address space.  Here is its format.
0025  */
0026 
0027 typedef unsigned int (*debugger_funct)(void);
0028 
0029 struct kernel_debug {
0030     /* First the entry point into the debugger.  You jump here
0031      * to give control over to the debugger.
0032      */
0033     unsigned long kdebug_entry;
0034     unsigned long kdebug_trapme;   /* Figure out later... */
0035     /* The following is the number of pages that the debugger has
0036      * taken from to total pool.
0037      */
0038     unsigned long *kdebug_stolen_pages;
0039     /* Ok, after you remap yourself and/or change the trap table
0040      * from what you were left with at boot time you have to call
0041      * this synchronization function so the debugger can check out
0042      * what you have done.
0043      */
0044     debugger_funct teach_debugger;
0045 }; /* I think that is it... */
0046 
0047 extern struct kernel_debug *linux_dbvec;
0048 
0049 /* Use this macro in C-code to enter the debugger. */
0050 static inline void sp_enter_debugger(void)
0051 {
0052     __asm__ __volatile__("jmpl %0, %%o7\n\t"
0053                  "nop\n\t" : :
0054                  "r" (linux_dbvec) : "o7", "memory");
0055 }
0056 
0057 #define SP_ENTER_DEBUGGER do { \
0058          if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \
0059            sp_enter_debugger(); \
0060                } while(0)
0061 
0062 enum die_val {
0063     DIE_UNUSED,
0064     DIE_OOPS,
0065 };
0066 
0067 #endif /* !(__ASSEMBLY__) */
0068 
0069 /* Some nice offset defines for assembler code. */
0070 #define KDEBUG_ENTRY_OFF    0x0
0071 #define KDEBUG_DUNNO_OFF    0x4
0072 #define KDEBUG_DUNNO2_OFF   0x8
0073 #define KDEBUG_TEACH_OFF    0xc
0074 
0075 #endif /* !(_SPARC_KDEBUG_H) */