Граф коммитов

13 Коммитов

Автор SHA1 Сообщение Дата
Lynn Boger 7fe50f7625 ppc64/ppc64asm: improve disassembly for ppc64
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>
2019-09-19 21:35:54 +00:00
Ainar Garipov 46d78d1859 ppc64/ppc64asm: fix a typo
Change-Id: Iaa0a18315c22124dcc0ee273c129218f6386901d
Reviewed-on: https://go-review.googlesource.com/c/arch/+/194098
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-09 03:06:13 +00:00
Lynn Boger 5a4828bb70 ppc64: fixes for ppc64 objdump
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>
2018-12-03 22:54:21 +00:00
Tobias Klauser 1b162167b1 ppc64/ppc64spec: fix tool name in log prefix and usage
Change-Id: Ic2a89ffb46b3e3d92d9470bbdc64ad9da4578e67
Reviewed-on: https://go-review.googlesource.com/112295
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-09 14:52:07 +00:00
Tobias Klauser 5099b4b992 all: use io.SeekStart constant instead of 0
Change-Id: Ie91f539c896ddd92d4a039a237468fabdc3cf408
Reviewed-on: https://go-review.googlesource.com/105076
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-06 14:08:48 +00:00
Cherry Zhang dda8112e05 all: fix/silence vet errors
Change-Id: I04d12297538c6308bc7d7b14c9d50ff7f87eba0a
Reviewed-on: https://go-review.googlesource.com/79579
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-23 03:17:08 +00:00
namusyaka 2598a9c6f8 docs: fix article typos
a -> an

Change-Id: I6917aff4eb36ad1cd46b159391f39c1a70b54452
Reviewed-on: https://go-review.googlesource.com/63990
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-15 03:23:41 +00:00
Brad Fitzpatrick c49399feb8 ppc64/ppc64spec: skip build unless Go 1.8+ or amd64
Fix build failure:

../../gopath/src/golang.org/x/arch/ppc64/ppc64spec/spec.go:146: undefined: pdf.Outline
../../gopath/src/golang.org/x/arch/ppc64/ppc64spec/spec.go:153: undefined: pdf.Outline
../../gopath/src/golang.org/x/arch/ppc64/ppc64spec/spec.go:174: undefined: pdf.Page
../../gopath/src/golang.org/x/arch/ppc64/ppc64spec/spec.go:271: undefined: pdf.Content
../../gopath/src/golang.org/x/arch/ppc64/ppc64spec/spec.go:271: undefined: pdf.Text
../../gopath/src/golang.org/x/arch/ppc64/ppc64spec/spec.go:396: undefined: pdf.Rect

ppc64spec depends on other packages that don't build on 32-bit
systems prior to Go 1.8.

Fixes golang/go#17635
Updates golang/go#12840

Change-Id: I594adef1d0bc498940183215c7c5a958628a254a
Reviewed-on: https://go-review.googlesource.com/33247
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-15 21:48:24 +00:00
Lynn Boger 8e2d489854 x/arch/ppc64/ppc64asm: skip ObjdumpPowerManual on some hosts
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>
2016-11-01 15:37:24 +00:00
Lynn Boger fcea5eadff ppc64/ppc64asm,ppc64/ppc64map: fixes for ppc64 disassembly
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.

Fixes golang/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>
2016-10-24 16:09:17 +00:00
Josh Bleecher Snyder 37086322b0 ppc64/ppc64asm: fix nits found by vet
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>
2016-10-23 20:13:57 +00:00
Russ Cox 4831b0a617 ppc64/ppc64asm: first round of fixes
- 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>
2016-10-12 18:28:04 +00:00
Russ Cox 21375ab36a ppc64: add, from github.com/minux/power64
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>
2016-10-12 18:28:02 +00:00