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

70 Коммитов

Автор SHA1 Сообщение Дата
Lynn Boger 52c3e6f60c ppc64: add instructions to decoder
These instructions were recently added to asm9 so should
be included in golang.org/x/arch/ppc64.

lxvh8x
lxvb16x
stxv8x
stxvb16x
xxbrd
xxbrw
xxbrh

Change-Id: I51a08366f9bc81081bc95f9c28726ebd3f749373
Reviewed-on: https://go-review.googlesource.com/c/arch/+/260617
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
2020-10-08 16:18:08 +00:00
Paul E. Murphy b19915210f ppc64/ppc64asm: learn lxvx and stxvx instructions
These are the indexed vsx load/store instructions added
in ISA 3.0.

Change-Id: I31c5d77f0f993347a1079e5504e8bdf9260eeb9b
Reviewed-on: https://go-review.googlesource.com/c/arch/+/249158
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2020-08-26 20:03:59 +00:00
Lynn Boger f7c7858683 ppc64/ppc64asm: update power9 for ppc64 and improve tests
This adds some new instructions, mostly power9, to
the ppc64 instruction tables. This also fixes some
issues with the ppc64 disassembler's ordering of
operands and improves the test examples.

Change-Id: Ib9a2e9722897bc25556d0c9ae5189cb6cbdfc6a1
Reviewed-on: https://go-review.googlesource.com/c/arch/+/230957
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-05-11 17:53:25 +00:00
Dmitri Shuralyov ff8b605520 vendor: delete
The vendor directory was added in CL 13968, as part of the Go 1.5
vendor experiment (golang.org/s/go15vendor), before the module mode
was in existence to achieve these properties.

The version of the rsc.io/pdf dependency can be determined from the
go.mod file, resulting in reproducible builds.

The content of the rsc.io/pdf dependency can be fetched from origin,
proxy.golang.org, or another proxy, resulting in available builds.

The checksum of the rsc.io/pdf dependency is written down in the
go.sum file, as well as in sum.golang.org, resulting in secure builds.

I am not aware of a reason for the vendor directory to exist in this
repository anymore, so delete it in order to have fewer files.

Change-Id: Ib97b8ff164f9f5e6565cf5b49fb794f3e4aab43c
Reviewed-on: https://go-review.googlesource.com/c/arch/+/222539
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-12 21:54:26 +00:00
Dmitri Shuralyov 69f17b2c0b vendor: migrate from govendor to go mod vendor
The rsc.io/pdf package was added to the vendor directory 5 years ago
in CL 13968, back when the vendor directory was a part of the Go 1.5
vendor experiment.

The vendor.json file was written by hand in a format compatible with
the govendor tool. By now, that tool has been deprecated in favor of
the go command in module mode.

A go.mod file requiring a newer version of rsc.io/pdf was added in
CL 167137. Modify the vendor directory to use the newer rsc.io/pdf
version by recreating vendor directory using go command in Go 1.14:

	rm -rf vendor
	go mod vendor

It's possible the vendor directory isn't needed anymore and can be
safely deleted in a future change. The scope of this CL is only to
migrate from the deprecated govendor tool to the supported go tool;
deleting the vendor directory can still be done in a future change.

Remove the explicit mention of Go 1.5 vendor experiment from README
since it's old, and not relevant by now. Add a contributing section.

Updates golang/go#30228
Updates golang/go#33848

Change-Id: I95de95a3b2d81faf7235c675e5b8d425141f8d7a
Reviewed-on: https://go-review.googlesource.com/c/arch/+/222538
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-12 21:41:26 +00:00
Robin Eklind 368ea8f32f x86asm: add support for FLDZ and FLDLN2
Fixes golang/go#18665.

Change-Id: Ia628773266d3e5efba252b910341d00b7fdb7081
GitHub-Last-Rev: fa98ffe2b8
GitHub-Pull-Request: golang/arch#3
Reviewed-on: https://go-review.googlesource.com/c/arch/+/149438
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-11-26 21:15:47 +00:00
diaxu01 a0d8588395 arm64/arm64asm: rename NOP instruction as NOOP in go syntax
This patch sets NOOP symbol to represent NOP which is equal to armv8
NOP instruction. because go assembler syntax uses NOOP instead of NOP.

