2017-10-25 16:06:41 +08:00
|
|
|
/* Common target-dependent functionality for AArch64.
|
|
|
|
|
2018-01-01 12:43:02 +08:00
|
|
|
Copyright (C) 2017-2018 Free Software Foundation, Inc.
|
2017-10-25 16:06:41 +08:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#ifndef ARCH_AARCH64_H
|
|
|
|
#define ARCH_AARCH64_H
|
|
|
|
|
2018-02-28 00:21:52 +08:00
|
|
|
#include "common/tdesc.h"
|
2017-11-24 18:00:54 +08:00
|
|
|
|
2018-05-31 20:33:04 +08:00
|
|
|
/* Create the aarch64 target description. A non zero VQ value indicates both
|
|
|
|
the presence of SVE and the Vector Quotient - the number of 128bit chunks in
|
|
|
|
an SVE Z register. */
|
|
|
|
|
2018-06-01 23:37:45 +08:00
|
|
|
target_desc *aarch64_create_target_description (uint64_t vq);
|
2017-11-24 18:00:54 +08:00
|
|
|
|
2018-06-01 23:02:37 +08:00
|
|
|
/* Register numbers of various important registers.
|
|
|
|
Note that on SVE, the Z registers reuse the V register numbers and the V
|
|
|
|
registers become pseudo registers. */
|
2017-10-25 16:06:41 +08:00
|
|
|
enum aarch64_regnum
|
|
|
|
{
|
|
|
|
AARCH64_X0_REGNUM, /* First integer register. */
|
|
|
|
AARCH64_FP_REGNUM = AARCH64_X0_REGNUM + 29, /* Frame register, if used. */
|
|
|
|
AARCH64_LR_REGNUM = AARCH64_X0_REGNUM + 30, /* Return address. */
|
|
|
|
AARCH64_SP_REGNUM, /* Stack pointer. */
|
|
|
|
AARCH64_PC_REGNUM, /* Program counter. */
|
|
|
|
AARCH64_CPSR_REGNUM, /* Current Program Status Register. */
|
|
|
|
AARCH64_V0_REGNUM, /* First fp/vec register. */
|
|
|
|
AARCH64_V31_REGNUM = AARCH64_V0_REGNUM + 31, /* Last fp/vec register. */
|
2018-06-01 23:02:37 +08:00
|
|
|
AARCH64_SVE_Z0_REGNUM = AARCH64_V0_REGNUM, /* First SVE Z register. */
|
|
|
|
AARCH64_SVE_Z31_REGNUM = AARCH64_V31_REGNUM, /* Last SVE Z register. */
|
2017-10-25 16:06:41 +08:00
|
|
|
AARCH64_FPSR_REGNUM, /* Floating Point Status Register. */
|
|
|
|
AARCH64_FPCR_REGNUM, /* Floating Point Control Register. */
|
2018-06-01 23:02:37 +08:00
|
|
|
AARCH64_SVE_P0_REGNUM, /* First SVE predicate register. */
|
|
|
|
AARCH64_SVE_P15_REGNUM = AARCH64_SVE_P0_REGNUM + 15, /* Last SVE predicate
|
|
|
|
register. */
|
|
|
|
AARCH64_SVE_FFR_REGNUM, /* SVE First Fault Register. */
|
2018-08-22 16:22:12 +08:00
|
|
|
AARCH64_SVE_VG_REGNUM, /* SVE Vector Granule. */
|
2017-10-25 16:06:41 +08:00
|
|
|
|
|
|
|
/* Other useful registers. */
|
|
|
|
AARCH64_LAST_X_ARG_REGNUM = AARCH64_X0_REGNUM + 7,
|
|
|
|
AARCH64_STRUCT_RETURN_REGNUM = AARCH64_X0_REGNUM + 8,
|
|
|
|
AARCH64_LAST_V_ARG_REGNUM = AARCH64_V0_REGNUM + 7
|
|
|
|
};
|
|
|
|
|
|
|
|
#define AARCH64_X_REGS_NUM 31
|
|
|
|
#define AARCH64_V_REGS_NUM 32
|
2018-06-01 23:02:37 +08:00
|
|
|
#define AARCH64_SVE_Z_REGS_NUM AARCH64_V_REGS_NUM
|
|
|
|
#define AARCH64_SVE_P_REGS_NUM 16
|
2017-10-25 16:06:41 +08:00
|
|
|
#define AARCH64_NUM_REGS AARCH64_FPCR_REGNUM + 1
|
2018-06-01 23:02:37 +08:00
|
|
|
#define AARCH64_SVE_NUM_REGS AARCH64_SVE_VG_REGNUM + 1
|
|
|
|
|
2017-10-25 16:06:41 +08:00
|
|
|
|
2018-05-31 21:36:48 +08:00
|
|
|
/* There are a number of ways of expressing the current SVE vector size:
|
|
|
|
|
|
|
|
VL : Vector Length.
|
|
|
|
The number of bytes in an SVE Z register.
|
|
|
|
VQ : Vector Quotient.
|
|
|
|
The number of 128bit chunks in an SVE Z register.
|
2018-08-22 16:22:12 +08:00
|
|
|
VG : Vector Granule.
|
2018-05-31 21:36:48 +08:00
|
|
|
The number of 64bit chunks in an SVE Z register. */
|
|
|
|
|
|
|
|
#define sve_vg_from_vl(vl) ((vl) / 8)
|
|
|
|
#define sve_vl_from_vg(vg) ((vg) * 8)
|
Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)
Commit 122394f1476b1c925a281b15399119500c8231c1 ("Function for reading
the Aarch64 SVE vector length") has added macros to manipulate SVE
vector sizes based on Linux kernel sources, but did not guard them
with #ifndef's, which breaks the build when the system headers already
have these macros:
CXX aarch64-linux-nat.o
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:79: error: "sve_vq_from_vl" redefined [-Werror]
#define sve_vq_from_vl(vl) ((vl) / 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:154: note: this is the location of the previous definition
#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:80: error: "sve_vl_from_vq" redefined [-Werror]
#define sve_vl_from_vq(vq) ((vq) * 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:155: note: this is the location of the previous definition
#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
In order to fix this breakage, this commit guards the declaration of
the macros using #ifndef's.
gdb/ChangeLog:
2018-06-06 Sergio Durigan Junior <sergiodj@redhat.com>
* arch/aarch64.h (sve_vg_from_vl): Guard with #ifndef.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.
2018-06-06 05:55:39 +08:00
|
|
|
#ifndef sve_vq_from_vl
|
2018-05-31 21:36:48 +08:00
|
|
|
#define sve_vq_from_vl(vl) ((vl) / 0x10)
|
Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)
Commit 122394f1476b1c925a281b15399119500c8231c1 ("Function for reading
the Aarch64 SVE vector length") has added macros to manipulate SVE
vector sizes based on Linux kernel sources, but did not guard them
with #ifndef's, which breaks the build when the system headers already
have these macros:
CXX aarch64-linux-nat.o
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:79: error: "sve_vq_from_vl" redefined [-Werror]
#define sve_vq_from_vl(vl) ((vl) / 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:154: note: this is the location of the previous definition
#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:80: error: "sve_vl_from_vq" redefined [-Werror]
#define sve_vl_from_vq(vq) ((vq) * 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:155: note: this is the location of the previous definition
#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
In order to fix this breakage, this commit guards the declaration of
the macros using #ifndef's.
gdb/ChangeLog:
2018-06-06 Sergio Durigan Junior <sergiodj@redhat.com>
* arch/aarch64.h (sve_vg_from_vl): Guard with #ifndef.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.
2018-06-06 05:55:39 +08:00
|
|
|
#endif
|
|
|
|
#ifndef sve_vl_from_vq
|
2018-05-31 21:36:48 +08:00
|
|
|
#define sve_vl_from_vq(vq) ((vq) * 0x10)
|
Guard declarations of 'sve_{vq,vl}_from_{vl,vq}' macros on Aarch64 (and unbreak build)
Commit 122394f1476b1c925a281b15399119500c8231c1 ("Function for reading
the Aarch64 SVE vector length") has added macros to manipulate SVE
vector sizes based on Linux kernel sources, but did not guard them
with #ifndef's, which breaks the build when the system headers already
have these macros:
CXX aarch64-linux-nat.o
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:79: error: "sve_vq_from_vl" redefined [-Werror]
#define sve_vq_from_vl(vl) ((vl) / 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:154: note: this is the location of the previous definition
#define sve_vq_from_vl(vl) ((vl) / SVE_VQ_BYTES)
In file included from ../../gdb/aarch64-tdep.h:25,
from ../../gdb/aarch64-linux-nat.c:30:
../../gdb/arch/aarch64.h:80: error: "sve_vl_from_vq" redefined [-Werror]
#define sve_vl_from_vq(vq) ((vq) * 0x10)
In file included from /usr/include/bits/sigcontext.h:30,
from /usr/include/signal.h:291,
from build-gnulib/import/signal.h:52,
from ../../gdb/linux-nat.h:23,
from ../../gdb/aarch64-linux-nat.c:26:
/usr/include/asm/sigcontext.h:155: note: this is the location of the previous definition
#define sve_vl_from_vq(vq) ((vq) * SVE_VQ_BYTES)
In order to fix this breakage, this commit guards the declaration of
the macros using #ifndef's.
gdb/ChangeLog:
2018-06-06 Sergio Durigan Junior <sergiodj@redhat.com>
* arch/aarch64.h (sve_vg_from_vl): Guard with #ifndef.
(sve_vl_from_vg): Likewise.
(sve_vq_from_vl): Likewise.
(sve_vl_from_vq): Likewise.
(sve_vq_from_vg): Likewise.
(sve_vg_from_vq): Likewise.
2018-06-06 05:55:39 +08:00
|
|
|
#endif
|
2018-05-31 21:36:48 +08:00
|
|
|
#define sve_vq_from_vg(vg) (sve_vq_from_vl (sve_vl_from_vg (vg)))
|
|
|
|
#define sve_vg_from_vq(vq) (sve_vg_from_vl (sve_vl_from_vq (vq)))
|
|
|
|
|
|
|
|
|
2018-05-31 20:33:04 +08:00
|
|
|
/* Maximum supported VQ value. Increase if required. */
|
|
|
|
#define AARCH64_MAX_SVE_VQ 16
|
|
|
|
|
2017-10-25 16:06:41 +08:00
|
|
|
#endif /* ARCH_AARCH64_H */
|