gdb: fix vfork with multiple threads
[deliverable/binutils-gdb.git] / bfd / cpu-riscv.h
1 /* RISC-V spec version controlling support.
2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
3
4 This file is part of BFD, the Binary File Descriptor library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
20
21 enum riscv_spec_class
22 {
23 /* ISA spec. */
24 ISA_SPEC_CLASS_NONE = 0,
25 ISA_SPEC_CLASS_2P2,
26 ISA_SPEC_CLASS_20190608,
27 ISA_SPEC_CLASS_20191213,
28 ISA_SPEC_CLASS_DRAFT,
29
30 /* Privileged spec. */
31 PRIV_SPEC_CLASS_NONE,
32 PRIV_SPEC_CLASS_1P9P1,
33 PRIV_SPEC_CLASS_1P10,
34 PRIV_SPEC_CLASS_1P11,
35 PRIV_SPEC_CLASS_DRAFT,
36 };
37
38 struct riscv_spec
39 {
40 const char *name;
41 enum riscv_spec_class spec_class;
42 };
43
44 extern const struct riscv_spec riscv_isa_specs[];
45 extern const struct riscv_spec riscv_priv_specs[];
46
47 #define RISCV_GET_SPEC_CLASS(UTYPE, LTYPE, NAME, CLASS) \
48 do \
49 { \
50 if (NAME == NULL) \
51 break; \
52 \
53 int i_spec = UTYPE##_SPEC_CLASS_NONE + 1; \
54 for (; i_spec < UTYPE##_SPEC_CLASS_DRAFT; i_spec++) \
55 { \
56 int j_spec = i_spec - UTYPE##_SPEC_CLASS_NONE -1; \
57 if (riscv_##LTYPE##_specs[j_spec].name \
58 && strcmp (riscv_##LTYPE##_specs[j_spec].name, NAME) == 0)\
59 { \
60 CLASS = riscv_##LTYPE##_specs[j_spec].spec_class; \
61 break; \
62 } \
63 } \
64 } \
65 while (0)
66
67 #define RISCV_GET_SPEC_NAME(UTYPE, LTYPE, NAME, CLASS) \
68 (NAME) = riscv_##LTYPE##_specs[(CLASS) - UTYPE##_SPEC_CLASS_NONE - 1].name
69
70 #define RISCV_GET_ISA_SPEC_CLASS(NAME, CLASS) \
71 RISCV_GET_SPEC_CLASS(ISA, isa, NAME, CLASS)
72 #define RISCV_GET_PRIV_SPEC_CLASS(NAME, CLASS) \
73 RISCV_GET_SPEC_CLASS(PRIV, priv, NAME, CLASS)
74 #define RISCV_GET_PRIV_SPEC_NAME(NAME, CLASS) \
75 RISCV_GET_SPEC_NAME(PRIV, priv, NAME, CLASS)
76
77 extern void
78 riscv_get_priv_spec_class_from_numbers (unsigned int,
79 unsigned int,
80 unsigned int,
81 enum riscv_spec_class *);
This page took 0.034841 seconds and 4 git commands to generate.