18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * kdebug.h: Defines and definitions for debugging the Linux kernel 48c2ecf20Sopenharmony_ci * under various kernel debuggers. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#ifndef _SPARC_KDEBUG_H 98c2ecf20Sopenharmony_ci#define _SPARC_KDEBUG_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <asm/openprom.h> 128c2ecf20Sopenharmony_ci#include <asm/vaddrs.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* Breakpoints are enter through trap table entry 126. So in sparc assembly 158c2ecf20Sopenharmony_ci * if you want to drop into the debugger you do: 168c2ecf20Sopenharmony_ci * 178c2ecf20Sopenharmony_ci * t DEBUG_BP_TRAP 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define DEBUG_BP_TRAP 126 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 238c2ecf20Sopenharmony_ci/* The debug vector is passed in %o1 at boot time. It is a pointer to 248c2ecf20Sopenharmony_ci * a structure in the debuggers address space. Here is its format. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_citypedef unsigned int (*debugger_funct)(void); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistruct kernel_debug { 308c2ecf20Sopenharmony_ci /* First the entry point into the debugger. You jump here 318c2ecf20Sopenharmony_ci * to give control over to the debugger. 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci unsigned long kdebug_entry; 348c2ecf20Sopenharmony_ci unsigned long kdebug_trapme; /* Figure out later... */ 358c2ecf20Sopenharmony_ci /* The following is the number of pages that the debugger has 368c2ecf20Sopenharmony_ci * taken from to total pool. 378c2ecf20Sopenharmony_ci */ 388c2ecf20Sopenharmony_ci unsigned long *kdebug_stolen_pages; 398c2ecf20Sopenharmony_ci /* Ok, after you remap yourself and/or change the trap table 408c2ecf20Sopenharmony_ci * from what you were left with at boot time you have to call 418c2ecf20Sopenharmony_ci * this synchronization function so the debugger can check out 428c2ecf20Sopenharmony_ci * what you have done. 438c2ecf20Sopenharmony_ci */ 448c2ecf20Sopenharmony_ci debugger_funct teach_debugger; 458c2ecf20Sopenharmony_ci}; /* I think that is it... */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciextern struct kernel_debug *linux_dbvec; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* Use this macro in C-code to enter the debugger. */ 508c2ecf20Sopenharmony_cistatic inline void sp_enter_debugger(void) 518c2ecf20Sopenharmony_ci{ 528c2ecf20Sopenharmony_ci __asm__ __volatile__("jmpl %0, %%o7\n\t" 538c2ecf20Sopenharmony_ci "nop\n\t" : : 548c2ecf20Sopenharmony_ci "r" (linux_dbvec) : "o7", "memory"); 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define SP_ENTER_DEBUGGER do { \ 588c2ecf20Sopenharmony_ci if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \ 598c2ecf20Sopenharmony_ci sp_enter_debugger(); \ 608c2ecf20Sopenharmony_ci } while(0) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cienum die_val { 638c2ecf20Sopenharmony_ci DIE_UNUSED, 648c2ecf20Sopenharmony_ci DIE_OOPS, 658c2ecf20Sopenharmony_ci}; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#endif /* !(__ASSEMBLY__) */ 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* Some nice offset defines for assembler code. */ 708c2ecf20Sopenharmony_ci#define KDEBUG_ENTRY_OFF 0x0 718c2ecf20Sopenharmony_ci#define KDEBUG_DUNNO_OFF 0x4 728c2ecf20Sopenharmony_ci#define KDEBUG_DUNNO2_OFF 0x8 738c2ecf20Sopenharmony_ci#define KDEBUG_TEACH_OFF 0xc 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#endif /* !(_SPARC_KDEBUG_H) */ 76