From 239ca5e497dda2c151009d664d500086a5c2173a Mon Sep 17 00:00:00 2001 From: Przemyslaw Wirkus Date: Thu, 26 Nov 2020 12:09:01 +0000 Subject: [PATCH] gdb/aarch64: Add named flags for FPCR and FPSR registers This patch updates FPCR (Floating-point Control Register) and FPSR (Floating-point Status Register) named fields in AArch64. For detailed description of named register FPCR and FPSR bit fields see [1] and [2]. Please not that bit fields FIZ, AH and NEP (bits 0, 1 and 2 respectively) in FPCR are defined starting from Armv8.7 architecture. [1]: https://developer.arm.com/docs/ddi0595/i/aarch64-system-registers/fpcr [2]: https://developer.arm.com/docs/ddi0595/i/aarch64-system-registers/fpsr Example: >>> info all-registers fpsr fpsr 0x10 [ IXC ] >>> info all-registers fpcr fpcr 0x0 [ RMode=0 ] --- gdb/ChangeLog | 5 +++ gdb/features/aarch64-fpu.c | 33 +++++++++++++++- gdb/features/aarch64-fpu.xml | 74 +++++++++++++++++++++++++++++++++++- 3 files changed, 108 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0379a4c2f92..aa08449d100 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-11-26 Przemyslaw Wirkus + + * features/aarch64-fpu.c (create_feature_aarch64_fpu): Regenerate. + * features/aarch64-fpu.xml: Add named FPCR and FPSR register bit-fields. + 2020-11-25 Tom Tromey * eval.c (evaluate_subexp_standard): Remove unnecessary diff --git a/gdb/features/aarch64-fpu.c b/gdb/features/aarch64-fpu.c index 87e394656fc..5b636a5f4d2 100644 --- a/gdb/features/aarch64-fpu.c +++ b/gdb/features/aarch64-fpu.c @@ -99,6 +99,35 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum) field_type = tdesc_named_type (feature, "vnq"); tdesc_add_field (type_with_fields, "q", field_type); + type_with_fields = tdesc_create_flags (feature, "fpsr_flags", 4); + tdesc_add_flag (type_with_fields, 0, "IOC"); + tdesc_add_flag (type_with_fields, 1, "DZC"); + tdesc_add_flag (type_with_fields, 2, "OFC"); + tdesc_add_flag (type_with_fields, 3, "UFC"); + tdesc_add_flag (type_with_fields, 4, "IXC"); + tdesc_add_flag (type_with_fields, 7, "IDC"); + tdesc_add_flag (type_with_fields, 27, "QC"); + tdesc_add_flag (type_with_fields, 28, "V"); + tdesc_add_flag (type_with_fields, 29, "C"); + tdesc_add_flag (type_with_fields, 30, "Z"); + tdesc_add_flag (type_with_fields, 31, "N"); + + type_with_fields = tdesc_create_flags (feature, "fpcr_flags", 4); + tdesc_add_flag (type_with_fields, 0, "FIZ"); + tdesc_add_flag (type_with_fields, 1, "AH"); + tdesc_add_flag (type_with_fields, 2, "NEP"); + tdesc_add_flag (type_with_fields, 8, "IOE"); + tdesc_add_flag (type_with_fields, 9, "DZE"); + tdesc_add_flag (type_with_fields, 10, "OFE"); + tdesc_add_flag (type_with_fields, 11, "UFE"); + tdesc_add_flag (type_with_fields, 12, "IXE"); + tdesc_add_flag (type_with_fields, 15, "IDE"); + tdesc_add_flag (type_with_fields, 19, "FZ16"); + tdesc_add_bitfield (type_with_fields, "RMode", 22, 23); + tdesc_add_flag (type_with_fields, 24, "FZ"); + tdesc_add_flag (type_with_fields, 25, "DN"); + tdesc_add_flag (type_with_fields, 26, "AHP"); + regnum = 34; tdesc_create_reg (feature, "v0", regnum++, 1, NULL, 128, "aarch64v"); tdesc_create_reg (feature, "v1", regnum++, 1, NULL, 128, "aarch64v"); @@ -132,7 +161,7 @@ create_feature_aarch64_fpu (struct target_desc *result, long regnum) tdesc_create_reg (feature, "v29", regnum++, 1, NULL, 128, "aarch64v"); tdesc_create_reg (feature, "v30", regnum++, 1, NULL, 128, "aarch64v"); tdesc_create_reg (feature, "v31", regnum++, 1, NULL, 128, "aarch64v"); - tdesc_create_reg (feature, "fpsr", regnum++, 1, NULL, 32, "int"); - tdesc_create_reg (feature, "fpcr", regnum++, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "fpsr", regnum++, 1, NULL, 32, "fpsr_flags"); + tdesc_create_reg (feature, "fpcr", regnum++, 1, NULL, 32, "fpcr_flags"); return regnum; } diff --git a/gdb/features/aarch64-fpu.xml b/gdb/features/aarch64-fpu.xml index eae763c4b41..3862f0c4f08 100644 --- a/gdb/features/aarch64-fpu.xml +++ b/gdb/features/aarch64-fpu.xml @@ -83,6 +83,76 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.30.2