x64: Add support for CET IBT.

Note: this is not enabled by default, look for CET in lj_arch.h
Contributed by Yuichiro Naito. #1391
This commit is contained in:
Mike Pall
2025-10-16 14:24:52 +02:00
parent 5c3254d68d
commit 25a61a1821
7 changed files with 95 additions and 10 deletions

View File

@@ -122,7 +122,7 @@ local map_opc2 = {
"movlhpsXrm$movhpsXrm|movshdupXrm|movhpdXrm",
"movhpsXmr||movhpdXmr",
"$prefetcht!Bm","hintnopVm","hintnopVm","hintnopVm",
"hintnopVm","hintnopVm","hintnopVm","hintnopVm",
"hintnopVm","hintnopVm","endbr*hintnopVm","hintnopVm",
--2x
"movUmx$","movUmy$","movUxm$","movUym$","movUmz$",nil,"movUzm$",nil,
"movapsXrm||movapdXrm",
@@ -804,6 +804,24 @@ map_act = {
return dispatch(ctx, map_opcvm[ctx.mrm])
end,
-- Special NOP for endbr64/endbr32.
endbr = function(ctx, name, pat)
if ctx.rep then
local pos = ctx.pos
local b = byte(ctx.code, pos)
local text
if b == 0xfa then text = "endbr64"
elseif b == 0xfb then text = "endbr64"
end
if text then
ctx.pos = pos + 1
ctx.rep = nil
return putop(ctx, text)
end
end
return dispatch(ctx, pat)
end,
-- Floating point opcode dispatch.
fp = function(ctx, name, pat)
local mrm = getmrm(ctx); if not mrm then return incomplete(ctx) end