mirror of
https://github.com/golang/go
synced 2024-11-12 06:30:21 -07:00
cmd/8l: fix data corruption for MULB SI,
The 8l linker automatically inserts XCHG instructions to support otherwise impossible byte registers (only available on AX, BX, CX, DX). Sometimes AX or DX is needed (for MUL and DIV) so we need to avoid clobbering them. R=golang-dev, dave, iant, iant, rsc CC=golang-dev https://golang.org/cl/6846057
This commit is contained in:
parent
af375cde20
commit
54023a94a6
@ -1618,7 +1618,9 @@ bad:
|
|||||||
pp = *p;
|
pp = *p;
|
||||||
z = p->from.type;
|
z = p->from.type;
|
||||||
if(z >= D_BP && z <= D_DI) {
|
if(z >= D_BP && z <= D_DI) {
|
||||||
if(isax(&p->to)) {
|
if(isax(&p->to) || p->to.type == D_NONE) {
|
||||||
|
// We certainly don't want to exchange
|
||||||
|
// with AX if the op is MUL or DIV.
|
||||||
*andptr++ = 0x87; /* xchg lhs,bx */
|
*andptr++ = 0x87; /* xchg lhs,bx */
|
||||||
asmando(&p->from, reg[D_BX]);
|
asmando(&p->from, reg[D_BX]);
|
||||||
subreg(&pp, z, D_BX);
|
subreg(&pp, z, D_BX);
|
||||||
|
@ -1272,7 +1272,9 @@ bad:
|
|||||||
pp = *p;
|
pp = *p;
|
||||||
z = p->from.type;
|
z = p->from.type;
|
||||||
if(z >= D_BP && z <= D_DI) {
|
if(z >= D_BP && z <= D_DI) {
|
||||||
if(isax(&p->to)) {
|
if(isax(&p->to) || p->to.type == D_NONE) {
|
||||||
|
// We certainly don't want to exchange
|
||||||
|
// with AX if the op is MUL or DIV.
|
||||||
*andptr++ = 0x87; /* xchg lhs,bx */
|
*andptr++ = 0x87; /* xchg lhs,bx */
|
||||||
asmand(&p->from, reg[D_BX]);
|
asmand(&p->from, reg[D_BX]);
|
||||||
subreg(&pp, z, D_BX);
|
subreg(&pp, z, D_BX);
|
||||||
|
Loading…
Reference in New Issue
Block a user