diff options
| author | Mike Pall <mike> | 2025-10-28 04:46:10 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2025-10-28 04:46:10 +0100 |
| commit | 8651ef6df45189ad5ab734275568c9538038fcfa (patch) | |
| tree | 3609dc160911e3299a4f60b4452d8e52f43c6b17 /dynasm | |
| parent | e34a78acf6b8656874b1c25a12a7cd1813d73af9 (diff) | |
| download | luajit-8651ef6df45189ad5ab734275568c9538038fcfa.tar.gz luajit-8651ef6df45189ad5ab734275568c9538038fcfa.tar.bz2 luajit-8651ef6df45189ad5ab734275568c9538038fcfa.zip | |
ARM64: Add support for ARM BTI.
Note: this is not enabled by default, look for CET in lj_arch.h.
Thanks to Yuichiro Naito. #1398
Diffstat (limited to 'dynasm')
| -rw-r--r-- | dynasm/dasm_arm64.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dynasm/dasm_arm64.lua b/dynasm/dasm_arm64.lua index 8b27e962..db3adb48 100644 --- a/dynasm/dasm_arm64.lua +++ b/dynasm/dasm_arm64.lua | |||
| @@ -244,6 +244,10 @@ local map_cond = { | |||
| 244 | hs = 2, lo = 3, | 244 | hs = 2, lo = 3, |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | local map_bti = { | ||
| 248 | c = 0x40, j = 0x80, jc = 0xc0, | ||
| 249 | } | ||
| 250 | |||
| 247 | ------------------------------------------------------------------------------ | 251 | ------------------------------------------------------------------------------ |
| 248 | 252 | ||
| 249 | local parse_reg_type | 253 | local parse_reg_type |
| @@ -475,6 +479,12 @@ local function parse_cond(expr, inv) | |||
| 475 | return shl(bit.bxor(c, inv), 12) | 479 | return shl(bit.bxor(c, inv), 12) |
| 476 | end | 480 | end |
| 477 | 481 | ||
| 482 | local function parse_map(expr, map) | ||
| 483 | local x = map[expr] | ||
| 484 | if not x then werror("bad operand") end | ||
| 485 | return x | ||
| 486 | end | ||
| 487 | |||
| 478 | local function parse_load(params, nparams, n, op) | 488 | local function parse_load(params, nparams, n, op) |
| 479 | if params[n+2] then werror("too many operands") end | 489 | if params[n+2] then werror("too many operands") end |
| 480 | local scale = shr(op, 30) | 490 | local scale = shr(op, 30) |
| @@ -823,11 +833,21 @@ map_op = { | |||
| 823 | tbz_3 = "36000000DTBw|36000000DTBx", | 833 | tbz_3 = "36000000DTBw|36000000DTBx", |
| 824 | tbnz_3 = "37000000DTBw|37000000DTBx", | 834 | tbnz_3 = "37000000DTBw|37000000DTBx", |
| 825 | 835 | ||
| 836 | -- Branch Target Identification. | ||
| 837 | bti_1 = "d503241ft", | ||
| 838 | |||
| 826 | -- ARM64e: Pointer authentication codes (PAC). | 839 | -- ARM64e: Pointer authentication codes (PAC). |
| 827 | blraaz_1 = "d63f081fNx", | 840 | blraaz_1 = "d63f081fNx", |
| 841 | blrabz_1 = "d63f0c1fNx", | ||
| 828 | braa_2 = "d71f0800NDx", | 842 | braa_2 = "d71f0800NDx", |
| 843 | brab_2 = "d71f0c00NDx", | ||
| 829 | braaz_1 = "d61f081fNx", | 844 | braaz_1 = "d61f081fNx", |
| 845 | brabz_1 = "d61f0c1fNx", | ||
| 846 | paciasp_0 = "d503233f", | ||
| 830 | pacibsp_0 = "d503237f", | 847 | pacibsp_0 = "d503237f", |
| 848 | autiasp_0 = "d50323bf", | ||
| 849 | autibsp_0 = "d50323ff", | ||
| 850 | retaa_0 = "d65f0bff", | ||
| 831 | retab_0 = "d65f0fff", | 851 | retab_0 = "d65f0fff", |
| 832 | 852 | ||
| 833 | -- Miscellaneous instructions. | 853 | -- Miscellaneous instructions. |
| @@ -996,6 +1016,8 @@ local function parse_template(params, template, nparams, pos) | |||
| 996 | op = op + parse_cond(q, 0); n = n + 1 | 1016 | op = op + parse_cond(q, 0); n = n + 1 |
| 997 | elseif p == "c" then | 1017 | elseif p == "c" then |
| 998 | op = op + parse_cond(q, 1); n = n + 1 | 1018 | op = op + parse_cond(q, 1); n = n + 1 |
| 1019 | elseif p == "t" then | ||
| 1020 | op = op + parse_map(q, map_bti); n = n + 1 | ||
| 999 | 1021 | ||
| 1000 | else | 1022 | else |
| 1001 | assert(false) | 1023 | assert(false) |
