Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
kgdb.c File Reference
#include <linux/kgdb.h>
#include <linux/kdebug.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <asm/cacheflush.h>
#include <asm/traps.h>

Go to the source code of this file.

Macros

#define OPCODE_BT(op)   (((op) & 0xff00) == 0x8900)
 
#define OPCODE_BF(op)   (((op) & 0xff00) == 0x8b00)
 
#define OPCODE_BTF_DISP(op)
 
#define OPCODE_BFS(op)   (((op) & 0xff00) == 0x8f00)
 
#define OPCODE_BTS(op)   (((op) & 0xff00) == 0x8d00)
 
#define OPCODE_BRA(op)   (((op) & 0xf000) == 0xa000)
 
#define OPCODE_BRA_DISP(op)
 
#define OPCODE_BRAF(op)   (((op) & 0xf0ff) == 0x0023)
 
#define OPCODE_BRAF_REG(op)   (((op) & 0x0f00) >> 8)
 
#define OPCODE_BSR(op)   (((op) & 0xf000) == 0xb000)
 
#define OPCODE_BSR_DISP(op)
 
#define OPCODE_BSRF(op)   (((op) & 0xf0ff) == 0x0003)
 
#define OPCODE_BSRF_REG(op)   (((op) >> 8) & 0xf)
 
#define OPCODE_JMP(op)   (((op) & 0xf0ff) == 0x402b)
 
#define OPCODE_JMP_REG(op)   (((op) >> 8) & 0xf)
 
#define OPCODE_JSR(op)   (((op) & 0xf0ff) == 0x400b)
 
#define OPCODE_JSR_REG(op)   (((op) >> 8) & 0xf)
 
#define OPCODE_RTS(op)   ((op) == 0xb)
 
#define OPCODE_RTE(op)   ((op) == 0x2b)
 
#define SR_T_BIT_MASK   0x1
 
#define STEP_OPCODE   0xc33d
 

Functions

int dbg_set_reg (int regno, void *mem, struct pt_regs *regs)
 
chardbg_get_reg (int regno, void *mem, struct pt_regs *regs)
 
void sleeping_thread_to_gdb_regs (unsigned long *gdb_regs, struct task_struct *p)
 
int kgdb_arch_handle_exception (int e_vector, int signo, int err_code, char *remcomInBuffer, char *remcomOutBuffer, struct pt_regs *linux_regs)
 
unsigned long kgdb_arch_pc (int exception, struct pt_regs *regs)
 
void kgdb_arch_set_pc (struct pt_regs *regs, unsigned long ip)
 
 BUILD_TRAP_HANDLER (singlestep)
 
void kgdb_roundup_cpus (unsigned long flags)
 
int kgdb_arch_init (void)
 
void kgdb_arch_exit (void)
 

Variables

struct dbg_reg_def_t dbg_reg_def [DBG_MAX_REG_NUM]
 
struct kgdb_arch arch_kgdb_ops
 

Macro Definition Documentation

#define OPCODE_BF (   op)    (((op) & 0xff00) == 0x8b00)

Definition at line 21 of file kgdb.c.

#define OPCODE_BFS (   op)    (((op) & 0xff00) == 0x8f00)

Definition at line 24 of file kgdb.c.

#define OPCODE_BRA (   op)    (((op) & 0xf000) == 0xa000)

Definition at line 26 of file kgdb.c.

#define OPCODE_BRA_DISP (   op)
Value:
(((op) & 0x800) ? (((op) | 0xfffff800) << 1) : \
(((op) & 0x7ff) << 1))

Definition at line 27 of file kgdb.c.

#define OPCODE_BRAF (   op)    (((op) & 0xf0ff) == 0x0023)

Definition at line 29 of file kgdb.c.

#define OPCODE_BRAF_REG (   op)    (((op) & 0x0f00) >> 8)

Definition at line 30 of file kgdb.c.

#define OPCODE_BSR (   op)    (((op) & 0xf000) == 0xb000)

Definition at line 31 of file kgdb.c.

#define OPCODE_BSR_DISP (   op)
Value:
(((op) & 0x800) ? (((op) | 0xfffff800) << 1) : \
(((op) & 0x7ff) << 1))

Definition at line 32 of file kgdb.c.

#define OPCODE_BSRF (   op)    (((op) & 0xf0ff) == 0x0003)

