amd64-ravenscar-thread.c revision 1.1 1 1.1 christos /* Ravenscar x86-64 target support.
2 1.1 christos
3 1.1 christos Copyright (C) 2020-2023 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 "defs.h"
21 1.1 christos #include "gdbarch.h"
22 1.1 christos #include "gdbcore.h"
23 1.1 christos #include "regcache.h"
24 1.1 christos #include "amd64-tdep.h"
25 1.1 christos #include "inferior.h"
26 1.1 christos #include "ravenscar-thread.h"
27 1.1 christos #include "amd64-ravenscar-thread.h"
28 1.1 christos
29 1.1 christos /* x86-64 Ravenscar stores registers as:
30 1.1 christos
31 1.1 christos type Context_Buffer is record
32 1.1 christos RIP : System.Address;
33 1.1 christos RFLAGS : EFLAGS;
34 1.1 christos RSP : System.Address;
35 1.1 christos
36 1.1 christos RBX : System.Address;
37 1.1 christos RBP : System.Address;
38 1.1 christos R12 : System.Address;
39 1.1 christos R13 : System.Address;
40 1.1 christos R14 : System.Address;
41 1.1 christos R15 : System.Address;
42 1.1 christos end record;
43 1.1 christos */
44 1.1 christos static const int register_layout[] =
45 1.1 christos {
46 1.1 christos /* RAX */ -1,
47 1.1 christos /* RBX */ 3 * 8,
48 1.1 christos /* RCX */ -1,
49 1.1 christos /* RDX */ -1,
50 1.1 christos /* RSI */ -1,
51 1.1 christos /* RDI */ -1,
52 1.1 christos /* RBP */ 4 * 8,
53 1.1 christos /* RSP */ 2 * 8,
54 1.1 christos /* R8 */ -1,
55 1.1 christos /* R9 */ -1,
56 1.1 christos /* R10 */ -1,
57 1.1 christos /* R11 */ -1,
58 1.1 christos /* R12 */ 5 * 8,
59 1.1 christos /* R13 */ 6 * 8,
60 1.1 christos /* R14 */ 7 * 8,
61 1.1 christos /* R15 */ 8 * 8,
62 1.1 christos /* RIP */ 0 * 8,
63 1.1 christos /* EFLAGS */ 1 * 8,
64 1.1 christos };
65 1.1 christos
66 1.1 christos /* The ravenscar_arch_ops vector for AMD64 targets. */
67 1.1 christos
68 1.1 christos static struct ravenscar_arch_ops amd64_ravenscar_ops (register_layout);
69 1.1 christos
70 1.1 christos /* Register amd64_ravenscar_ops in GDBARCH. */
71 1.1 christos
72 1.1 christos void
73 1.1 christos register_amd64_ravenscar_ops (struct gdbarch *gdbarch)
74 1.1 christos {
75 1.1 christos set_gdbarch_ravenscar_ops (gdbarch, &amd64_ravenscar_ops);
76 1.1 christos }
77