iPXE
gdbmach.h
Go to the documentation of this file.
1 #ifndef GDBMACH_H
2 #define GDBMACH_H
3 
4 /** @file
5  *
6  * GDB architecture specifics
7  *
8  * This file declares functions for manipulating the machine state and
9  * debugging context.
10  *
11  */
12 
13 #include <stdint.h>
14 
15 typedef unsigned long gdbreg_t;
16 
17 /* The register snapshot, this must be in sync with interrupt handler and the
18  * GDB protocol. */
19 enum {
38 };
39 
40 /* Breakpoint types */
41 enum {
47 };
48 
49 /* Interrupt vectors */
50 extern void gdbmach_sigfpe ( void );
51 extern void gdbmach_sigtrap ( void );
52 extern void gdbmach_sigstkflt ( void );
53 extern void gdbmach_sigill ( void );
54 
55 static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
56  regs [ GDBMACH_EIP ] = pc;
57 }
58 
59 static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
60  regs [ GDBMACH_EFLAGS ] &= ~( 1 << 8 ); /* Trace Flag (TF) */
61  regs [ GDBMACH_EFLAGS ] |= ( step << 8 );
62 }
63 
64 static inline void gdbmach_breakpoint ( void ) {
65  __asm__ __volatile__ ( "int $3\n" );
66 }
67 
68 extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len, int enable );
69 
70 extern void gdbmach_init ( void );
71 
72 #endif /* GDBMACH_H */
static void gdbmach_breakpoint(void)
Definition: gdbmach.h:64
static void gdbmach_set_single_step(gdbreg_t *regs, int step)
Definition: gdbmach.h:59
unsigned long gdbreg_t
Definition: gdbmach.h:15
static void gdbmach_set_pc(gdbreg_t *regs, gdbreg_t pc)
Definition: gdbmach.h:55
void gdbmach_sigtrap(void)
u32 addr
Definition: sky2.h:8
void gdbmach_sigstkflt(void)
__asm__ __volatile__("\n1:\n\t" "movb -1(%3,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %4, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c), "+m"(*value) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax")
int gdbmach_set_breakpoint(int type, unsigned long addr, size_t len, int enable)
Set hardware breakpoint.
Definition: gdbmach.c:134
void gdbmach_init(void)
Initialise GDB.
Definition: gdbmach.c:242
struct i386_regs regs
Definition: registers.h:15
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
uint32_t len
Length.
Definition: ena.h:14
uint32_t type
Operating system type.
Definition: ena.h:12
void step(void)
Single-step a single process.
Definition: process.c:98
void gdbmach_sigfpe(void)
void gdbmach_sigill(void)