/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2006 Marcel Moolenaar4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9*10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR17* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES18* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.19* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,20* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT21* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,22* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY23* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF25* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.26*/2728#ifndef _MACHINE_GDB_MACHDEP_H_29#define _MACHINE_GDB_MACHDEP_H_3031#ifdef BOOKE32#define PPC_GDB_NREGS0 133#define PPC_GDB_NREGS4 (70 + 1)34#define PPC_GDB_NREGS8 (1 + 32)35#define PPC_GDB_NREGS16 03637#else38/*39* 0 - 32*GPR(4/8)40* 32 - 32*FPR(8)41* 64 - PC, PS (4/8)42* 66 - CR (4)43* 67 - LR, CTR (4/8)44* 69 - XER, FPSCR (4)45* 71 - 32*VR(16)46* 103 - VSCR, VRSAVE (4)47*/4849#define PPC_REGNUM_R0 050#define PPC_REGNUM_R31 (PPC_REGNUM_R0 + 31)51#define PPC_REGNUM_FR0 3252#define PPC_REGNUM_FR31 (PPC_REGNUM_FR0 + 31)53#define PPC_REGNUM_PC 6454#define PPC_REGNUM_PS 6555#define PPC_REGNUM_CR 6656#define PPC_REGNUM_LR 6757#define PPC_REGNUM_CTR 6858#define PPC_REGNUM_XER 6959#define PPC_REGNUM_FPSCR 7060#define PPC_REGNUM_VR0 7161#define PPC_REGNUM_VR31 (PPC_REGNUM_VR0 + 31)6263#define PPC_GDB_NREGS0 06465#ifdef __powerpc64__66#define PPC_GDB_NREGS4 567#define PPC_GDB_NREGS8 (64 + 4)68#else69#define PPC_GDB_NREGS4 (32 + 7 + 2)70#define PPC_GDB_NREGS8 3271#endif7273#define PPC_GDB_NREGS16 3274#endif7576#define GDB_NREGS (PPC_GDB_NREGS0 + PPC_GDB_NREGS4 + \77PPC_GDB_NREGS8 + PPC_GDB_NREGS16)78#define GDB_REG_PC 647980#define GDB_BUFSZ (PPC_GDB_NREGS4 * 8 + \81PPC_GDB_NREGS8 * 16 + \82PPC_GDB_NREGS16 * 32)8384static __inline size_t85gdb_cpu_regsz(int regnum)86{8788#ifdef BOOKE89if (regnum == 70)90return (0);91if (regnum == 71 || regnum >= 73)92return (8);93#else94#ifdef __powerpc64__95if ((regnum >= PPC_REGNUM_R0 && regnum <= PPC_REGNUM_PS) ||96regnum == PPC_REGNUM_LR || regnum == PPC_REGNUM_CTR)97return (8);98#else99if (regnum >= PPC_REGNUM_FR0 && regnum <= PPC_REGNUM_FR31)100return (8);101#endif102if (regnum >= PPC_REGNUM_VR0 && regnum <= PPC_REGNUM_VR31)103return (16);104#endif105return (4);106}107108static __inline int109gdb_cpu_query(void)110{111112return (0);113}114115static __inline void *116gdb_begin_write(void)117{118119return (NULL);120}121122static __inline void123gdb_end_write(void *arg __unused)124{125126}127128static __inline void129gdb_cpu_stop_reason(int type __unused, int code __unused)130{131132}133134void *gdb_cpu_getreg(int, size_t *);135void gdb_cpu_setreg(int, void *);136int gdb_cpu_signal(int, int);137void gdb_cpu_do_offsets(void);138139#endif /* !_MACHINE_GDB_MACHDEP_H_ */140141142