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 */
void gdbmach_init(void)
Initialise GDB.
Definition: gdbmach.c:241
unsigned long gdbreg_t
Definition: gdbmach.h:15
uint32_t type
Operating system type.
Definition: ena.h:12
static void gdbmach_breakpoint(void)
Definition: gdbmach.h:64
int gdbmach_set_breakpoint(int type, unsigned long addr, size_t len, int enable)
Set hardware breakpoint.
Definition: gdbmach.c:133
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
void gdbmach_sigstkflt(void)
struct i386_regs regs
Definition: registers.h:15
void gdbmach_sigfpe(void)
void gdbmach_sigtrap(void)
__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")
u32 addr
Definition: sky2.h:8
void step(void)
Single-step a single process.
Definition: process.c:98
void gdbmach_sigill(void)
static void gdbmach_set_pc(gdbreg_t *regs, gdbreg_t pc)
Definition: gdbmach.h:55
static void gdbmach_set_single_step(gdbreg_t *regs, int step)
Definition: gdbmach.h:59
uint32_t len
Length.
Definition: ena.h:14