mirror of
https://github.com/golang/go
synced 2024-11-19 21:04:43 -07:00
cmd/internal/obj/arm64: fix assemble hlt/hvc/smc/brk/clrex bug
When instruction has only one argument, Go parser saves the argument value into prog.From without any special handling. But assembler gets the argument value from prog.To. The fix adds special handling for CLREX and puts other instructions arguments value into prog.From. Uncomment hlt/hvc/smc/brk/dcps1/dcps2/dcps3/clrex test cases. Fixes #20765 Change-Id: I1fc0d2faafb19b537cab5a665bd4af56c3a2c925 Reviewed-on: https://go-review.googlesource.com/78275 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
337f04bd6c
commit
436f2d8d97
18
src/cmd/asm/internal/asm/testdata/arm64enc.s
vendored
18
src/cmd/asm/internal/asm/testdata/arm64enc.s
vendored
@ -57,7 +57,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
|
|||||||
CALL -1(PC) // ffffff97
|
CALL -1(PC) // ffffff97
|
||||||
CALL (R15) // e0013fd6
|
CALL (R15) // e0013fd6
|
||||||
JMP (R29) // a0031fd6
|
JMP (R29) // a0031fd6
|
||||||
// BRK $35943 // e08c31d4
|
BRK $35943 // e08c31d4
|
||||||
CBNZW R2, -1(PC) // e2ffff35
|
CBNZW R2, -1(PC) // e2ffff35
|
||||||
CBNZ R7, -1(PC) // e7ffffb5
|
CBNZ R7, -1(PC) // e7ffffb5
|
||||||
CBZW R15, -1(PC) // efffff34
|
CBZW R15, -1(PC) // efffff34
|
||||||
@ -81,8 +81,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
|
|||||||
CINVW EQ, R2, R17 // 5110825a
|
CINVW EQ, R2, R17 // 5110825a
|
||||||
CINV VS, R12, R7 // 87718cda
|
CINV VS, R12, R7 // 87718cda
|
||||||
CINV VS, R30, R30 // de739eda
|
CINV VS, R30, R30 // de739eda
|
||||||
// CLREX $4 // 5f3403d5
|
CLREX $4 // 5f3403d5
|
||||||
// CLREX $0 // 5f3003d5
|
CLREX $0 // 5f3003d5
|
||||||
CLSW R15, R6 // e615c05a
|
CLSW R15, R6 // e615c05a
|
||||||
CLS R15, ZR // ff15c0da
|
CLS R15, ZR // ff15c0da
|
||||||
CLZW R1, R14 // 2e10c05a
|
CLZW R1, R14 // 2e10c05a
|
||||||
@ -128,9 +128,9 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
|
|||||||
CSNEGW HS, R16, R29, R10 // 0a269d5a
|
CSNEGW HS, R16, R29, R10 // 0a269d5a
|
||||||
CSNEG NE, R21, R18, R11 // ab1692da
|
CSNEG NE, R21, R18, R11 // ab1692da
|
||||||
//TODO DC
|
//TODO DC
|
||||||
// DCPS1 $11378 // 418ea5d4
|
DCPS1 $11378 // 418ea5d4
|
||||||
// DCPS2 $10699 // 6239a5d4
|
DCPS2 $10699 // 6239a5d4
|
||||||
// DCPS3 $24415 // e3ebabd4
|
DCPS3 $24415 // e3ebabd4
|
||||||
DMB $1 // bf3103d5
|
DMB $1 // bf3103d5
|
||||||
DMB $0 // bf3003d5
|
DMB $0 // bf3003d5
|
||||||
DRPS // e003bfd6
|
DRPS // e003bfd6
|
||||||
@ -145,8 +145,8 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
|
|||||||
EXTR $35, R22, R12, R8 // 888dd693
|
EXTR $35, R22, R12, R8 // 888dd693
|
||||||
SEVL // bf2003d5
|
SEVL // bf2003d5
|
||||||
HINT $6 // df2003d5
|
HINT $6 // df2003d5
|
||||||
// HLT $65509 // a0fc5fd4
|
HLT $65509 // a0fc5fd4
|
||||||
// HVC $61428 // 82fe1dd4
|
HVC $61428 // 82fe1dd4
|
||||||
ISB $1 // df3103d5
|
ISB $1 // df3103d5
|
||||||
ISB $15 // df3f03d5
|
ISB $15 // df3f03d5
|
||||||
LDARW (R12), R29 // 9dfddf88
|
LDARW (R12), R29 // 9dfddf88
|
||||||
@ -304,7 +304,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
|
|||||||
SMNEGL R26, R3, R15 // 6ffc3a9b
|
SMNEGL R26, R3, R15 // 6ffc3a9b
|
||||||
SMULH R17, R21, R21 // b57e519b
|
SMULH R17, R21, R21 // b57e519b
|
||||||
SMULL R0, R5, R0 // a07c209b
|
SMULL R0, R5, R0 // a07c209b
|
||||||
// SMC $37977 // 238b12d4
|
SMC $37977 // 238b12d4
|
||||||
STLRW R16, (R22) // d0fe9f88
|
STLRW R16, (R22) // d0fe9f88
|
||||||
STLR R3, (R24) // 03ff9fc8
|
STLR R3, (R24) // 03ff9fc8
|
||||||
//TODO STLRB R11, (R22) // cbfe9f08
|
//TODO STLRB R11, (R22) // cbfe9f08
|
||||||
|
@ -271,7 +271,7 @@ var optab = []Optab{
|
|||||||
{ALSL, C_VCON, C_NONE, C_REG, 8, 4, 0, 0, 0},
|
{ALSL, C_VCON, C_NONE, C_REG, 8, 4, 0, 0, 0},
|
||||||
{ALSL, C_REG, C_NONE, C_REG, 9, 4, 0, 0, 0},
|
{ALSL, C_REG, C_NONE, C_REG, 9, 4, 0, 0, 0},
|
||||||
{ALSL, C_REG, C_REG, C_REG, 9, 4, 0, 0, 0},
|
{ALSL, C_REG, C_REG, C_REG, 9, 4, 0, 0, 0},
|
||||||
{ASVC, C_NONE, C_NONE, C_VCON, 10, 4, 0, 0, 0},
|
{ASVC, C_VCON, C_NONE, C_NONE, 10, 4, 0, 0, 0},
|
||||||
{ASVC, C_NONE, C_NONE, C_NONE, 10, 4, 0, 0, 0},
|
{ASVC, C_NONE, C_NONE, C_NONE, 10, 4, 0, 0, 0},
|
||||||
{ADWORD, C_NONE, C_NONE, C_VCON, 11, 8, 0, 0, 0},
|
{ADWORD, C_NONE, C_NONE, C_VCON, 11, 8, 0, 0, 0},
|
||||||
{ADWORD, C_NONE, C_NONE, C_LEXT, 11, 8, 0, 0, 0},
|
{ADWORD, C_NONE, C_NONE, C_LEXT, 11, 8, 0, 0, 0},
|
||||||
@ -1914,8 +1914,8 @@ func buildop(ctxt *obj.Link) {
|
|||||||
break
|
break
|
||||||
|
|
||||||
case ASVC:
|
case ASVC:
|
||||||
oprangeset(AHLT, t)
|
|
||||||
oprangeset(AHVC, t)
|
oprangeset(AHVC, t)
|
||||||
|
oprangeset(AHLT, t)
|
||||||
oprangeset(ASMC, t)
|
oprangeset(ASMC, t)
|
||||||
oprangeset(ABRK, t)
|
oprangeset(ABRK, t)
|
||||||
oprangeset(ADCPS1, t)
|
oprangeset(ADCPS1, t)
|
||||||
@ -2301,8 +2301,8 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
|
|||||||
case 10: /* brk/hvc/.../svc [$con] */
|
case 10: /* brk/hvc/.../svc [$con] */
|
||||||
o1 = c.opimm(p, p.As)
|
o1 = c.opimm(p, p.As)
|
||||||
|
|
||||||
if p.To.Type != obj.TYPE_NONE {
|
if p.From.Type != obj.TYPE_NONE {
|
||||||
o1 |= uint32((p.To.Offset & 0xffff) << 5)
|
o1 |= uint32((p.From.Offset & 0xffff) << 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
case 11: /* dword */
|
case 11: /* dword */
|
||||||
|
@ -813,7 +813,7 @@ var unaryDst = map[obj.As]bool{
|
|||||||
ADWORD: true,
|
ADWORD: true,
|
||||||
ABL: true,
|
ABL: true,
|
||||||
AB: true,
|
AB: true,
|
||||||
ASVC: true,
|
ACLREX: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
var Linkarm64 = obj.LinkArch{
|
var Linkarm64 = obj.LinkArch{
|
||||||
|
Loading…
Reference in New Issue
Block a user