Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ivo Raisr <ivo.raisr@oracle.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] [PR tdep/20928] Decode properly flags of %ccr register on sparc64
Date: Tue, 07 Mar 2017 13:06:00 -0000	[thread overview]
Message-ID: <705eae25-cf4e-fc81-dd8e-1e622b340486@oracle.com> (raw)
In-Reply-To: <37ce765b-9064-a766-c843-a25b69030528@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

Decode properly flags of %ccr register on sparc64.
While at it, decode also properly one-bit flags for %fsr (accrued
and current exception flags were mixed up).

Tested successfully on sparc64-linux-gnu.

ChangeLog entry:
2017-03-07  Ivo Raisr  <ivo.raisr@oracle.com>

	PR tdep/20928
	* gdb/sparc-tdep.h (gdbarch_tdep) <sparc64_ccr_type>: New field.
	* gdb/sparc64-tdep.c (sparc64_ccr_type): New function.
	(sparc64_fsr_type): Fix %fsr decoding.


The patch and ChangeLog entry are attached.
I.

[-- Attachment #2: ccr_decoding.patch --]
[-- Type: text/x-patch, Size: 3880 bytes --]

commit 45deb2dd37000fc4f51529e0fc5d206cbbeba983
Author: Ivo Raisr <ivo.raisr@oracle.com>
Date:   Tue Mar 7 10:21:02 2017 +0100

    Decode properly flags of %ccr register on sparc64.
    While at it, decode also properly one-bit flags for %fsr (accrued
    and current exception flags were mixed up).
    
    Tested successfully on sparc64-linux-gnu.
    
    ChangeLog entry:
    2017-03-07  Ivo Raisr  <ivo.raisr@oracle.com>
    
    	PR tdep/20928
    	* gdb/sparc-tdep.h (gdbarch_tdep) <sparc64_ccr_type>: New field.
    	* gdb/sparc64-tdep.c (sparc64_ccr_type): New function.
    	(sparc64_fsr_type): Fix %fsr decoding.

diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 268272e..d51802d 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -88,6 +88,7 @@ struct gdbarch_tdep
   /* ISA-specific data types.  */
   struct type *sparc_psr_type;
   struct type *sparc_fsr_type;
+  struct type *sparc64_ccr_type;
   struct type *sparc64_pstate_type;
   struct type *sparc64_fsr_type;
   struct type *sparc64_fprs_type;
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 43beffb..4c70177 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -173,6 +173,31 @@ sparc64_pstate_type (struct gdbarch *gdbarch)
 }
 
 static struct type *
+sparc64_ccr_type (struct gdbarch *gdbarch)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  if (tdep->sparc64_ccr_type == NULL)
+    {
+      struct type *type;
+
+      type = arch_flags_type (gdbarch, "builtin_type_sparc64_ccr", 8);
+      append_flags_type_flag (type, 0, "icc.c");
+      append_flags_type_flag (type, 1, "icc.v");
+      append_flags_type_flag (type, 2, "icc.z");
+      append_flags_type_flag (type, 3, "icc.n");
+      append_flags_type_flag (type, 4, "xcc.c");
+      append_flags_type_flag (type, 5, "xcc.v");
+      append_flags_type_flag (type, 6, "xcc.z");
+      append_flags_type_flag (type, 7, "xcc.n");
+
+      tdep->sparc64_ccr_type = type;
+    }
+
+  return tdep->sparc64_ccr_type;
+}
+
+static struct type *
 sparc64_fsr_type (struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -182,16 +207,16 @@ sparc64_fsr_type (struct gdbarch *gdbarch)
       struct type *type;
 
       type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 8);
-      append_flags_type_flag (type, 0, "NXA");
-      append_flags_type_flag (type, 1, "DZA");
-      append_flags_type_flag (type, 2, "UFA");
-      append_flags_type_flag (type, 3, "OFA");
-      append_flags_type_flag (type, 4, "NVA");
-      append_flags_type_flag (type, 5, "NXC");
-      append_flags_type_flag (type, 6, "DZC");
-      append_flags_type_flag (type, 7, "UFC");
-      append_flags_type_flag (type, 8, "OFC");
-      append_flags_type_flag (type, 9, "NVC");
+      append_flags_type_flag (type, 0, "NXC");
+      append_flags_type_flag (type, 1, "DZC");
+      append_flags_type_flag (type, 2, "UFC");
+      append_flags_type_flag (type, 3, "OFC");
+      append_flags_type_flag (type, 4, "NVC");
+      append_flags_type_flag (type, 5, "NXA");
+      append_flags_type_flag (type, 6, "DZA");
+      append_flags_type_flag (type, 7, "UFA");
+      append_flags_type_flag (type, 8, "OFA");
+      append_flags_type_flag (type, 9, "NVA");
       append_flags_type_flag (type, 22, "NS");
       append_flags_type_flag (type, 23, "NXM");
       append_flags_type_flag (type, 24, "DZM");
@@ -318,7 +343,7 @@ sparc64_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
   if (regnum == SPARC64_ASI_REGNUM)
     return builtin_type (gdbarch)->builtin_int64;
   if (regnum == SPARC64_CCR_REGNUM)
-    return builtin_type (gdbarch)->builtin_int64;
+    return sparc64_ccr_type (gdbarch);
   if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM)
     return builtin_type (gdbarch)->builtin_double;
   if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)

[-- Attachment #3: ChangeLog.entry --]
[-- Type: text/plain, Size: 224 bytes --]

2017-03-07  Ivo Raisr  <ivo.raisr@oracle.com>

	PR tdep/20928
	* gdb/sparc-tdep.h (gdbarch_tdep) <sparc64_ccr_type>: New field.
	* gdb/sparc64-tdep.c (sparc64_ccr_type): New function.
	(sparc64_fsr_type): Fix %fsr decoding.

       reply	other threads:[~2017-03-07 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <37ce765b-9064-a766-c843-a25b69030528@oracle.com>
2017-03-07 13:06 ` Ivo Raisr [this message]
2017-03-09 22:19   ` Ivo Raisr
2017-03-14  8:37     ` Ivo Raisr
2017-03-17 16:42       ` Pedro Alves
2017-03-20 15:55         ` Ivo Raisr
2017-03-20 16:48           ` Pedro Alves
2017-03-21  3:51             ` Ivo Raisr
2017-03-21 11:47               ` Jose E. Marchesi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=705eae25-cf4e-fc81-dd8e-1e622b340486@oracle.com \
    --to=ivo.raisr@oracle.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox