Home | History | Annotate | Line # | Download | only in gdb
      1      1.1  christos /* Ravenscar x86-64 target support.
      2      1.1  christos 
      3  1.1.1.2  christos    Copyright (C) 2020-2024 Free Software Foundation, Inc.
      4      1.1  christos 
      5      1.1  christos    This file is part of GDB.
      6      1.1  christos 
      7      1.1  christos    This program is free software; you can redistribute it and/or modify
      8      1.1  christos    it under the terms of the GNU General Public License as published by
      9      1.1  christos    the Free Software Foundation; either version 3 of the License, or
     10      1.1  christos    (at your option) any later version.
     11      1.1  christos 
     12      1.1  christos    This program is distributed in the hope that it will be useful,
     13      1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14      1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15      1.1  christos    GNU General Public License for more details.
     16      1.1  christos 
     17      1.1  christos    You should have received a copy of the GNU General Public License
     18      1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     19      1.1  christos 
     20      1.1  christos #include "gdbarch.h"
     21      1.1  christos #include "gdbcore.h"
     22      1.1  christos #include "regcache.h"
     23      1.1  christos #include "amd64-tdep.h"
     24      1.1  christos #include "inferior.h"
     25      1.1  christos #include "ravenscar-thread.h"
     26      1.1  christos #include "amd64-ravenscar-thread.h"
     27      1.1  christos 
     28      1.1  christos /* x86-64 Ravenscar stores registers as:
     29      1.1  christos 
     30      1.1  christos    type Context_Buffer is record
     31      1.1  christos       RIP    : System.Address;
     32      1.1  christos       RFLAGS : EFLAGS;
     33      1.1  christos       RSP    : System.Address;
     34      1.1  christos 
     35      1.1  christos       RBX    : System.Address;
     36      1.1  christos       RBP    : System.Address;
     37      1.1  christos       R12    : System.Address;
     38      1.1  christos       R13    : System.Address;
     39      1.1  christos       R14    : System.Address;
     40      1.1  christos       R15    : System.Address;
     41      1.1  christos    end record;
     42      1.1  christos */
     43      1.1  christos static const int register_layout[] =
     44      1.1  christos {
     45      1.1  christos   /* RAX */ -1,
     46      1.1  christos   /* RBX */ 3 * 8,
     47      1.1  christos   /* RCX */ -1,
     48      1.1  christos   /* RDX */ -1,
     49      1.1  christos   /* RSI */ -1,
     50      1.1  christos   /* RDI */ -1,
     51      1.1  christos   /* RBP */ 4 * 8,
     52      1.1  christos   /* RSP */ 2 * 8,
     53      1.1  christos   /* R8 */ -1,
     54      1.1  christos   /* R9 */ -1,
     55      1.1  christos   /* R10 */ -1,
     56      1.1  christos   /* R11 */ -1,
     57      1.1  christos   /* R12 */ 5 * 8,
     58      1.1  christos   /* R13 */ 6 * 8,
     59      1.1  christos   /* R14 */ 7 * 8,
     60      1.1  christos   /* R15 */ 8 * 8,
     61      1.1  christos   /* RIP */ 0 * 8,
     62      1.1  christos   /* EFLAGS */ 1 * 8,
     63      1.1  christos };
     64      1.1  christos 
     65      1.1  christos /* The ravenscar_arch_ops vector for AMD64 targets.  */
     66      1.1  christos 
     67      1.1  christos static struct ravenscar_arch_ops amd64_ravenscar_ops (register_layout);
     68      1.1  christos 
     69      1.1  christos /* Register amd64_ravenscar_ops in GDBARCH.  */
     70      1.1  christos 
     71      1.1  christos void
     72      1.1  christos register_amd64_ravenscar_ops (struct gdbarch *gdbarch)
     73      1.1  christos {
     74      1.1  christos   set_gdbarch_ravenscar_ops (gdbarch, &amd64_ravenscar_ops);
     75      1.1  christos }
     76