/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2021 Mitchell Horne <[email protected]>4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8*9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#ifndef _MACHINE_GDB_MACHDEP_H_29#define _MACHINE_GDB_MACHDEP_H_3031#define GDB_BUFSZ 409632#define GDB_NREGS 3333#define GDB_REG_ZERO 034#define GDB_REG_RA 135#define GDB_REG_SP 236#define GDB_REG_GP 337#define GDB_REG_TP 438#define GDB_REG_T0 539#define GDB_REG_FP 840#define GDB_REG_S1 941#define GDB_REG_A0 1042#define GDB_REG_S2 1843#define GDB_REG_T3 2844#define GDB_REG_PC 3245#define GDB_REG_CSR_BASE 6546#define GDB_REG_SSTATUS (GDB_REG_CSR_BASE + 0x100)47#define GDB_REG_SCAUSE (GDB_REG_CSR_BASE + 0x142)48#define GDB_REG_STVAL (GDB_REG_CSR_BASE + 0x143)49_Static_assert(GDB_BUFSZ >= (GDB_NREGS * 8), "buffer fits 'g' regs");5051static __inline size_t52gdb_cpu_regsz(int regnum __unused)53{5455return (8);56}5758static __inline int59gdb_cpu_query(void)60{61return (0);62}6364static __inline void *65gdb_begin_write(void)66{6768return (NULL);69}7071static __inline void72gdb_end_write(void *arg __unused)73{7475}7677static __inline void78gdb_cpu_stop_reason(int type __unused, int code __unused)79{8081}8283void *gdb_cpu_getreg(int, size_t *);84void gdb_cpu_setreg(int, void *);85int gdb_cpu_signal(int, int);8687#endif /* !_MACHINE_GDB_MACHDEP_H_ */888990