Change-Id: I262a9901835128cead900fd9711616f46ae67fd1
Reviewed-on: https://go-review.googlesource.com/c/arch/+/204417
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: eric fang <eric.fang@arm.com>
2019-11-01 13:52:51 +00:00
diaxu01 4e8777c89b arm64/arm64gen: get system register readable and writeable attribute
This patch gets the readable and writeable property of system register from the
generator sysreggen.go and writes it to the sysRegEnc.go file. This attribute
would be used by assembler to check the correctness of system register's
read/write access for MRS/MSR instruction.

Change-Id: I637f86710c9f53e9e621d1dd6b7c4142f7bd4c11
Reviewed-on: https://go-review.googlesource.com/c/arch/+/194937
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-27 15:36:33 +00:00
fanzha02 1137aedcb1 arm64/arm64gen: adds a generator sysreggen.go
The assembler needs to support the EL0 and EL1 system registers used
in the MSR/MRS instructions. Because there are many system registers,
this patch adds a generator sysreggen.go. The generator parses the
system register XML files to get the encoding information and writes
them to a $filename file (default "sysRegEnc.go" file). The automatically
generated file is moved to $GOROOT/src/cmd/internal/obj/arm64/ folder
and used by the assembler.

Change-Id: Ia5ee6b85c0a972fdaf3b28c194c36d6cfe4b5b10
Reviewed-on: https://go-review.googlesource.com/c/arch/+/191222
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-20 18:22:16 +00:00
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
James Eady 8a70ba74b3 x86/x86asm: make x86asm.Decode thread-safe
Moves initialization of the decoderCover variable from happening
unconditionally to only being initialized by the test code using it so
that it does not cause a data race when not being used and Decode is
called in parallel.

Fixes golang/go#33532

Change-Id: I64d748f94d135f0c1f55f1456ff770ac5205c85a
GitHub-Last-Rev: 679e78ed1d
GitHub-Pull-Request: golang/arch#4
Reviewed-on: https://go-review.googlesource.com/c/arch/+/189919
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-08-15 19:11:58 +00:00
Bryan C. Mills 788fe5ffcd all: add go.mod
Updates golang/go#30228

Change-Id: Idde6e34da043b401ee7429a0297517ec235e3b64
Reviewed-on: https://go-review.googlesource.com/c/arch/+/167137
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-12 16:21:04 +00:00
Josh Bleecher Snyder 36aee92af9 x86/x86asm: fix three panics on malformed input
All three test cases used to cause a panic.

Change-Id: I2874c1fb6f09e6c3678d0b8d469f2c582dd8f50b
Reviewed-on: https://go-review.googlesource.com/c/155939
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-02-26 20:33:02 +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
Michael Hudson-Doyle b19384d3c1 arm64/arm64asm: recognise new ssbb/pssbb mnemonics from objdump
Fixes golang/go#27754

Change-Id: I8fcc3bc3c718cf0d93afbd1d383df48316b522d4
Reviewed-on: https://go-review.googlesource.com/136455
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-09-20 14:58:03 +00:00
isharipo 5de9028c24 x86/x86avxgen: enable AVX512 encoder tables generation
Now generates both VEX and EVEX encoded optabs.

Encoder based on these optabs passes tests added in
https://golang.org/cl/107217.

This version uses XED datafiles directly instead of x86.csv.

Also moves x86/x86spec/xeddata package to x86/xeddata to make it
usable from x86 packages.
Ported x86spec pattern set type to xeddata.

Updates golang/go#22779

Change-Id: I304267d888dcda4f776d1241efa524f397a8b7b3
Reviewed-on: https://go-review.googlesource.com/107216
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2018-05-16 17:50:55 +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
fanzha02 9111c30535 arm64/arm64asm: complement SIMD instructions go syntax in disassembler
The patch complements the unimplemented go syntax for SIMD instructions
and adds the test cases.

