-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdbstub.h
53 lines (40 loc) · 1.07 KB
/
gdbstub.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (c) 2012-2022 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <[email protected]>
*/
#ifndef _GDBSTUB_H_
#define _GDBSTUB_H_
#include <sys/cdefs.h>
#include <stdint.h>
#include <cpu/instructions.h>
__BEGIN_DECLS
#define GDBSTUB_LOAD_ADDRESS (0x202FE000)
#define GDBSTUB_TRAPA_VECTOR_NUMBER (32)
static inline void __always_inline
gdb_break(void)
{
cpu_instr_trapa(GDBSTUB_TRAPA_VECTOR_NUMBER);
}
typedef void (*gdb_device_init_t)(void);
typedef uint8_t (*gdb_device_byte_read_t)(void);
typedef void (*gdb_device_byte_write_t)(uint8_t value);
typedef struct {
gdb_device_init_t init;
gdb_device_byte_read_t byte_read;
gdb_device_byte_write_t byte_write;
} __aligned(16) gdb_device_t;
typedef struct {
unsigned int :8;
unsigned int major:8;
unsigned int minor:8;
unsigned int patch:8;
} __packed gdb_version_t;
typedef struct {
gdb_version_t version;
void (*init)(void);
gdb_device_t *device;
} __aligned(16) gdbstub_t;
__END_DECLS
#endif /* !_GDBSTUB_H_ */