From 38074311927d012e4cbd28d825878974c9209f77 Mon Sep 17 00:00:00 2001 From: "Jose E. Marchesi" Date: Tue, 25 Aug 2015 17:16:34 +0200 Subject: [PATCH] Support for the sparc %pmcdper privileged register. opcodes/ChangeLog: 2015-08-25 Jose E. Marchesi * sparc-dis.c (print_insn_sparc): Handle the privileged register %pmcdper. gas/ChangeLog: 2015-08-25 Jose E. Marchesi * config/tc-sparc.c (priv_reg_table): New privileged register %pmcdper. gas/testsuite/ChangeLog: 2015-08-25 Jose E. Marchesi * gas/sparc/wrpr.s: Test writing to the privileged %pmcdper register. * gas/sparc/wrpr.d: ...and the expected result. * gas/sparc/rdpr.s: Test reading from the privileged %pmcdper register. * gas/sparc/rdpr.d: ...and the expected result. --- gas/ChangeLog | 5 +++++ gas/config/tc-sparc.c | 1 + gas/testsuite/ChangeLog | 9 +++++++++ gas/testsuite/gas/sparc/rdpr.d | 1 + gas/testsuite/gas/sparc/rdpr.s | 1 + gas/testsuite/gas/sparc/wrpr.d | 1 + gas/testsuite/gas/sparc/wrpr.s | 1 + opcodes/ChangeLog | 5 +++++ opcodes/sparc-dis.c | 8 ++++++-- 9 files changed, 30 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 3bcd8e6d527..02d94ade14c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2015-08-25 Jose E. Marchesi + + * config/tc-sparc.c (priv_reg_table): New privileged register + %pmcdper. + 2015-08-21 Nick Clifton PR gas/18581 diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 6e7a3ef14f6..28e6ec8f653 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -805,6 +805,7 @@ struct priv_reg_entry priv_reg_table[] = {"wstate", 14}, {"fq", 15}, {"gl", 16}, + {"pmcdper", 23}, {"ver", 31}, {"", -1}, /* End marker. */ }; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 6b852496958..4d4dcbc0750 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2015-08-25 Jose E. Marchesi + + * gas/sparc/wrpr.s: Test writing to the privileged %pmcdper + register. + * gas/sparc/wrpr.d: ...and the expected result. + * gas/sparc/rdpr.s: Test reading from the privileged %pmcdper + register. + * gas/sparc/rdpr.d: ...and the expected result. + 2015-08-24 Jan Stancek * gas/i386/intel.s: Add test of disassembly of a potential diff --git a/gas/testsuite/gas/sparc/rdpr.d b/gas/testsuite/gas/sparc/rdpr.d index 6ddc24a4469..58ec2efbcbd 100644 --- a/gas/testsuite/gas/sparc/rdpr.d +++ b/gas/testsuite/gas/sparc/rdpr.d @@ -25,3 +25,4 @@ Disassembly of section .text: 3c: a1 53 c0 00 rdpr %fq, %l0 40: a3 54 00 00 rdpr %gl, %l1 44: a5 57 c0 00 rdpr %ver, %l2 + 48: a7 55 c0 00 rdpr %pmcdper, %l3 diff --git a/gas/testsuite/gas/sparc/rdpr.s b/gas/testsuite/gas/sparc/rdpr.s index 15660359c7a..0bf3db85618 100644 --- a/gas/testsuite/gas/sparc/rdpr.s +++ b/gas/testsuite/gas/sparc/rdpr.s @@ -18,3 +18,4 @@ rdpr %fq,%l0 rdpr %gl,%l1 rdpr %ver,%l2 + rdpr %pmcdper,%l3 diff --git a/gas/testsuite/gas/sparc/wrpr.d b/gas/testsuite/gas/sparc/wrpr.d index d0c1b35a988..5a9b6f9cdc5 100644 --- a/gas/testsuite/gas/sparc/wrpr.d +++ b/gas/testsuite/gas/sparc/wrpr.d @@ -23,3 +23,4 @@ Disassembly of section .text: 34: 9b 93 80 00 wrpr %sp, %otherwin 38: 9d 93 c0 00 wrpr %o7, %wstate 3c: a1 94 00 00 wrpr %l0, %gl + 40: af 94 c0 00 wrpr %l3, %pmcdper diff --git a/gas/testsuite/gas/sparc/wrpr.s b/gas/testsuite/gas/sparc/wrpr.s index e32b149c9bf..a17182e40d7 100644 --- a/gas/testsuite/gas/sparc/wrpr.s +++ b/gas/testsuite/gas/sparc/wrpr.s @@ -16,3 +16,4 @@ wrpr %o6,%otherwin wrpr %o7,%wstate wrpr %l0,%gl + wrpr %l3,%pmcdper diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 3529dbc66a1..2a9795eaf4e 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2015-08-25 Jose E. Marchesi + + * sparc-dis.c (print_insn_sparc): Handle the privileged register + %pmcdper. + 2015-08-24 Jan Stancek * i386-dis.c (print_insn): Fix decoding of three byte operands. diff --git a/opcodes/sparc-dis.c b/opcodes/sparc-dis.c index 5247526e69a..a2e77f032c6 100644 --- a/opcodes/sparc-dis.c +++ b/opcodes/sparc-dis.c @@ -86,7 +86,7 @@ static char *v9_priv_reg_names[] = "tpc", "tnpc", "tstate", "tt", "tick", "tba", "pstate", "tl", "pil", "cwp", "cansave", "canrestore", "cleanwin", "otherwin", "wstate", "fq", "gl" - /* "ver" - special cased */ + /* "ver" and "pmcdper" - special cased */ }; /* These are ordered according to there register number in @@ -813,6 +813,8 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info) case '?': if (X_RS1 (insn) == 31) (*info->fprintf_func) (stream, "%%ver"); + else if (X_RS1 (insn) == 23) + (*info->fprintf_func) (stream, "%%pmcdper"); else if ((unsigned) X_RS1 (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RS1 (insn)]); @@ -821,7 +823,9 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info) break; case '!': - if ((unsigned) X_RD (insn) < 17) + if (X_RD (insn) == 23) + (*info->fprintf_func) (stream, "%%pmcdper"); + else if ((unsigned) X_RD (insn) < 17) (*info->fprintf_func) (stream, "%%%s", v9_priv_reg_names[X_RD (insn)]); else -- 2.30.2