Change-Id: I2682b03f197373fb44c4daedbc3a2a0a8e3f5f49
Reviewed-on: https://go-review.googlesource.com/101175
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-12 19:48:48 +00:00
fanzha02 8223c7e5dc arm64/arm64asm: complement ARM64 disassembler Go syntax
Because some instructions like ADD(extended register) have been handled
by assembler, but disassembler still has incorrect Go syntax for those
instructions.

This patch complements the unimplemented Go syntax in disassembler and
separates the cases.txt into two test files (gnucases.txt and
plan9cases.txt), so that the Go syntax test will be easier. The cases
added in the plan9cases.txt file can handled by current
disassembler.

Change-Id: Ie3e0d04700fc85da8bd1758a249ec7a7f7a5a117
Reviewed-on: https://go-review.googlesource.com/98398
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-11 14:38:00 +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
isharipo 05f23963c4 x86/x86csv: s/Inst.Size/Inst.DataSize/, add Inst.HasTag method
Fix bad field name and add new method that is going to be used
in XED-based x86spec generator.

Change-Id: I7932e095f74a3354402b566a3f750b25b7bb7def
Reviewed-on: https://go-review.googlesource.com/104475
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-03 17:57:26 +00:00
isharipo 2e99af295d x86/x86spec: remove instructions with VSIB from blacklist
VSIB is already supported by Go asm (it can encode AVX GATHERs),
Intel XED can handle it as well.

Change-Id: I0a0d2dbd35f3cb8d0e02adc0623470911d9795fe
Reviewed-on: https://go-review.googlesource.com/104495
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-03 17:01:17 +00:00
isharipo afdde57c62 x86/x86spec/xeddata: add XED datafiles reader
xeddata package implements Intel XED datafiles reader.

The implementation is very x86spec-specific as it implements
only a few data types, enumerations and file format parsers
that are required to generate "x86.csv" from XED tables.

See "doc.go" for detailed package overview.

The XED version (commit hash) specified in doc.go is not strict dependency,
but rather a hint that helps to select revision that
is guaranteed to work.

Change-Id: I848eeb159d9353d533f13bbf0e83a47a5f7772ce
Reviewed-on: https://go-review.googlesource.com/88015
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-04-03 14:27:31 +00:00
Andrew Bonventre a91cccae75 CONTRIBUTING.md: remove note about not accepting Pull Requests
Updates golang/go#24185

Change-Id: I6bd8b9a38e9a22793a2791a2d46e7ea4087bff7a
Reviewed-on: https://go-review.googlesource.com/100676
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-14 18:02:28 +00:00
Ben Shi 23d99967d0 arm64/arm64asm: fix argument order in FMADD/FMSUB/FNMADD/FNMSUB
The addends in FMADD/FMSUB/FNMADD/FNMSUB should come second, in
accordance with MADD/MSUB. This CL fixes that issue.

fixes golang/go#23775

Change-Id: I139397f38ba02901cf840ed34bb0d1180e9bba36
Reviewed-on: https://go-review.googlesource.com/93336
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-21 15:42:06 +00:00
Ben Shi 7d04a2ea6b arm/armasm: Improve Plan 9 syntax decoding
The arm disassembler can not decode many instructions to
correct Plan 9 syntax.

This patch fixes 3 major issues.

