Commit | Line | Data |
---|---|---|
122394f1 AH |
1 | /* Common target dependent for AArch64 systems. |
2 | ||
3 | Copyright (C) 2018 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #ifndef AARCH64_SVE_LINUX_PTRACE_H | |
21 | #define AARCH64_SVE_LINUX_PTRACE_H | |
22 | ||
23 | /* Where indicated, this file contains defines and macros lifted directly from | |
24 | the Linux kernel headers, with no modification. | |
25 | Refer to Linux kernel documentation for details. */ | |
26 | ||
27 | #include <asm/sigcontext.h> | |
28 | #include <sys/utsname.h> | |
29 | #include <sys/ptrace.h> | |
30 | #include <asm/ptrace.h> | |
31 | ||
32 | /* Read VQ for the given tid using ptrace. If SVE is not supported then zero | |
33 | is returned (on a system that supports SVE, then VQ cannot be zero). */ | |
34 | ||
39bfb937 | 35 | uint64_t aarch64_sve_get_vq (int tid); |
122394f1 AH |
36 | |
37 | /* Structures and defines taken from sigcontext.h. */ | |
38 | ||
39 | #ifndef SVE_SIG_ZREGS_SIZE | |
40 | ||
41 | #define SVE_VQ_BYTES 16 /* number of bytes per quadword */ | |
42 | ||
43 | #define SVE_VQ_MIN 1 | |
44 | #define SVE_VQ_MAX 512 | |
45 | ||
46 | #define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES) | |
47 | #define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES) | |
48 | ||
49 | #define SVE_NUM_ZREGS 32 | |
50 | #define SVE_NUM_PREGS 16 | |
51 | ||
52 | #define sve_vl_valid(vl) \ | |
53 | ((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX) | |
54 | ||
55 | #endif /* SVE_SIG_ZREGS_SIZE. */ | |
56 | ||
57 | ||
58 | /* Structures and defines taken from ptrace.h. */ | |
59 | ||
60 | #ifndef SVE_PT_SVE_ZREG_SIZE | |
61 | ||
62 | struct user_sve_header { | |
63 | __u32 size; /* total meaningful regset content in bytes */ | |
64 | __u32 max_size; /* maxmium possible size for this thread */ | |
65 | __u16 vl; /* current vector length */ | |
66 | __u16 max_vl; /* maximum possible vector length */ | |
67 | __u16 flags; | |
68 | __u16 __reserved; | |
69 | }; | |
70 | ||
71 | #endif /* SVE_PT_SVE_ZREG_SIZE. */ | |
72 | ||
73 | #endif /* aarch64-sve-linux-ptrace.h */ |