Files
86Box/src/include/86box/gdbstub.h

80 lines
2.5 KiB
C
Raw Normal View History

2022-03-12 20:20:25 -03:00
/*
2022-03-17 15:49:24 -03:00
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
2022-03-12 20:20:25 -03:00
*
2022-03-17 15:49:24 -03:00
* This file is part of the 86Box distribution.
2022-03-12 20:20:25 -03:00
*
2022-03-17 15:49:24 -03:00
* Definitions for the GDB stub server.
2022-03-12 20:20:25 -03:00
*
*
*
2022-03-17 15:49:24 -03:00
* Authors: RichardG, <richardg867@gmail.com>
2022-03-12 20:20:25 -03:00
*
2022-03-17 15:49:24 -03:00
* Copyright 2022 RichardG.
2022-03-12 20:20:25 -03:00
*/
#ifndef EMU_GDBSTUB_H
2022-03-16 14:12:45 -03:00
#define EMU_GDBSTUB_H
#include <stdint.h>
2022-03-16 00:33:01 -03:00
#include <86box/mem.h>
2022-03-16 14:12:45 -03:00
#define GDBSTUB_MEM_READ 0
#define GDBSTUB_MEM_WRITE 16
#define GDBSTUB_MEM_AWATCH 32
2022-03-16 00:33:01 -03:00
enum {
2023-06-26 12:47:04 -04:00
GDBSTUB_EXEC = 0,
GDBSTUB_SSTEP = 1,
GDBSTUB_BREAK = 2,
GDBSTUB_BREAK_SW = 3,
GDBSTUB_BREAK_HW = 4,
GDBSTUB_BREAK_RWATCH = 5,
GDBSTUB_BREAK_WWATCH = 6,
GDBSTUB_BREAK_AWATCH = 7
2022-03-16 00:33:01 -03:00
};
2022-03-12 20:20:25 -03:00
#ifdef USE_GDBSTUB
2023-10-05 14:08:09 -03:00
# define GDBSTUB_MEM_ACCESS(addr, access, width) \
uint32_t gdbstub_page = (addr) >> MEM_GRANULARITY_BITS; \
if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) { \
uint32_t gdbstub_addrs[(width)]; \
for (int gdbstub_i = 0; gdbstub_i < (width); gdbstub_i++) \
gdbstub_addrs[gdbstub_i] = (addr) + gdbstub_i; \
gdbstub_mem_access(gdbstub_addrs, (access) | (width)); \
2022-03-16 14:12:45 -03:00
}
2022-03-16 00:33:01 -03:00
2023-10-05 14:08:09 -03:00
# define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width) \
uint32_t gdbstub_page = (addrs)[0] >> MEM_GRANULARITY_BITS; \
if (gdbstub_watch_pages[gdbstub_page >> 6] & (1ULL << (gdbstub_page & 63))) \
gdbstub_mem_access((addrs), (access) | (width));
2022-03-12 20:20:25 -03:00
2022-03-16 14:12:45 -03:00
extern int gdbstub_step, gdbstub_next_asap;
2022-03-16 00:33:01 -03:00
extern uint64_t gdbstub_watch_pages[(((uint32_t) -1) >> (MEM_GRANULARITY_BITS + 6)) + 1];
2022-12-15 22:23:43 +01:00
extern void gdbstub_cpu_init(void);
extern int gdbstub_instruction(void);
extern int gdbstub_int3(void);
2022-03-16 00:33:01 -03:00
extern void gdbstub_mem_access(uint32_t *addrs, int access);
2022-12-15 22:23:43 +01:00
extern void gdbstub_init(void);
extern void gdbstub_close(void);
2022-03-12 20:20:25 -03:00
#else
2022-03-16 14:12:45 -03:00
# define GDBSTUB_MEM_ACCESS(addr, access, width)
# define GDBSTUB_MEM_ACCESS_FAST(addrs, access, width)
2022-03-16 00:33:01 -03:00
2022-03-16 14:12:45 -03:00
# define gdbstub_step 0
# define gdbstub_next_asap 0
2022-03-12 20:20:25 -03:00
2022-03-16 14:12:45 -03:00
# define gdbstub_cpu_init()
# define gdbstub_instruction() 0
# define gdbstub_int3() 0
# define gdbstub_init()
# define gdbstub_close()
2022-03-12 20:20:25 -03:00
#endif
#endif