Skip to content
This repository
Browse code

Fix incorrect return to physical address upon ITLB page fault exception

When returning from itlb page fault we need to return to
the virtual address which caused the page fault and not the physical address.
We therefore overwrite the content of "ea" (exception address) register with
the result of rcsr ITLBMA.
  • Loading branch information...
commit 0b65466c149be9125e05cc9d7a72210bfb943d63 1 parent 4225524
Yann Sionneau authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  software/mmu-bios/crt0.S
3  software/mmu-bios/crt0.S
@@ -122,11 +122,12 @@ _dtlb_miss_exception_handler:
122 122
 _itlb_miss_exception_handler:
123 123
 	sw	(sp+0), ra
124 124
 	calli	.save_all
  125
+	rcsr	r1, itlbma /* get virtual address which caused the page fault */
  126
+	mv 	ea, r1 /* when returning from exception we branch back to that virtual address */
125 127
 	calli	itlb_miss_handler
126 128
 	bi	.restore_all_and_eret
127 129
 	nop
128 130
 	nop
129  
-	nop
130 131
 
131 132
 macaddress:
132 133
 	.byte 0x10

0 notes on commit 0b65466

Please sign in to comment.
Something went wrong with that request. Please try again.