146280ae7SWarner Losh /*- 2c49761ddSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3c49761ddSPedro F. Giffuni * 472d44f31SMarcel Moolenaar * Copyright (c) 2004 Marcel Moolenaar 572d44f31SMarcel Moolenaar * All rights reserved. 672d44f31SMarcel Moolenaar * 772d44f31SMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 872d44f31SMarcel Moolenaar * modification, are permitted provided that the following conditions 972d44f31SMarcel Moolenaar * are met: 1072d44f31SMarcel Moolenaar * 1172d44f31SMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 1272d44f31SMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 1372d44f31SMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 1472d44f31SMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 1572d44f31SMarcel Moolenaar * documentation and/or other materials provided with the distribution. 1672d44f31SMarcel Moolenaar * 1772d44f31SMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1872d44f31SMarcel Moolenaar * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1972d44f31SMarcel Moolenaar * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2072d44f31SMarcel Moolenaar * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2172d44f31SMarcel Moolenaar * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2272d44f31SMarcel Moolenaar * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2372d44f31SMarcel Moolenaar * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2472d44f31SMarcel Moolenaar * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2572d44f31SMarcel Moolenaar * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2672d44f31SMarcel Moolenaar * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2772d44f31SMarcel Moolenaar * 2872d44f31SMarcel Moolenaar * $FreeBSD$ 2972d44f31SMarcel Moolenaar */ 3072d44f31SMarcel Moolenaar 3172d44f31SMarcel Moolenaar #ifndef _MACHINE_GDB_MACHDEP_H_ 3272d44f31SMarcel Moolenaar #define _MACHINE_GDB_MACHDEP_H_ 3372d44f31SMarcel Moolenaar 3479917681SConrad Meyer #define GDB_BUFSZ 4096 3572d44f31SMarcel Moolenaar #define GDB_NREGS 56 360ef474deSMitchell Horne #define GDB_REG_RAX 0 370ef474deSMitchell Horne #define GDB_REG_RBX 1 380ef474deSMitchell Horne #define GDB_REG_RCX 2 390ef474deSMitchell Horne #define GDB_REG_RDX 3 400ef474deSMitchell Horne #define GDB_REG_RSI 4 410ef474deSMitchell Horne #define GDB_REG_RDI 5 420ef474deSMitchell Horne #define GDB_REG_RBP 6 430ef474deSMitchell Horne #define GDB_REG_RSP 7 440ef474deSMitchell Horne #define GDB_REG_R8 8 450ef474deSMitchell Horne #define GDB_REG_R9 9 460ef474deSMitchell Horne #define GDB_REG_R10 10 470ef474deSMitchell Horne #define GDB_REG_R11 11 480ef474deSMitchell Horne #define GDB_REG_R12 12 490ef474deSMitchell Horne #define GDB_REG_R13 13 500ef474deSMitchell Horne #define GDB_REG_R14 14 510ef474deSMitchell Horne #define GDB_REG_R15 15 52470d8317SMarcel Moolenaar #define GDB_REG_PC 16 53*72939459SMitchell Horne #define GDB_REG_RFLAGS 17 54*72939459SMitchell Horne #define GDB_REG_CS 18 55*72939459SMitchell Horne #define GDB_REG_SS 19 5679917681SConrad Meyer _Static_assert(GDB_BUFSZ >= (GDB_NREGS * 16), "buffer fits 'g' regs"); 5772d44f31SMarcel Moolenaar 5872d44f31SMarcel Moolenaar static __inline size_t 5972d44f31SMarcel Moolenaar gdb_cpu_regsz(int regnum) 6072d44f31SMarcel Moolenaar { 6172d44f31SMarcel Moolenaar return ((regnum > 16 && regnum < 24) ? 4 : 8); 6272d44f31SMarcel Moolenaar } 6372d44f31SMarcel Moolenaar 6472d44f31SMarcel Moolenaar static __inline int 6572d44f31SMarcel Moolenaar gdb_cpu_query(void) 6672d44f31SMarcel Moolenaar { 6772d44f31SMarcel Moolenaar return (0); 6872d44f31SMarcel Moolenaar } 6972d44f31SMarcel Moolenaar 70beb24065SJonathan T. Looney void *gdb_begin_write(void); 7172d44f31SMarcel Moolenaar void *gdb_cpu_getreg(int, size_t *); 72bcc5241cSMarcel Moolenaar void gdb_cpu_setreg(int, void *); 73b1fb1bb1SMarcel Moolenaar int gdb_cpu_signal(int, int); 74beb24065SJonathan T. Looney void gdb_end_write(void *); 7572d44f31SMarcel Moolenaar 7672d44f31SMarcel Moolenaar #endif /* !_MACHINE_GDB_MACHDEP_H_ */ 77