1bbfa199cSmhorne /*- 2bbfa199cSmhorne * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3bbfa199cSmhorne * 4bbfa199cSmhorne * Copyright (c) 2020 The FreeBSD Foundation 5bbfa199cSmhorne * 6bbfa199cSmhorne * This software was developed by Mitchell Horne under sponsorship from 7bbfa199cSmhorne * the FreeBSD Foundation. 8bbfa199cSmhorne * 9bbfa199cSmhorne * Redistribution and use in source and binary forms, with or without 10bbfa199cSmhorne * modification, are permitted provided that the following conditions 11bbfa199cSmhorne * are met: 12bbfa199cSmhorne * 1. Redistributions of source code must retain the above copyright 13bbfa199cSmhorne * notice, this list of conditions and the following disclaimer. 14bbfa199cSmhorne * 2. Redistributions in binary form must reproduce the above copyright 15bbfa199cSmhorne * notice, this list of conditions and the following disclaimer in the 16bbfa199cSmhorne * documentation and/or other materials provided with the distribution. 17bbfa199cSmhorne * 18bbfa199cSmhorne * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19bbfa199cSmhorne * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20bbfa199cSmhorne * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21bbfa199cSmhorne * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22bbfa199cSmhorne * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23bbfa199cSmhorne * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24bbfa199cSmhorne * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25bbfa199cSmhorne * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26bbfa199cSmhorne * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27bbfa199cSmhorne * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28bbfa199cSmhorne * SUCH DAMAGE. 29bbfa199cSmhorne */ 30bbfa199cSmhorne 31bbfa199cSmhorne #ifndef _MACHINE_GDB_MACHDEP_H_ 32bbfa199cSmhorne #define _MACHINE_GDB_MACHDEP_H_ 33bbfa199cSmhorne 34bbfa199cSmhorne #define GDB_BUFSZ 4096 35bbfa199cSmhorne #define GDB_NREGS 68 36bbfa199cSmhorne #define GDB_REG_X0 0 37bbfa199cSmhorne #define GDB_REG_X29 29 38bbfa199cSmhorne #define GDB_REG_LR 30 39bbfa199cSmhorne #define GDB_REG_SP 31 40bbfa199cSmhorne #define GDB_REG_PC 32 41bbfa199cSmhorne #define GDB_REG_CSPR 33 42bbfa199cSmhorne #define GDB_REG_V0 34 43bbfa199cSmhorne #define GDB_REG_V31 65 44bbfa199cSmhorne #define GDB_REG_FPSR 66 45bbfa199cSmhorne #define GDB_REG_FPCR 67 46bbfa199cSmhorne _Static_assert(GDB_BUFSZ >= (GDB_NREGS * 16), "buffer fits 'g' regs"); 47bbfa199cSmhorne 48bbfa199cSmhorne static __inline size_t 49bbfa199cSmhorne gdb_cpu_regsz(int regnum) 50bbfa199cSmhorne { 51bbfa199cSmhorne if (regnum == GDB_REG_CSPR || regnum == GDB_REG_FPSR || 52bbfa199cSmhorne regnum == GDB_REG_FPCR) 53bbfa199cSmhorne return (4); 54bbfa199cSmhorne else if (regnum >= GDB_REG_V0 && regnum <= GDB_REG_V31) 55bbfa199cSmhorne return (16); 56bbfa199cSmhorne 57bbfa199cSmhorne return (8); 58bbfa199cSmhorne } 59bbfa199cSmhorne 60bbfa199cSmhorne static __inline int 61bbfa199cSmhorne gdb_cpu_query(void) 62bbfa199cSmhorne { 63bbfa199cSmhorne return (0); 64bbfa199cSmhorne } 65bbfa199cSmhorne 66bbfa199cSmhorne static __inline void * 67bbfa199cSmhorne gdb_begin_write(void) 68bbfa199cSmhorne { 69bbfa199cSmhorne return (NULL); 70bbfa199cSmhorne } 71bbfa199cSmhorne 72bbfa199cSmhorne static __inline void 73bbfa199cSmhorne gdb_end_write(void *arg __unused) 74bbfa199cSmhorne { 75bbfa199cSmhorne } 76bbfa199cSmhorne 77bbfa199cSmhorne void *gdb_cpu_getreg(int, size_t *); 78bbfa199cSmhorne void gdb_cpu_setreg(int, void *); 79bbfa199cSmhorne int gdb_cpu_signal(int, int); 80bbfa199cSmhorne 81bbfa199cSmhorne #endif /* !_MACHINE_GDB_MACHDEP_H_ */ 82