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
13FILE_SECBOOT ( FORBIDDEN );
14
15#include <stdint.h>
16
17typedef unsigned long gdbreg_t;
18
19/* The register snapshot, this must be in sync with interrupt handler and the
20 * GDB protocol. */
21enum {
40};
41
42/* Breakpoint types */
43enum {
49};
50
51/* Interrupt vectors */
52extern void gdbmach_sigfpe ( void );
53extern void gdbmach_sigtrap ( void );
54extern void gdbmach_sigstkflt ( void );
55extern void gdbmach_sigill ( void );
56
57static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
58 regs [ GDBMACH_EIP ] = pc;
59}
60
61static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
62 regs [ GDBMACH_EFLAGS ] &= ~( 1 << 8 ); /* Trace Flag (TF) */
63 regs [ GDBMACH_EFLAGS ] |= ( step << 8 );
64}
65
66static inline void gdbmach_breakpoint ( void ) {
67 __asm__ __volatile__ ( "int $3\n" );
68}
69
70extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len, int enable );
71
72extern void gdbmach_init ( void );
73
74#endif /* GDBMACH_H */
void gdbmach_sigstkflt(void)
@ GDBMACH_BPMEM
Definition gdbmach.h:44
@ GDBMACH_WATCH
Definition gdbmach.h:46
@ GDBMACH_BPHW
Definition gdbmach.h:45
@ GDBMACH_RWATCH
Definition gdbmach.h:47
@ GDBMACH_AWATCH
Definition gdbmach.h:48
static void gdbmach_breakpoint(void)
Definition gdbmach.h:66
void gdbmach_sigill(void)
void gdbmach_sigtrap(void)
unsigned long gdbreg_t
Definition gdbmach.h:17
int gdbmach_set_breakpoint(int type, unsigned long addr, size_t len, int enable)
Set hardware breakpoint.
Definition gdbmach.c:134
@ GDBMACH_SS
Definition gdbmach.h:33
@ GDBMACH_ES
Definition gdbmach.h:35
@ GDBMACH_EFLAGS
Definition gdbmach.h:31
@ GDBMACH_GS
Definition gdbmach.h:37
@ GDBMACH_CS
Definition gdbmach.h:32
@ GDBMACH_EBP
Definition gdbmach.h:27
@ GDBMACH_EAX
Definition gdbmach.h:22
@ GDBMACH_ESP
Definition gdbmach.h:26
@ GDBMACH_DS
Definition gdbmach.h:34
@ GDBMACH_NREGS
Definition gdbmach.h:38
@ GDBMACH_ECX
Definition gdbmach.h:23
@ GDBMACH_EBX
Definition gdbmach.h:25
@ GDBMACH_ESI
Definition gdbmach.h:28
@ GDBMACH_EDI
Definition gdbmach.h:29
@ GDBMACH_EDX
Definition gdbmach.h:24
@ GDBMACH_EIP
Definition gdbmach.h:30
@ GDBMACH_FS
Definition gdbmach.h:36
void gdbmach_init(void)
Initialise GDB.
Definition gdbmach.c:242
static void gdbmach_set_pc(gdbreg_t *regs, gdbreg_t pc)
Definition gdbmach.h:57
static void gdbmach_set_single_step(gdbreg_t *regs, int step)
Definition gdbmach.h:61
void gdbmach_sigfpe(void)
__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))
ring len
Length.
Definition dwmac.h:226
uint32_t addr
Buffer address.
Definition dwmac.h:9
uint32_t type
Operating system type.
Definition ena.h:1
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define GDBMACH_SIZEOF_REGS
Definition gdbmach.h:25
__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")
void step(void)
Single-step a single process.
Definition process.c:99
struct i386_regs regs
Definition registers.h:1