Definition at line 34 of file kgdb.c.

#define OPCODE_BSRF_REG (   op)    (((op) >> 8) & 0xf)

Definition at line 35 of file kgdb.c.

#define OPCODE_BT (   op)    (((op) & 0xff00) == 0x8900)

Definition at line 20 of file kgdb.c.

#define OPCODE_BTF_DISP (   op)
Value:
(((op) & 0x80) ? (((op) | 0xffffff80) << 1) : \
(((op) & 0x7f ) << 1))

Definition at line 22 of file kgdb.c.

#define OPCODE_BTS (   op)    (((op) & 0xff00) == 0x8d00)

Definition at line 25 of file kgdb.c.

#define OPCODE_JMP (   op)    (((op) & 0xf0ff) == 0x402b)

Definition at line 36 of file kgdb.c.

#define OPCODE_JMP_REG (   op)    (((op) >> 8) & 0xf)

Definition at line 37 of file kgdb.c.

#define OPCODE_JSR (   op)    (((op) & 0xf0ff) == 0x400b)

Definition at line 38 of file kgdb.c.

#define OPCODE_JSR_REG (   op)    (((op) >> 8) & 0xf)

Definition at line 39 of file kgdb.c.

#define OPCODE_RTE (   op)    ((op) == 0x2b)

Definition at line 41 of file kgdb.c.

#define OPCODE_RTS (   op)    ((op) == 0xb)

Definition at line 40 of file kgdb.c.

#define SR_T_BIT_MASK   0x1

Definition at line 43 of file kgdb.c.

#define STEP_OPCODE   0xc33d

Definition at line 44 of file kgdb.c.

Function Documentation

BUILD_TRAP_HANDLER ( singlestep  )

Definition at line 303 of file kgdb.c.

char* dbg_get_reg ( int  regno,
void mem,
struct pt_regs regs 
)

Definition at line 205 of file kgdb.c.

int dbg_set_reg ( int  regno,
void mem,
struct pt_regs regs 
)

Definition at line 193 of file kgdb.c.

void kgdb_arch_exit ( void  )

Definition at line 377 of file kgdb.c.

int kgdb_arch_handle_exception ( int  e_vector,
int  signo,
int  err_code,
char remcomInBuffer,
char remcomOutBuffer,
struct pt_regs linux_regs 
)

Definition at line 252 of file kgdb.c.

int kgdb_arch_init ( void  )

Definition at line 372 of file kgdb.c.

unsigned long kgdb_arch_pc ( int  exception,
struct pt_regs regs 
)

Definition at line 288 of file kgdb.c.

void kgdb_arch_set_pc ( struct pt_regs regs,
unsigned long  ip 
)

Definition at line 295 of file kgdb.c.

void kgdb_roundup_cpus ( unsigned long  flags)

Definition at line 319 of file kgdb.c.

void sleeping_thread_to_gdb_regs ( unsigned long gdb_regs,
struct task_struct p 
)

Definition at line 223 of file kgdb.c.

Variable Documentation

struct kgdb_arch arch_kgdb_ops
Initial value:
= {
.gdb_bpt_instr = { 0xc3, 0x3c },
}

Definition at line 382 of file kgdb.c.

struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM]
Initial value:
= {
{ "r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[0]) },
{ "r1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[1]) },
{ "r2", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[2]) },
{ "r3", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[3]) },
{ "r4", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[4]) },
{ "r5", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[5]) },
{ "r6", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[6]) },
{ "r7", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[7]) },
{ "r8", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[8]) },
{ "r9", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[9]) },
{ "r10", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[10]) },
{ "r11", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[11]) },
{ "r12", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[12]) },
{ "r13", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[13]) },
{ "r14", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[14]) },
{ "r15", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[15]) },
{ "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, pc) },
{ "pr", GDB_SIZEOF_REG, offsetof(struct pt_regs, pr) },
{ "sr", GDB_SIZEOF_REG, offsetof(struct pt_regs, sr) },
{ "gbr", GDB_SIZEOF_REG, offsetof(struct pt_regs, gbr) },
{ "mach", GDB_SIZEOF_REG, offsetof(struct pt_regs, mach) },
{ "macl", GDB_SIZEOF_REG, offsetof(struct pt_regs, macl) },
{ "vbr", GDB_SIZEOF_REG, -1 },
}

Definition at line 167 of file kgdb.c.