21 movi a2, 0x04000002 /* PPN */
22 movi a3, 0x01200004 /* VPN */
89 movi a2, 0x04000002 /* PPN */
90 movi a3, 0xf0000004 /* VPN */
102 set_vector kernel, 1f
104 movi a2, 0x04000002 /* PPN */
105 movi a3, 0x01200004 /* VPN */
107 movi a3, 0x01200007 /* VPN */
118 test inst_fetch_privilege
119 set_vector kernel, 3f
145 test load_store_privilege
146 set_vector kernel, 2f
162 movi a2, 0x04000003 /* PPN */
163 movi a3, 0x01200004 /* VPN */
190 test cring_load_store_privilege
192 set_vector double, 2f
194 movi a2, 0x04000003 /* PPN */
195 movi a3, 0x01200004 /* VPN */
198 movi a2, 0x4005f /* ring 1 + excm => cring == 0 */
201 l8ui a2, a3, 0 /* cring used */
203 l32e a2, a3, -4 /* ring used */
220 test inst_fetch_prohibited
221 set_vector kernel, 2f
254 set_vector kernel, 2f
256 movi a2, 0x0400000c /* PPN */
257 movi a3, 0x01200004 /* VPN */
274 test store_prohibited
275 set_vector kernel, 2f
277 movi a2, 0x04000001 /* PPN */
278 movi a3, 0x01200004 /* VPN */
296 /* Set up page table entry vaddr->paddr, ring=pte_ring, attr=pte_attr
297 * and DTLB way 7 to cover this PTE, ring=pt_ring, attr=pt_attr
299 .macro pt_setup pt_ring, pt_attr, pte_ring, vaddr, paddr, pte_attr
303 movi a3, 0x80000007 | (((\vaddr) >> 10) & 0xfffff000) /* way 7 */
304 movi a4, 0x04000003 | ((\pt_ring) << 4) /* PADDR 64M */
308 movi a3, ((\paddr) & 0xfffff000) | ((\pte_ring) << 4) | (\pte_attr)
309 movi a1, ((\vaddr) >> 12) << 2
313 movi a3, 0x80000007 | (((\vaddr) >> 10) & 0xfffff000) /* way 7 */
314 movi a4, 0x04000000 | ((\pt_ring) << 4) | (\pt_attr) /* PADDR 64M */
321 /* out: PS.RING=ring, PS.EXCM=excm, a3=vaddr */
322 .macro go_ring ring, excm, vaddr
341 movi a2, 0x4000f | ((\ring) << 6) | ((\excm) << 4)
348 /* in: a3 -- virtual address to test */
349 .macro assert_auto_tlb
364 /* in: a3 -- virtual address to test */
365 .macro assert_no_auto_tlb
375 .macro assert_sr sr, v
381 .macro assert_epc1_1m vaddr
392 pt_setup 0, 3, 1, 0x1000, 0x1000, 3
403 test autoload_load_store_privilege
405 set_vector double, 2f
407 pt_setup 0, 3, 0, 0x2000, 0x2000, 3
411 movi a2, 0x4005f /* ring 1 + excm => cring == 0 */
415 l32e a2, a3, -4 /* ring used */
424 assert_sr exccause, 26
427 test autoload_pte_load_prohibited
428 set_vector kernel, 2f
430 pt_setup 0, 3, 0, 0x3000, 0, 0xc
441 assert_sr exccause, 28
444 test autoload_pt_load_prohibited
445 set_vector kernel, 2f
447 pt_setup 0, 0xc, 0, 0x4000, 0x4000, 3
458 assert_sr exccause, 24
461 test autoload_pt_privilege
462 set_vector kernel, 2f
463 pt_setup 0, 3, 1, 0x5000, 0, 3
475 assert_sr exccause, 1
478 test autoload_pte_privilege
479 set_vector kernel, 2f
480 pt_setup 0, 3, 0, 0x6000, 0, 3
491 assert_sr exccause, 26
494 test autoload_3_level_pt
495 set_vector kernel, 2f
496 pt_setup 1, 3, 1, 0x00400000, 0, 3
497 pt_setup 1, 3, 1, 0x80001000, 0x2000000, 3
498 go_ring 1, 0, 0x00400001
508 assert_sr exccause, 24