aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_ppc64x.s
diff options
context:
space:
mode:
authorLynn Boger <laboger@linux.vnet.ibm.com>2017-04-12 14:22:16 -0400
committerLynn Boger <laboger@linux.vnet.ibm.com>2017-04-17 21:24:35 +0000
commit7d4cca07d2c6890fb39635aaa5b3b8d902bf2cbf (patch)
tree5df4eabafd7d8311530f9bb4658111a17c351348 /src/runtime/asm_ppc64x.s
parent16db1892d32bffdcc636665ba0325142b3c7ad72 (diff)
downloadgo-7d4cca07d2c6890fb39635aaa5b3b8d902bf2cbf.tar.gz
go-7d4cca07d2c6890fb39635aaa5b3b8d902bf2cbf.zip
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>
Diffstat (limited to 'src/runtime/asm_ppc64x.s')
-rw-r--r--src/runtime/asm_ppc64x.s4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s
index caa000bb56..616861ea7d 100644
--- a/src/runtime/asm_ppc64x.s
+++ b/src/runtime/asm_ppc64x.s
@@ -85,14 +85,14 @@ nocgo:
// start this M
BL runtime·mstart(SB)
- MOVD R0, 1(R0)
+ MOVD R0, 0(R0)
RET
DATA runtime·mainPC+0(SB)/8,$runtime·main(SB)
GLOBL runtime·mainPC(SB),RODATA,$8
TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0
- MOVD R0, 2(R0) // TODO: TD
+ MOVD R0, 0(R0) // TODO: TD
RET
TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0