]> Cypherpunks repositories - gostls13.git/commit
cmd/asm: detect invalid DS form offsets for ppc64x
authorLynn Boger <laboger@linux.vnet.ibm.com>
Wed, 12 Apr 2017 18:22:16 +0000 (14:22 -0400)
committerLynn Boger <laboger@linux.vnet.ibm.com>
Mon, 17 Apr 2017 21:24:35 +0000 (21:24 +0000)
commit7d4cca07d2c6890fb39635aaa5b3b8d902bf2cbf
tree5df4eabafd7d8311530f9bb4658111a17c351348
parent16db1892d32bffdcc636665ba0325142b3c7ad72
cmd/asm: detect invalid DS form offsets for ppc64x

While debugging a recent regression it was discovered that
the assembler for ppc64x was not always generating the correct
instruction for DS form loads and stores.  When an instruction
is DS form then the offset must be a multiple of 4, and if it
isn't then bits outside the offset field were being incorrectly
set resulting in unexpected and incorrect instructions.

This change adds a check to determine when the opcode is DS form
and then verifies that the offset is a multiple of 4 before
generating the instruction, otherwise logs an error.

This also changes a few asm files that were using unaligned offsets
for DS form loads and stores.  In the runtime package these were
instructions intended to cause a crash so using aligned or unaligned
offsets doesn't change that behavior.

Change-Id: Ie3a7e1e65dcc9933b54de7a46a054da8459cb56f
Reviewed-on: https://go-review.googlesource.com/40476
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
src/cmd/asm/internal/asm/testdata/ppc64.s
src/cmd/internal/obj/ppc64/asm9.go
src/runtime/asm_ppc64x.s
src/runtime/sys_linux_ppc64x.s