cmd/internal/obj/x86: add support for the endbr64 instruction on amd64

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>
This commit is contained in:
Joel Sing 2024-06-15 01:29:32 +10:00
parent 9b842e2e63
commit 04de448c6d
4 changed files with 5 additions and 0 deletions

View file

@ -1059,5 +1059,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$0
RDPID DX // f30fc7fa
RDPID R11 // f3410fc7fb
ENDBR64 // f30f1efa
// End of tests.
RET

View file

@ -212,6 +212,7 @@ const (
ADPPD
ADPPS
AEMMS
AENDBR64
AENTER
AEXTRACTPS
AF2XM1

View file

@ -210,6 +210,7 @@ var Anames = []string{
"DPPD",
"DPPS",
"EMMS",
"ENDBR64",
"ENTER",
"EXTRACTPS",
"F2XM1",

View 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}},