GDB (xrefs)
Loading...
Searching...
No Matches
aarch64-scalable-linux.c
Go to the documentation of this file.
1/* Common Linux arch-specific functionality for AArch64 scalable
2 extensions: SVE and SME.
3
4 Copyright (C) 2023 Free Software Foundation, Inc.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
22#include "arch/aarch64.h"
23#include "gdbsupport/byte-vector.h"
24#include "gdbsupport/common-regcache.h"
25
26/* See arch/aarch64-scalable-linux.h */
27
28bool
29sve_state_is_empty (const struct reg_buffer_common *reg_buf)
30{
31 /* Instead of allocating a buffer with the size of the current vector
32 length, just use a buffer that is big enough for all cases. */
33 gdb_byte zero_buffer[256];
34
35 /* Zero it out. */
36 memset (zero_buffer, 0, 256);
37
38 /* Are any of the Z registers set (non-zero) after the first 128 bits? */
39 for (int i = 0; i < AARCH64_SVE_Z_REGS_NUM; i++)
40 {
41 if (!reg_buf->raw_compare (AARCH64_SVE_Z0_REGNUM + i, zero_buffer,
43 return false;
44 }
45
46 /* Are any of the P registers set (non-zero)? */
47 for (int i = 0; i < AARCH64_SVE_P_REGS_NUM; i++)
48 {
49 if (!reg_buf->raw_compare (AARCH64_SVE_P0_REGNUM + i, zero_buffer, 0))
50 return false;
51 }
52
53 /* Is the FFR register set (non-zero)? */
54 return reg_buf->raw_compare (AARCH64_SVE_FFR_REGNUM, zero_buffer, 0);
55}
bool sve_state_is_empty(const struct reg_buffer_common *reg_buf)
#define AARCH64_SVE_P_REGS_NUM
Definition aarch64.h:171
@ AARCH64_SVE_FFR_REGNUM
Definition aarch64.h:130
@ AARCH64_SVE_Z0_REGNUM
Definition aarch64.h:123
@ AARCH64_SVE_P0_REGNUM
Definition aarch64.h:127
#define V_REGISTER_SIZE
Definition aarch64.h:141
#define AARCH64_SVE_Z_REGS_NUM
Definition aarch64.h:170