omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / aienux / kernel / arm64 / mmu.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note aienux/kernel/arm64/mmu.om: Pure-Omega physical-frame-backed AArch64 Stage-1 4-level MMU. |
| 3 | note Enforces all #23/#26/#30/#32 safety invariants: |
| 4 | note - MAIR_EL1 = 0x00000000440004ff (0=WB 0xff, 1=Dev-nGnRE 0x04, 2=Dev-nGnRnE 0x00, 3=Normal-NC 0x44) |
| 5 | note - Strict W^X and strict XN (PXN|UXN) on all non-WB attrs (1, 2, 3) |
| 6 | note - Pre-carved 2 MiB-aligned Normal-NC DMA pool (512 MiB on Spark / 64 MiB on <=2 GiB QEMU) |
| 7 | note zeroed + DC CIVAC + DSB SY before SCTLR_EL1.M=1 |
| 8 | note - TCR_EL1.IPS derived from ID_AA64MMFR0_EL1.PARange, fail-closed if < 40-bit (PARange < 2) |
| 9 | note - Exact ARMv8/v9 BBM + TLBI VMALLE1IS + DC CIVAC for any post-MMU non-kernel NC remap |
| 10 | note - DC CVAC + DSB SY over all page-table frames before EL1 entry and before PSCI CPU_ON. |
| 11 | |
| 12 | const MMU_MAIR_WB ulong 0 |
| 13 | const MMU_MAIR_DEV_NGNRE ulong 1 |
| 14 | const MMU_MAIR_DEV_NGNRNE ulong 2 |
| 15 | const MMU_MAIR_NORMAL_NC ulong 3 |
| 16 | const MMU_MAIR_EL1 ulong 0x00000000440004ff |
| 17 | |
| 18 | const MMU_SH_NONE ulong 0 |
| 19 | const MMU_SH_OSH ulong 2 |
| 20 | const MMU_SH_ISH ulong 3 |
| 21 | |
| 22 | const MMU_FLAG_RW ulong 1 |
| 23 | const MMU_FLAG_EXEC ulong 2 |
| 24 | |
| 25 | const MMU_PAGE ulong 4096 |
| 26 | const MMU_2M ulong 0x200000 |
| 27 | const MMU_1G ulong 0x40000000 |
| 28 | const MMU_ADDR_MASK ulong 0x0000fffffffff000 |
| 29 | const MMU_MAX_PT_FRAMES ulong 256 |
| 30 | const MMU_BBM_MAX_LEAVES ulong 2048 |
| 31 | |
| 32 | note mmu_state: |
| 33 | note 0=l0_pa, 1=npt_frames, 2=tcr_el1, 3=sctlr_el1, 4=live (0=pre-MMU, 1=MMU on), |
| 34 | note 5=img_base, 6=img_end, 7=el1_stack_lo, 8=el1_stack_hi, |
| 35 | note 9=pt_pool_base, 10=pt_pool_cap, 11=pt_pool_used |
| 36 | global mmu_state ulong 16 |
| 37 | global mmu_pt_frames ulong 256 |
| 38 | global mmu_bbm_sz ulong 2048 |
| 39 | note el2_to_el1 context (8 * u64 = 64 bytes) |
| 40 | global mmu_el1_ctx uchar 64 |
| 41 | |
| 42 | fn mmu_zero_page pa ulong to void |
| 43 | i = ulong 0 |
| 44 | while lt i MMU_PAGE bound 512 |
| 45 | x = fwst add pa i 8 0 |
| 46 | i = add i 8 |
| 47 | end |
| 48 | end |
| 49 | |
| 50 | note Allocate a 4 KiB page-table frame from the pre-carved PT pool (never mutates fr_base/fr_end!). |
| 51 | fn mmu_alloc_pt_frame to ulong |
| 52 | used = get mmu_state 11 |
| 53 | cap = get mmu_state 10 |
| 54 | if ge used cap |
| 55 | ret 0 |
| 56 | end |
| 57 | pa = add get mmu_state 9 mul used MMU_PAGE |
| 58 | mmu_zero_page pa |
| 59 | put mmu_pt_frames used pa |
| 60 | put mmu_state 11 add used 1 |
| 61 | put mmu_state 1 add used 1 |
| 62 | ret pa |
| 63 | end |
| 64 | |
| 65 | fn mmu_is_protected_range lo ulong hi ulong to bool |
| 66 | ib = get mmu_state 5 |
| 67 | ie = get mmu_state 6 |
| 68 | if and lt lo ie gt hi ib |
| 69 | ret true |
| 70 | end |
| 71 | sb = get mmu_state 7 |
| 72 | se = get mmu_state 8 |
| 73 | if and ne se 0 and lt lo se gt hi sb |
| 74 | ret true |
| 75 | end |
| 76 | ptb = get mmu_state 9 |
| 77 | pte = add ptb mul get mmu_state 10 MMU_PAGE |
| 78 | if and ne pte ptb and lt lo pte gt hi ptb |
| 79 | ret true |
| 80 | end |
| 81 | ret false |
| 82 | end |
| 83 | |
| 84 | fn mmu_leaf_desc pa ulong attr ulong sh ulong flags ulong is_l3 bool to ulong |
| 85 | note Enforce W^X and strict XN on all non-WB attrs (1, 2, 3). |
| 86 | is_rw = ne and flags MMU_FLAG_RW 0 |
| 87 | is_ex = ne and flags MMU_FLAG_EXEC 0 |
| 88 | if and is_rw is_ex |
| 89 | ret 0 |
| 90 | end |
| 91 | if and is_ex ne attr MMU_MAIR_WB |
| 92 | ret 0 |
| 93 | end |
| 94 | if gt attr MMU_MAIR_NORMAL_NC |
| 95 | ret 0 |
| 96 | end |
| 97 | ap = ulong 2 |
| 98 | if is_rw |
| 99 | ap = ulong 0 |
| 100 | end |
| 101 | kind = ulong 1 |
| 102 | if is_l3 |
| 103 | kind = ulong 3 |
| 104 | end |
| 105 | bits = or and pa MMU_ADDR_MASK kind |
| 106 | bits = or bits shl attr 2 |
| 107 | bits = or bits shl ap 6 |
| 108 | bits = or bits shl sh 8 |
| 109 | note AF (bit 10) = 1 |
| 110 | bits = or bits shl ulong 1 10 |
| 111 | note UXN (bit 54) always 1 for kernel; PXN (bit 53) = 1 unless executable WB |
| 112 | bits = or bits shl ulong 1 54 |
| 113 | if not is_ex |
| 114 | bits = or bits shl ulong 1 53 |
| 115 | end |
| 116 | ret bits |
| 117 | end |
| 118 | |
| 119 | fn mmu_walk_ensure table_pa ulong va ulong lvl ulong to ulong |
| 120 | sh = sub 39 mul lvl 9 |
| 121 | idx = and shr va sh 511 |
| 122 | ent_pa = add table_pa mul idx 8 |
| 123 | ent = fwld ent_pa 8 |
| 124 | if eq and ent 1 0 |
| 125 | child = mmu_alloc_pt_frame |
| 126 | if eq child 0 |
| 127 | ret 0 |
| 128 | end |
| 129 | x = fwst ent_pa 8 or and child MMU_ADDR_MASK 3 |
| 130 | ret child |
| 131 | end |
| 132 | if eq and ent 3 3 |
| 133 | ret and ent MMU_ADDR_MASK |
| 134 | end |
| 135 | ret 0 |
| 136 | end |
| 137 | |
| 138 | fn mmu_map_leaf va ulong pa ulong sz ulong attr ulong sh ulong flags ulong to bool |
| 139 | tlevel = ulong 3 |
| 140 | if eq sz MMU_1G |
| 141 | tlevel = ulong 1 |
| 142 | else |
| 143 | if eq sz MMU_2M |
| 144 | tlevel = ulong 2 |
| 145 | end |
| 146 | end |
| 147 | desc = mmu_leaf_desc pa attr sh flags eq tlevel 3 |
| 148 | if eq desc 0 |
| 149 | ret false |
| 150 | end |
| 151 | cur = get mmu_state 0 |
| 152 | lvl = ulong 0 |
| 153 | while lt lvl tlevel bound 4 |
| 154 | cur = mmu_walk_ensure cur va lvl |
| 155 | if eq cur 0 |
| 156 | ret false |
| 157 | end |
| 158 | lvl = add lvl 1 |
| 159 | end |
| 160 | lsh = sub 39 mul tlevel 9 |
| 161 | lidx = and shr va lsh 511 |
| 162 | ent_pa = add cur mul lidx 8 |
| 163 | x = fwst ent_pa 8 desc |
| 164 | ret true |
| 165 | end |
| 166 | |
| 167 | fn mmu_pick_sz va ulong pa ulong rem_len ulong to ulong |
| 168 | if ge rem_len MMU_1G |
| 169 | if and eq rem va MMU_1G 0 eq rem pa MMU_1G 0 |
| 170 | ret MMU_1G |
| 171 | end |
| 172 | end |
| 173 | if ge rem_len MMU_2M |
| 174 | if and eq rem va MMU_2M 0 eq rem pa MMU_2M 0 |
| 175 | ret MMU_2M |
| 176 | end |
| 177 | end |
| 178 | ret MMU_PAGE |
| 179 | end |
| 180 | |
| 181 | note Identity-map [pa, pa + len) with given MAIR attr, shareability, and W^X flags. |
| 182 | fn mmu_map_id pa ulong length ulong attr ulong sh ulong flags ulong to bool |
| 183 | if or eq length 0 or ne and pa 0xfff 0 ne and length 0xfff 0 |
| 184 | ret false |
| 185 | end |
| 186 | if gt length sub 0xffffffffffffffff pa |
| 187 | ret false |
| 188 | end |
| 189 | off = ulong 0 |
| 190 | while lt off length bound 131072 |
| 191 | cur = add pa off |
| 192 | sz = mmu_pick_sz cur cur sub length off |
| 193 | if not mmu_map_leaf cur cur sz attr sh flags |
| 194 | ret false |
| 195 | end |
| 196 | off = add off sz |
| 197 | end |
| 198 | ret true |
| 199 | end |
| 200 | |
| 201 | note Map MMIO [pa, pa + len) as Device-nGnRnE (MAIR=2), Non-Shareable, RW, strict XN. |
| 202 | fn mmio_map_device pa ulong length ulong to bool |
| 203 | if or eq length 0 gt length sub 0xffffffffffffffff pa |
| 204 | ret false |
| 205 | end |
| 206 | base = fr_align_down pa MMU_PAGE |
| 207 | end_pa = fr_align_up add pa length MMU_PAGE |
| 208 | if or eq end_pa 0xffffffffffffffff le end_pa base |
| 209 | ret false |
| 210 | end |
| 211 | ok = mmu_map_id base sub end_pa base MMU_MAIR_DEV_NGNRNE MMU_SH_NONE MMU_FLAG_RW |
| 212 | if and ok ne get mmu_state 4 0 |
| 213 | arm64_dsb_ish |
| 214 | arm64_tlbi_vmalle1is |
| 215 | end |
| 216 | ret ok |
| 217 | end |
| 218 | |
| 219 | note Break a single pre-split leaf at cur (must fit inside rem_len). Returns leaf size or 0 on error. |
| 220 | fn mmu_break_one_leaf cur ulong rem_len ulong to ulong |
| 221 | tab = get mmu_state 0 |
| 222 | lvl = ulong 0 |
| 223 | while lt lvl 4 bound 4 |
| 224 | sh = sub 39 mul lvl 9 |
| 225 | idx = and shr cur sh 511 |
| 226 | ep = add tab mul idx 8 |
| 227 | ent = fwld ep 8 |
| 228 | if eq and ent 1 0 |
| 229 | ret 0 |
| 230 | end |
| 231 | if or eq lvl 0 and eq and ent 3 3 lt lvl 3 |
| 232 | tab = and ent MMU_ADDR_MASK |
| 233 | else |
| 234 | lsz = MMU_PAGE |
| 235 | if eq lvl 1 |
| 236 | lsz = MMU_1G |
| 237 | else |
| 238 | if eq lvl 2 |
| 239 | lsz = MMU_2M |
| 240 | end |
| 241 | end |
| 242 | if or ne rem cur lsz 0 lt rem_len lsz |
| 243 | ret 0 |
| 244 | end |
| 245 | x = fwst ep 8 0 |
| 246 | ret lsz |
| 247 | end |
| 248 | lvl = add lvl 1 |
| 249 | end |
| 250 | ret 0 |
| 251 | end |
| 252 | |
| 253 | note Safe post-MMU remap of a pre-split non-kernel range to Normal-NC (SH=OSH, RW, XN). |
| 254 | note Remaps at the EXACT broken leaf granularity (never writes an L2 block over a valid L2 table!). |
| 255 | note Exact ARMv8/v9 BBM sequence: |
| 256 | note Break(0) -> DSB ISH -> TLBI VMALLE1IS -> DSB ISH -> ISB -> Make(NC at broken leaf sz) -> DSB ISH -> ISB -> DC CIVAC -> DSB SY |
| 257 | fn mmu_remap_nc_bbm pa ulong length ulong to bool |
| 258 | if or eq length 0 or ne and pa 0xfff 0 ne and length 0xfff 0 |
| 259 | ret false |
| 260 | end |
| 261 | if gt length sub 0xffffffffffffffff pa |
| 262 | ret false |
| 263 | end |
| 264 | if mmu_is_protected_range pa add pa length |
| 265 | ret false |
| 266 | end |
| 267 | off = ulong 0 |
| 268 | k = ulong 0 |
| 269 | while lt off length bound 2048 |
| 270 | if ge k MMU_BBM_MAX_LEAVES |
| 271 | ret false |
| 272 | end |
| 273 | lsz = mmu_break_one_leaf add pa off sub length off |
| 274 | if eq lsz 0 |
| 275 | ret false |
| 276 | end |
| 277 | put mmu_bbm_sz k lsz |
| 278 | k = add k 1 |
| 279 | off = add off lsz |
| 280 | end |
| 281 | if ne off length |
| 282 | ret false |
| 283 | end |
| 284 | arm64_dsb_ish |
| 285 | arm64_tlbi_vmalle1is |
| 286 | off = ulong 0 |
| 287 | j = ulong 0 |
| 288 | while lt j k bound 2048 |
| 289 | lsz = get mmu_bbm_sz j |
| 290 | if not mmu_map_leaf add pa off add pa off lsz MMU_MAIR_NORMAL_NC MMU_SH_OSH MMU_FLAG_RW |
| 291 | ret false |
| 292 | end |
| 293 | off = add off lsz |
| 294 | j = add j 1 |
| 295 | end |
| 296 | arm64_dsb_ish |
| 297 | arm64_dc_civac_range pa length |
| 298 | ret true |
| 299 | end |
| 300 | |
| 301 | note Clean all live page-table frames to Point of Coherency (DC CVAC + DSB SY) before EL1 / PSCI CPU_ON. |
| 302 | fn mmu_clean_tables_poc to void |
| 303 | nf = get mmu_state 1 |
| 304 | i = ulong 0 |
| 305 | while lt i nf bound 1024 |
| 306 | arm64_dc_cvac_range get mmu_pt_frames i MMU_PAGE |
| 307 | i = add i 1 |
| 308 | end |
| 309 | arm64_dsb_sy |
| 310 | end |
| 311 | |
| 312 | note Compute TCR_EL1 with 48-bit VA (T0SZ=16), 4 KiB granule, WB-WA Inner-Shareable walks, |
| 313 | note EPD1=1 (TTBR1 disabled), and IPS derived from ID_AA64MMFR0_EL1.PARange. |
| 314 | note Fails closed (returns 0) if PARange < 2 (< 40-bit PA, required for 0xF340000000/0xF370000000 ECAM). |
| 315 | fn mmu_build_tcr_el1 parange ulong to ulong |
| 316 | pr = and parange 15 |
| 317 | if lt pr 2 |
| 318 | ret 0 |
| 319 | end |
| 320 | ips = pr |
| 321 | if gt ips 5 |
| 322 | ips = ulong 5 |
| 323 | end |
| 324 | note T0SZ=16 | IRGN0=1 (WB-WA) << 8 | ORGN0=1 << 10 | SH0=3 (ISH) << 12 | TG0=0 (4K) << 14 | EPD1=1 << 23 | IPS << 32 |
| 325 | tcr = ulong 16 |
| 326 | tcr = or tcr shl ulong 1 8 |
| 327 | tcr = or tcr shl ulong 1 10 |
| 328 | tcr = or tcr shl ulong 3 12 |
| 329 | tcr = or tcr shl ulong 1 23 |
| 330 | tcr = or tcr shl ips 32 |
| 331 | ret tcr |
| 332 | end |
| 333 | |
| 334 | fn mmu_carve_nc_pool to bool |
| 335 | free_b = frames_free_bytes |
| 336 | nc_bytes = ulong 0x04000000 |
| 337 | if ge free_b 0x80000000 |
| 338 | nc_bytes = ulong 0x20000000 |
| 339 | end |
| 340 | nc_pages = div nc_bytes MMU_PAGE |
| 341 | nc_pa = frames_alloc nc_pages MMU_2M FR_PA_40BIT_LIMIT |
| 342 | if eq nc_pa 0 |
| 343 | ret false |
| 344 | end |
| 345 | dma_pool_init nc_pa nc_bytes |
| 346 | p = ulong 0 |
| 347 | while lt p nc_bytes bound 67108864 |
| 348 | x = fwst add nc_pa p 8 0 |
| 349 | p = add p 8 |
| 350 | end |
| 351 | arm64_dc_civac_range nc_pa nc_bytes |
| 352 | ret mmu_map_id nc_pa nc_bytes MMU_MAIR_NORMAL_NC MMU_SH_OSH MMU_FLAG_RW |
| 353 | end |
| 354 | |
| 355 | fn mmu_map_ram_and_pts to bool |
| 356 | note Map pre-carved PT pool ONCE as Normal-WB RW+XN (never mutates fr_base/fr_end!). |
| 357 | pt_len = mul get mmu_state 10 MMU_PAGE |
| 358 | if not mmu_map_id get mmu_state 9 pt_len MMU_MAIR_WB MMU_SH_ISH MMU_FLAG_RW |
| 359 | ret false |
| 360 | end |
| 361 | nr = frames_region_count |
| 362 | ri = ulong 0 |
| 363 | while lt ri nr bound 256 |
| 364 | rb = get fr_base ri |
| 365 | re = get fr_end ri |
| 366 | if gt re rb |
| 367 | if not mmu_map_id rb sub re rb MMU_MAIR_WB MMU_SH_ISH MMU_FLAG_RW |
| 368 | ret false |
| 369 | end |
| 370 | end |
| 371 | ri = add ri 1 |
| 372 | end |
| 373 | ret true |
| 374 | end |
| 375 | |
| 376 | fn mmu_map_platform_mmio to bool |
| 377 | if ne uart_base 0 |
| 378 | if not mmio_map_device uart_base 0x1000 |
| 379 | ret false |
| 380 | end |
| 381 | end |
| 382 | if ne get acpi_info 2 0 |
| 383 | if not mmio_map_device get acpi_info 2 0x10000 |
| 384 | ret false |
| 385 | end |
| 386 | end |
| 387 | if ne get acpi_info 3 0 |
| 388 | gl = get acpi_info 4 |
| 389 | if lt gl 0x20000 |
| 390 | gl = ulong 0x20000 |
| 391 | end |
| 392 | if not mmio_map_device get acpi_info 3 gl |
| 393 | ret false |
| 394 | end |
| 395 | end |
| 396 | if ne get acpi_info 5 0 |
| 397 | if not mmio_map_device get acpi_info 5 0x20000 |
| 398 | ret false |
| 399 | end |
| 400 | end |
| 401 | if and ne get acpi_info 10 0 ne get acpi_info 11 0 |
| 402 | ib = fr_align_down get acpi_info 10 MMU_PAGE |
| 403 | ie = fr_align_up add get acpi_info 10 get acpi_info 11 MMU_PAGE |
| 404 | if not mmu_map_id ib sub ie ib MMU_MAIR_WB MMU_SH_ISH 0 |
| 405 | ret false |
| 406 | end |
| 407 | end |
| 408 | ret true |
| 409 | end |
| 410 | |
| 411 | note Build initial Stage-1 page tables BEFORE SCTLR_EL1.M=1: |
| 412 | fn mmu_build_initial img_base ulong bss_base ulong img_end ulong to bool |
| 413 | for i ulong 16 |
| 414 | put mmu_state i 0 |
| 415 | end |
| 416 | put mmu_state 5 img_base |
| 417 | put mmu_state 6 img_end |
| 418 | tcr = mmu_build_tcr_el1 arm64_sysrd SYSREG_ID_AA64MMFR0 |
| 419 | if eq tcr 0 |
| 420 | ret false |
| 421 | end |
| 422 | put mmu_state 2 tcr |
| 423 | note SCTLR_EL1: RES1 (0x30d00800) | M (bit 0) | C (bit 2) | I (bit 12) = 0x30d01805 |
| 424 | put mmu_state 3 0x30d01805 |
| 425 | note Pre-carve dedicated PT frame pool (256 pages = 1 MiB, < 40-bit PA) BEFORE mapping RAM. |
| 426 | pt_pool = frames_alloc MMU_MAX_PT_FRAMES MMU_PAGE FR_PA_40BIT_LIMIT |
| 427 | if eq pt_pool 0 |
| 428 | ret false |
| 429 | end |
| 430 | put mmu_state 9 pt_pool |
| 431 | put mmu_state 10 MMU_MAX_PT_FRAMES |
| 432 | put mmu_state 11 0 |
| 433 | l0 = mmu_alloc_pt_frame |
| 434 | if eq l0 0 |
| 435 | ret false |
| 436 | end |
| 437 | put mmu_state 0 l0 |
| 438 | if not mmu_carve_nc_pool |
| 439 | ret false |
| 440 | end |
| 441 | stk = frames_alloc 64 MMU_PAGE FR_PA_40BIT_LIMIT |
| 442 | if eq stk 0 |
| 443 | ret false |
| 444 | end |
| 445 | put mmu_state 7 stk |
| 446 | put mmu_state 8 add stk 262144 |
| 447 | if not mmu_map_id img_base MMU_PAGE MMU_MAIR_WB MMU_SH_ISH 0 |
| 448 | ret false |
| 449 | end |
| 450 | if not mmu_map_id add img_base MMU_PAGE sub bss_base add img_base MMU_PAGE MMU_MAIR_WB MMU_SH_ISH MMU_FLAG_EXEC |
| 451 | ret false |
| 452 | end |
| 453 | if not mmu_map_id bss_base sub img_end bss_base MMU_MAIR_WB MMU_SH_ISH MMU_FLAG_RW |
| 454 | ret false |
| 455 | end |
| 456 | if not mmu_map_id stk 262144 MMU_MAIR_WB MMU_SH_ISH MMU_FLAG_RW |
| 457 | ret false |
| 458 | end |
| 459 | if not mmu_map_ram_and_pts |
| 460 | ret false |
| 461 | end |
| 462 | if not mmu_map_platform_mmio |
| 463 | ret false |
| 464 | end |
| 465 | mmu_clean_tables_poc |
| 466 | ret true |
| 467 | end |
| 468 | |
| 469 | note Enter EL1h (from EL2 via ADR 0009 eret, or switch tables if already at EL1) landing in entry_fn(arg). |
| 470 | fn mmu_enter_el1 entry_fn ulong arg ulong to void |
| 471 | ctx_pa = fwadr mmu_el1_ctx 0 64 |
| 472 | x = fwst add ctx_pa 0 8 get mmu_state 0 |
| 473 | x = fwst add ctx_pa 8 8 MMU_MAIR_EL1 |
| 474 | x = fwst add ctx_pa 16 8 get mmu_state 2 |
| 475 | x = fwst add ctx_pa 24 8 get mmu_state 3 |
| 476 | x = fwst add ctx_pa 32 8 get mmu_state 8 |
| 477 | x = fwst add ctx_pa 40 8 entry_fn |
| 478 | x = fwst add ctx_pa 48 8 arg |
| 479 | x = fwst add ctx_pa 56 8 add get mmu_state 7 16384 |
| 480 | arm64_dc_cvac_range ctx_pa 64 |
| 481 | note Clean x27 private metadata [0..512) (vbar_el1, hooks) to PoC for MMU-off reads in el2_to_el1/el1_switch. |
| 482 | arm64_dc_cvac_range arm64_meta 1 512 |
| 483 | put mmu_state 4 1 |
| 484 | el = arm64_current_el |
| 485 | if eq el 2 |
| 486 | x = fwop FWOP_EL2_TO_EL1 ctx_pa 0 0 |
| 487 | end |
| 488 | if eq el 1 |
| 489 | x = fwop FWOP_EL1_SWITCH ctx_pa 0 0 |
| 490 | end |
| 491 | trap 8 |
| 492 | end |