]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: support MSR DIT
authorRoland Shoemaker <roland@golang.org>
Wed, 10 Jul 2024 22:02:34 +0000 (17:02 -0500)
committerRoland Shoemaker <roland@golang.org>
Wed, 24 Jul 2024 18:45:14 +0000 (18:45 +0000)
Set the right instruction bits in asmout in order
to allow using MSR with DIT and an immediate
value. This allows us to avoid using an
intermediary register when we want to set DIT
(unsetting DIT already worked with the zero
register).

Ref: https://developer.arm.com/documentation/ddi0602/2024-06/Base-Instructions/MSR--immediate---Move-immediate-value-to-special-register-?lang=en
Change-Id: Id049a0b4e0feb534cea992553228f9b5e12ddcea
Reviewed-on: https://go-review.googlesource.com/c/go/+/597595
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/asm/internal/asm/testdata/arm64.s
src/cmd/internal/obj/arm64/asm7.go

index f12cdaf921fc44fef1d766ea5f4f4c62ba488546..14a1c9141df1ec37d8f4c2a2f9fca18f8e742aad 100644 (file)
@@ -1777,6 +1777,7 @@ next:
        MSR     R17, ZCR_EL1                       // 111218d5
        SYS     $32768, R1                         // 018008d5
        SYS     $32768                             // 1f8008d5
+       MSR     $1, DIT                            // 5f4103d5
 
 // TLBI instruction
        TLBI    VMALLE1IS                          // 1f8308d5
index c6601cb49e51d37676416fa1da5f57068c251c64..178c83c0bc693847a564ba2b11e42413197ed770 100644 (file)
@@ -4229,6 +4229,9 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
                // PSTATEfield can be special registers and special operands.
                if p.To.Type == obj.TYPE_REG && p.To.Reg == REG_SPSel {
                        v = 0<<16 | 4<<12 | 5<<5
+               } else if p.To.Type == obj.TYPE_REG && p.To.Reg == REG_DIT {
+                       // op1 = 011 (3) op2 = 010 (2)
+                       v = 3<<16 | 2<<5
                } else if p.To.Type == obj.TYPE_SPECIAL {
                        opd := SpecialOperand(p.To.Offset)
                        for _, pf := range pstatefield {