The following improvements are included in this change:
- Display common special purpose registers for mtlr,mflr,mtctr,mfctr,
mtxer,mfxer,mftb; for others use mtspr and mfspr.
- Provide branch condition information (lt, gt, eq, ne, ge, le).
- Add cr number if cr1-cr7 is used.
- Pass pc to gnuArg to generate branch targets that are not relative.
Change-Id: Ia3ef6cb248c484a3ad72545e68d1ca59e32ae645
Reviewed-on: https://go-review.googlesource.com/c/arch/+/194597
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
The current output for the Go objdump on ppc64 is not correct
in many cases, generating opcodes that are not acceptable by the
Go assembler, and generating operands in the wrong order.
This adds some changes to generate an objdump for ppc64 code so that
the instructions generated are acceptable by the Go assembler,
and where some of the non-obvious operands have more meaningful names.
This includes the following changes:
- Correct some errors in ppc64map to make it work.
- Make a minor update to ppc64.csv to add the Go opcodes that have been
added to the Go assembler that were not in the table.
- Fix ppc64map to generate correct Go opcodes for ppc64 opcodes that end with '.'
indicating condition codes are set. The previous ppc64map was adding '_' at the end
for this case, but then had to be translated in plan9.go to 'CC' and many were not
being translated. This generates the correct suffix in the first step when
generating tables.go.
- Handle compare instructions correctly, since the names don't quite match
and the CR was not always handled correctly.
- Handle index loads and stores correctly, including VMX and VSX.
- Add mappings for all the names where the Go opcode does not match the ppc64 opcode.
- Handle all CR values, not just CR0 for those instructions that use them.
- Provide more information on BC instructions and generate the correct
branch mnemonic (BEQ, BNE, etc.) where possible.
- Make the output more consistent in spacing.
- Add some more testcases to testdata/decode.txt.
- If the instruction word is all 0s, the Go assembler will output WORD $0,
otherwise unrecognized instructions will be identified with '?'. For GNU,
all 0s will decode to .long 0x0 like the binutils objdump. This can happen
following a call to a panic or throw as a trap, or at the end of a function
for alignment purposes.
Note: the decoder does not handle extended opcodes correctly yet. I will add
that support in the next release and add the corresponding testcases.
We are working on an updated ppc64.csv, but I believe what is
there now covers the opcodes that are supported by the Go assembler.
Change-Id: If7fe1a2205512b476f4fb6b29a21f5459430e50c
Reviewed-on: https://go-review.googlesource.com/c/148574
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
a -> an
Change-Id: I6917aff4eb36ad1cd46b159391f39c1a70b54452
Reviewed-on: https://go-review.googlesource.com/63990
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The TestObjdumpPowerManualTest compares the go disassembler
output against the host objdump, but if the test is not being
run on a ppc64 or ppc64le, the host objdump won't be correct
for the test, so skip it in that case.
Change-Id: I34ba6f3efa5bde1248a1e2eaeb110a8c8dc95ea9
Reviewed-on: https://go-review.googlesource.com/32510
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This adds some fixes to the ppc64 disassembly:
- Add support for VSX registers, by updating the map
function to recognize them, regenerating tables.go
to include them with VSX instructions, and adding the
defines needed to display them correctly.
- Change the path to the system objdump in the testcase
for use in comparing the decoded machine instructions.
- Add mappings for missing opcodes in plan9.go.
- Disable the testcase that generates words with random
bit settings for use in decoding. This will be replaced
later by an assembler testcase that decodes and compares
the result with the system objdump.
Fixesgolang/go#17447
Change-Id: I23bf276ea7fcf0b54abb3dccca8b41c221c81c94
Reviewed-on: https://go-review.googlesource.com/31146
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Part of the Sisyphean goal of keeping vet happy
with the main Go repo.
Change-Id: I706b4d79066396a1ab5207f5b86dbb3d1a30d8b4
Reviewed-on: https://go-review.googlesource.com/31756
Reviewed-by: Minux Ma <minux@golang.org>
- make test pass on 32-bit systems
- make test skip objdump when objdump not available,
like in the other architecture tests
- expose plan9Syntax as GoSyntax
Change-Id: I8b1bb7cc4a07c6bd8a4eb0569553cb47773fb2a4
Reviewed-on: https://go-review.googlesource.com/30934
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This is a direct copy of github.com/minux/power64,
which in turn was forked from rsc.io/power64,
which was using Mercurial and is gone.
The code in those places was reviewed via code review
and is by Minux and me under the usual Go CLA.
I've done a global search and replace of power64 to ppc64
and checked that everything still builds. Any further fixes
will be in followup CLs.
(The arch subrepo did not exist when this code was written.)
Change-Id: I80ea16ca689c9fc51a7501c3492099f19aa30873
Reviewed-on: https://go-review.googlesource.com/30932
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>