]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/x86: add support for the endbr64 instruction on amd64
authorJoel Sing <joel@sing.id.au>
Fri, 14 Jun 2024 15:29:32 +0000 (01:29 +1000)
committerJoel Sing <joel@sing.id.au>
Thu, 20 Feb 2025 11:20:03 +0000 (03:20 -0800)
Add support for endbr64, which terminates an indirect branch in 64-bit
mode. This is effectively used to mark locations where an indirect branch
is permitted to land, when Indirect Branch Tracking (IBT) is enforced on
Intel CPUs.

Updates #66054

Change-Id: Ib898031711cfaaa6e05c197bfe727ded0bce6f52
Reviewed-on: https://go-review.googlesource.com/c/go/+/649215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/cmd/asm/internal/asm/testdata/amd64enc_extra.s
src/cmd/internal/obj/x86/aenum.go
src/cmd/internal/obj/x86/anames.go
src/cmd/internal/obj/x86/asm6.go

index 08cb20c70718033424e12e53fbbe657d03b1f158..197b2ce628b7e3d2fa5e9a03182077fbb06d48f7 100644 (file)
@@ -1059,5 +1059,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
        RDPID DX                                // f30fc7fa
        RDPID R11                               // f3410fc7fb
 
+       ENDBR64                                 // f30f1efa
+
        // End of tests.
        RET
index 79cdd241a236a3986fb831e5ea433a3b66a459bb..c9be748b3205a8c9052552b8e9cb15c0d7294bce 100644 (file)
@@ -212,6 +212,7 @@ const (
        ADPPD
        ADPPS
        AEMMS
+       AENDBR64
        AENTER
        AEXTRACTPS
        AF2XM1
index 3966381e50d221942a350bb0eb215826e2d8133b..43483e959a056de1b15b573e2fc5dc385ff9710e 100644 (file)
@@ -210,6 +210,7 @@ var Anames = []string{
        "DPPD",
        "DPPS",
        "EMMS",
+       "ENDBR64",
        "ENTER",
        "EXTRACTPS",
        "F2XM1",
index 95020915cadfa7a905297bd19e311aad120489c6..3332134141776436d0bbf7da92eeba24306053e9 100644 (file)
@@ -1096,6 +1096,7 @@ var optab =
        {ADPPD, yxshuf, Pq, opBytes{0x3a, 0x41, 0}},
        {ADPPS, yxshuf, Pq, opBytes{0x3a, 0x40, 0}},
        {AEMMS, ynone, Pm, opBytes{0x77}},
+       {AENDBR64, ynone, Pf3, opBytes{0x1e, 0xfa}},
        {AEXTRACTPS, yextractps, Pq, opBytes{0x3a, 0x17, 0}},
        {AENTER, nil, 0, opBytes{}}, // botch
        {AFXRSTOR, ysvrs_mo, Pm, opBytes{0xae, 01, 0xae, 01}},