Skip to content

Commit 8b3a64a

Browse files
authored
Merge pull request #5247 from pmsjt/sve-abi
Document the new Unwind Opcodes for SVE
2 parents d6c3a61 + 2ea6c3d commit 8b3a64a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/build/arm64-exception-handling.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,20 @@ The unwind codes are encoded according to the table below. All unwind codes are
299299
| `save_fregp_x` | 1101101x'xxzzzzzz: save pair `d(8+#X)` at `[sp-(#Z+1)*8]!`, pre-indexed offset >= -512 |
300300
| `save_freg` | 1101110x'xxzzzzzz: save reg `d(8+#X)` at `[sp+#Z*8]`, offset \<= 504 |
301301
| `save_freg_x` | 11011110'xxxzzzzz: save reg `d(8+#X)` at `[sp-(#Z+1)*8]!`, pre-indexed offset >= -256 |
302+
| `alloc_z` | 11011111'zzzzzzzz: allocate stack with size `z * SVE-VL` |
302303
| `alloc_l` | 11100000'xxxxxxxx'xxxxxxxx'xxxxxxxx: allocate large stack with size \< 256M (2^24 * 16) |
303304
| `set_fp` | 11100001: set up `x29` with `mov x29,sp` |
304305
| `add_fp` | 11100010'xxxxxxxx: set up `x29` with `add x29,sp,#x*8` |
305306
| `nop` | 11100011: no unwind operation is required. |
306307
| `end` | 11100100: end of unwind code. Implies `ret` in epilog. |
307308
| `end_c` | 11100101: end of unwind code in current chained scope. |
308-
| `save_next` | 11100110: save next non-volatile Int or FP register pair. |
309-
| | 11100111: reserved |
309+
| `save_next` | 11100110: save next register pair. |
310+
| `save_any_xreg` | 11100111'0pxrrrrr'00oooooo: save register(s)<ul><li>`p`: 0/1 => single `X(#r)` vs pair `X(#r)` + `X(#r+1)`</li><li>`x`: 0/1 => positive vs negative pre-indexed stack offset</li><li>`o`: offset = `o` * 16, if x=1 or p=1, else `o` * 8</li></ul>(Windows >= 11 required) |
311+
| `save_any_dreg` | 11100111'0pxrrrrr'01oooooo: save register(s)<ul><li>`p`: 0/1 => single `D(#r)` vs pair `D(#r)` + `D(#r+1)`</li><li>`x`: 0/1 => positive vs negative pre-indexed stack offset</li><li>`o`: offset = `o` * 16, if x=1 or p=1, else `o` * 8</li></ul>(Windows >= 11 required) |
312+
| `save_any_qreg` | 11100111'0pxrrrrr'10oooooo: save register(s)<ul><li>`p`: 0/1 => single `Q(#r)` vs pair `Q(#r)` + `Q(#r+1)`</li><li>`x`: 0/1 => positive vs negative pre-indexed stack offset</li><li>`o`: offset = `o` * 16</li></ul>(Windows >= 11 required) |
313+
| `save_zreg` | 11100111'0oo0rrrr'11oooooo: save reg `Z(#r+8)` at `[sp + #o * VL]`, (`Z8` through `Z23`)
314+
| `save_preg` | 11100111'0oo1rrrr'11oooooo: save reg `P(#r+8)` at `[sp + #o * (VL / 8)]`, (`P4` through `P15`; `r` values `[0, 3]` are reserved)
315+
| | 11100111'1yyyyyyy': reserved |
310316
| | 11101xxx: reserved for custom stack cases below only generated for asm routines |
311317
| | 11101000: Custom stack for `MSFT_OP_TRAP_FRAME` |
312318
| | 11101001: Custom stack for `MSFT_OP_MACHINE_FRAME` |
@@ -330,7 +336,7 @@ In instructions with large values covering multiple bytes, the most significant
330336

331337
Post-indexed offset addressing isn't allowed in a prolog. All offset ranges (#Z) match the encoding of `stp`/`str` addressing except `save_r19r20_x`, in which 248 is sufficient for all save areas (10 Int registers + 8 FP registers + 8 input registers).
332338

333-
`save_next` must follow a save for Int or FP volatile register pair: `save_regp`, `save_regp_x`, `save_fregp`, `save_fregp_x`, `save_r19r20_x`, or another `save_next`. It saves the next register pair at the next 16-byte slot in "growing up" order. A `save_next` refers to the first FP register pair when it follows the `save-next` that denotes the last Int register pair.
339+
`save_next` must follow a save for a register pair: `save_regp`, `save_regp_x`, `save_fregp`, `save_fregp_x`, `save_r19r20_x`, or another `save_next`. It can also be used in conjunction with `save_any_xreg`, `save_any_dreg` or `save_any_qreg` but only when `p = 1`. It saves the next register pair in numerically increasing order to the next stack space. `save_next` must not be used beyond the last register of the same kind.
334340

335341
Since the sizes of regular return and jump instructions are the same, there's no need for a separated `end` unwind code in tail-call scenarios.
336342

0 commit comments

Comments
 (0)