Use uint64_t for SVE VQ
authorAlan Hayward <alan.hayward@arm.com>
Fri, 1 Jun 2018 15:37:45 +0000 (16:37 +0100)
committerAlan Hayward <alan.hayward@arm.com>
Mon, 4 Jun 2018 09:50:59 +0000 (10:50 +0100)
Previously VQ was of type long. Using uint64_t ensures it always matches the
same type as the VG register.
Note that in the Linux kernel, VQ is 16bits. We cast it up to 64bits
immediately after reading to ensure we always use the same type throughout
the code.

gdb/
* aarch64-tdep.c (aarch64_read_description): Use uint64_t for VQ.
* aarch64-tdep.h (aarch64_read_description): Likewise.
* arch/aarch64.c (aarch64_create_target_description): Likewise.
* arch/aarch64.h (aarch64_create_target_description): Likewise.
* features/aarch64-sve.c (create_feature_aarch64_sve): Likewise.
* nat/aarch64-sve-linux-ptrace.c(aarch64_sve_get_vq): Likewise.
* nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_vq): Likewise.

gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/aarch64-tdep.h
gdb/arch/aarch64.c
gdb/arch/aarch64.h
gdb/features/aarch64-sve.c
gdb/nat/aarch64-sve-linux-ptrace.c
gdb/nat/aarch64-sve-linux-ptrace.h

index 9895d2f..0096382 100644 (file)
@@ -1,3 +1,13 @@
+2018-06-01  Alan Hayward  <alan.hayward@arm.com>
+
+       * aarch64-tdep.c (aarch64_read_description): Use uint64_t for VQ.
+       * aarch64-tdep.h (aarch64_read_description): Likewise.
+       * arch/aarch64.c (aarch64_create_target_description): Likewise.
+       * arch/aarch64.h (aarch64_create_target_description): Likewise.
+       * features/aarch64-sve.c (create_feature_aarch64_sve): Likewise.
+       * nat/aarch64-sve-linux-ptrace.c(aarch64_sve_get_vq): Likewise.
+       * nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_vq): Likewise.
+
 2018-06-02  Simon Marchi  <simon.marchi@ericsson.com>
 
        * value.c (value_fetch_lazy_bitfield): New.
index 1cd2015..f8e77a8 100644 (file)
@@ -2856,10 +2856,10 @@ aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
    (It is not possible to set VQ to zero on an SVE system).  */
 
 const target_desc *
-aarch64_read_description (long vq)
+aarch64_read_description (uint64_t vq)
 {
   if (vq > AARCH64_MAX_SVE_VQ)
-    error (_("VQ is %ld, maximum supported value is %d"), vq,
+    error (_("VQ is %" PRIu64 ", maximum supported value is %d"), vq,
           AARCH64_MAX_SVE_VQ);
 
   struct target_desc *tdesc = tdesc_aarch64_list[vq];
index c9fd7b3..e41a597 100644 (file)
@@ -75,7 +75,7 @@ struct gdbarch_tdep
   int (*aarch64_syscall_record) (struct regcache *regcache, unsigned long svc_number);
 };
 
-const target_desc *aarch64_read_description (long vq);
+const target_desc *aarch64_read_description (uint64_t vq);
 
 extern int aarch64_process_record (struct gdbarch *gdbarch,
                                struct regcache *regcache, CORE_ADDR addr);
index 4950574..9b19131 100644 (file)
@@ -26,7 +26,7 @@
 /* See arch/aarch64.h.  */
 
 target_desc *
-aarch64_create_target_description (long vq)
+aarch64_create_target_description (uint64_t vq)
 {
   target_desc *tdesc = allocate_target_description ();
 
index 30f5360..9040d8d 100644 (file)
@@ -26,7 +26,7 @@
    the presence of SVE and the Vector Quotient - the number of 128bit chunks in
    an SVE Z register.  */
 
-target_desc *aarch64_create_target_description (long vq);
+target_desc *aarch64_create_target_description (uint64_t vq);
 
 /* Register numbers of various important registers.
    Note that on SVE, the Z registers reuse the V register numbers and the V
index a020e4d..71be67c 100644 (file)
@@ -23,7 +23,7 @@
 
 static int
 create_feature_aarch64_sve (struct target_desc *result, long regnum,
-                           int scale)
+                           uint64_t scale)
 {
   struct tdesc_feature *feature;
   tdesc_type *element_type, *field_type;
index 3a1dbae..119656b 100644 (file)
@@ -27,7 +27,7 @@
 
 /* See nat/aarch64-sve-linux-ptrace.h.  */
 
-unsigned long
+uint64_t
 aarch64_sve_get_vq (int tid)
 {
   struct iovec iovec;
index a32ddf1..61f8414 100644 (file)
@@ -32,7 +32,7 @@
 /* Read VQ for the given tid using ptrace.  If SVE is not supported then zero
    is returned (on a system that supports SVE, then VQ cannot be zero).  */
 
-extern unsigned long aarch64_sve_get_vq (int tid);
+uint64_t aarch64_sve_get_vq (int tid);
 
 /* Structures and defines taken from sigcontext.h.  */