1. Change memory addresses in PLD/PLI/SWP/STREX/LDREX to the correct
Plan 9 syntax (in accordance with MOVW/MOVB/MOVH). For example,
   [rx] -> (Rx)
   [rx, #imm] -> imm(Rx)
   [rx, ry, lsl #imm] -> (Rx)(Ry<<imm)

2. Apply the Plan 9 syntax naming rule to more instructions. Such as,
   VMRS -> MOVW
   VMSR -> MOVW
   XTB  -> MOVBS
   XTHU -> MOVHU
   XTH  -> MOVHS
   XTBU -> MOVBU

3. Improve FP instructions decoding.
   3.1 instruction name: VADD.F32 -> ADDF, VSUB.F64 -> SUBD, ...
   3.2 register name: S0 -> F0, D0 -> F0, S2 -> F1, D1 -> F1, ...

Many test cases are also changed.

Change-Id: I5f8ac0e82c6edec2f4bdc4db58f6bcbab40d299a
Reviewed-on: https://go-review.googlesource.com/85455
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-14 15:20:09 +00:00
Wei Xiao 98fd8d9907 arm64/arm64asm: strip comments of objdump 2.29
Objdump (2.29) generates new format of comments starting with "//"
instead of original ";", e.g: "csinv x23, x2, x19, cc // cc = lo, ul, last".
Improve test generation framework to recognize and strip such comments.

Fixes golang/go#23237

Change-Id: I0ccf70791f43d696b0e20ded7f284eb277bea31c
Reviewed-on: https://go-review.googlesource.com/85476
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-12-27 04:07:32 +00:00
Brad Fitzpatrick ea034f7604 arm64/arm64asm: fix vet warning to fix build on Go 1.10
Change-Id: Iba218f4da109845f3b5abb66100b39fdc03582f5
Reviewed-on: https://go-review.googlesource.com/84215
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-12-15 01:53:01 +00:00
Mikio Hara 530ae47ad0 arm64/arm64asm: remove execute bit from source files
Change-Id: I64c1433bc2463c2b002ad0803f610cce3e073b35
Reviewed-on: https://go-review.googlesource.com/82437
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-12-07 04:44:57 +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
isharipo c319b3c35c x86: add AVX optabs generator
x86avxgen tool generates code that is required
to implement full AVX1 and AVX2 support in Go asm.

The main effects of this utility are:
- emits AVX instructions optabs
- updates instructions enum (adds new entries)
- uncomments test cases for added instructions from amd64enc.s

It can be extended to support AVX512,
but that requires, among other things,
EVEX prefix support in asm6.go.

Note: some changes in obj/x86 are required
in order to use this tool.
Current CL sends the tool itself on the review,
prerequisites will come later (if x86avxgen passes the review).

Change-Id: I4691b16327bbafedfd5a297115b673c551f28484
Reviewed-on: https://go-review.googlesource.com/66972
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-10-26 21:14:23 +00:00
isharipo 077ac972c2 x86: add x86csv package
x86csv package provides simple CSV reader
that serializes rows into spec row objects.

This way, it is more convenient to build tools
that rely on x86.csv and it is easier to
control x86.csv version changes over time
(at least there will be no dependency on columns order, or their count).

Row type fields documentation is taken from x86spec/spec.go
package comment.

It is implied that Row represents layout of the most
recent x86.csv version.

x86/x86avxgen depends on this package.

Change-Id: Icde4f6c1e80aeb69d34bd4e38fbfd3bbd7165c62
Reviewed-on: https://go-review.googlesource.com/66971
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-10-04 14:35:15 +00:00
Avelino 86dc2edbc1 README: style syntax to markdown
Change-Id: Idf5fb2adf1622f7d729146200c35f7cae4d7434c
Reviewed-on: https://go-review.googlesource.com/57334
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-09-29 20:28:58 +00:00
isharipo c6bf5516fa x86: pull CL18840 - SDM->x86.csv converter
Add x86spec package that is capable to generate x86.csv
version 0.2.

New x86.csv does not replace v0.1 to avoid unexpected
code breaks (x86/x86map depends on v0.1).
This can be solved in another CL.

The rationale behind this is x86avxgen tool that
requires v0.2 spec.

See https://go-review.googlesource.com/#/c/arch/+/18840/

Change-Id: Iea93e1174a5a79b9b50bf99f626e3c48b19ad5c1
Reviewed-on: https://go-review.googlesource.com/66970
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-28 23:30:27 +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
aarzilli 7bacdd692e x86: use symname also for IP-relative arguments
Change-Id: Ic291e8b284290f29dd586415a873fbf90bafcac9
Reviewed-on: https://go-review.googlesource.com/45099
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-09-13 12:09:08 +00:00
aarzilli ec321f9a9f x86: use symname in IntelSyntax and GNUSyntax
Change-Id: I8b75df1c9dedb402a227182588b2dea4f82d348a
Reviewed-on: https://go-review.googlesource.com/45098
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-13 12:09:00 +00:00
aarzilli 893b1271f1 x86: IntelSyntax, GNUSyntax: print Rel arguments as absolute
PC relative addresses are hard to understand and this is already done
in GoSyntax.

Change-Id: I7edcffb54059291c638b633a2e62f6555f7df79c
Reviewed-on: https://go-review.googlesource.com/45097
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-09-05 15:14:27 +00:00
Wei Xiao edaf650c5f x/arch/arm64: refine objdump test to avoid false alarm
TestObjdumpARM64* is fuzzy test which randomly generates instructions for
decoder and uses host objdump to compare results. Some old objdump wrongly
decodes ldur*/stur*/prfum as ldr*/str*/prfm. Refine allowedMismatchObjdump
function to allow the mismatches to avoid false alarm.

Fixes golang/go#21486

Change-Id: I8909ca2657bd86ec5287e1ade7b17fe87f4ced22
Reviewed-on: https://go-review.googlesource.com/56810
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-24 12:18:49 +00:00
Russ Cox ffd22fb365 arm64/arm64asm: avoid log.Fatal during test
Especially log.Fatal(err) where err came back from exec.Command.Run.
It prints no additional information and is very confusing for the test
to die printing 'exit status 1'.

For golang/go#21486.

Change-Id: I8675667838319a4d5697e596244bea514509894d
Reviewed-on: https://go-review.googlesource.com/56971
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-08-18 16:05:31 +00:00
Ben Shi f185940480 arm/armasm/testdata: add more decoding tests
More decoding tests are added. Most of them are
in gnu syntax and a few are in plan9 syntax.

Change-Id: Ifb96f5149f7f7c947f35948889a33f5dee50dbfc
Reviewed-on: https://go-review.googlesource.com/49190
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
2017-07-24 20:36:47 +00:00
Dave Cheney 3073097500 arm64/arm64spec: skip build on 386 targets
Fix build failure:

..\..\gopath\src\golang.org\x\arch\arm64\arm64spec\spec.go:137: undefined: pdf.Outline
..\..\gopath\src\golang.org\x\arch\arm64\arm64spec\spec.go:148: undefined: pdf.Outline
..\..\gopath\src\golang.org\x\arch\arm64\arm64spec\spec.go:167: undefined: pdf.Page
..\..\gopath\src\golang.org\x\arch\arm64\arm64spec\spec.go:167: undefined: pdf.Reader
..\..\gopath\src\golang.org\x\arch\arm64\arm64spec\spec.go:425: undefined: pdf.Content
..\..\gopath\src\golang.org\x\arch\arm64\arm64spec\spec.go:425: undefined: pdf.Text
..\..\gopath\src\golang.org\x\arch\arm64\arm64spec\spec.go:616: undefined: pdf.Rect

arm64spec depends on rsc.io/pdf which does not currently build on 386 platforms.

Updates golang/go#12840

Change-Id: I40de19c617f90bcf696586b57a4d09b1d307f0df
Reviewed-on: https://go-review.googlesource.com/49015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-15 20:50:22 +00:00
Ben Shi ec150e07d4 arm: support MSR instruction in the disassembler
Though MRS is correctly disassembled, MSR can not be recognized.
This patch fixes this issue and adds corresponding tests.

Fixes golang/go#20762

Change-Id: I59292f2a267d18cac7c012efaf0727bd9b8d5bb1
Reviewed-on: https://go-review.googlesource.com/48310
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-07-15 15:20:43 +00:00
Ben Shi b41bfd5e5f arm/armasm: rename VLDR/VSTR in plan9 syntax
Some load/store instructions are renamed in plan9 syntax, such as
LDR -> MOVW
STR -> MOVW
LDRB -> MOVBU
LDRSB -> MOVBS
STRB -> MOVB
LDRH -> MOVHU
LDRSH -> MOVSH
STRH -> MOVH

And VLDR/VSTR also need to be renamed.
VLDR.F32 -> MOVF (load from memory to single FP register)
VLDR.F64 -> MOVD (load from memory to double FP register)
VSTR.F32 -> MOVF (store single FP register to memory)
VSTR.F64 -> MOVD (store double FP register to memory)

This patch fixes this issue and adds corresponding tests.

fixes  golang/go#20897

Change-Id: I03aaad6379fa6f7c9b808d6a4795a06299fb7a18
Reviewed-on: https://go-review.googlesource.com/47360
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-07-14 17:52:43 +00:00
Ben Shi 28b9d4bd5d arm: support SDIV/UDIV in the disassembler
Currently UDIV and SDIV can not be correctly decoded. This patch
adds support for them and corresponding tests.

fixes #20096

Change-Id: I8818c29bc03aa9f0aaf157bfa03cd39114e0925e
Reviewed-on: https://go-review.googlesource.com/41891
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-11 12:56:57 +00:00
Wei Xiao f40095975f x/arch/arm64: implement arm64 disassembler
- Add support for all basic instructions (except for the following
  6 system instructions: AT, DC, HVC, SMC, SYS and TLBI)
- Add support for all FP basic instructions
- Add support for all SIMD instructions (plan9 syntax refer to CL 41654)
- Add cases for testing all instructions and comparing disassembly result
  with external disassembler (by gnu syntax)

Disassembler framework is mainly contributed by Zheng Xu <zheng.xu@arm.com>
Testing and bug fixing are mainly contributed by Fannie Zhang <fannie.zhang@arm.com>
Other parts (such as decoder table and argument) are mainly contributed by Wei Xiao <wei.xiao@arm.com>

Fixes #19157

Change-Id: I76b6b075f487857124c8ca774a12d764d4ee85c7
Reviewed-on: https://go-review.googlesource.com/43651
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-07-11 12:56:41 +00:00
Ben Shi b19d1a73c7 arm/armasm: fix wrong register order in SMLABT/SMLATB/SMLATT/SMLAD/SMLSD
SMLABT/SMLATB/SMLATT/SMLAD/SMLSD are MLA(mul&add) like instructions,
which need the third register to be the addend. But currently the addend
is placed in the first position in the decoded register list.

This patch fixes it and adds corresponding tests.

Change-Id: I57f3e96876c54497badf1a12ae7dae18fe6fcc11
Reviewed-on: https://go-review.googlesource.com/47890
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-07-10 10:57:12 +00:00
Ben Shi 0f7de0481c arm/armasm: fix wrong decoding MOVW/MOVH/MOVB to plan9 syntax
There are two issues in decoding to arm plan9 syntax.

1. Though "0xe7912e29" is correctly decoded to "MOVW (R1)(R0>>28), R2",
"0xe7112e20" is also decoded to the same text, which is expected to
"MOVW.U (R1)(R0>>28), R2".

2. Both 0xe5d21000 and 0xe1d210d0 are decoded to "MOVB (R2), R1".
The first one is LDRB and should be decoded to "MOVBU (R2), R1". And
the second one is LDRSB and should be decoded to "MOVBS (R2), R1".

This patch fixes them and adds more decoding tests.

fix golang/go#20766

Change-Id: If3479c200fb250af1e1efb546576acb399eba7c1
Reviewed-on: https://go-review.googlesource.com/46493
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-06-30 18:24:30 +00:00
Ben Shi 87a6340e8e arm/armasm: fix wrong register order in MLA.S
Though "0xe0243192" can be correctly disassembled to
"MLA R1, R2, R3, R4", "0xe0243192" is disassembled to
"MLA.S R3, R1, R2, R4", which should be "MLA.S R1, R2, R3, R4".

This patch fix it.

fix golang/go#20752

Change-Id: I2b4627b822715954923429688bccb21c081b7d0e
Reviewed-on: https://go-review.googlesource.com/46456
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-22 13:04:15 +00:00