Index: kernel/arch/ppc32/include/asm/regname.h
===================================================================
--- kernel/arch/ppc32/include/asm/regname.h	(revision 7b187ef6f8a1aeda140487a35c3664962045e88c)
+++ kernel/arch/ppc32/include/asm/regname.h	(revision 198a9efff7fb5190fcd2f9a787b7239ceba755cb)
@@ -212,4 +212,7 @@
 #define dbat3u	542
 #define dbat3l	543
+#define tlbmiss	980
+#define ptehi	981
+#define ptelo	982
 #define hid0	1008
 
@@ -221,9 +224,9 @@
 
 /* HID0 bits */
+#define hid0_sten	(1 << 24)
 #define hid0_ice	(1 << 15)
 #define hid0_dce	(1 << 14)
 #define hid0_icfi	(1 << 11)
 #define hid0_dci	(1 << 10)
-#define hid0_sten	(1 << 7)
 
 #endif
Index: kernel/arch/ppc32/include/mm/tlb.h
===================================================================
--- kernel/arch/ppc32/include/mm/tlb.h	(revision 7b187ef6f8a1aeda140487a35c3664962045e88c)
+++ kernel/arch/ppc32/include/mm/tlb.h	(revision 198a9efff7fb5190fcd2f9a787b7239ceba755cb)
@@ -59,7 +59,25 @@
 } phte_t;
 
+typedef struct {
+	unsigned v : 1;
+	unsigned vsid : 24;
+	unsigned reserved0 : 1;
+	unsigned api : 6;
+} ptehi_t;
+
+typedef struct {
+	unsigned rpn : 20;
+	unsigned xpn : 3;
+	unsigned reserved0 : 1;
+	unsigned c : 1;
+	unsigned wimg : 4;
+	unsigned x : 1;
+	unsigned pp : 2;
+} ptelo_t;
+
+extern void pht_init(void);
 extern void pht_refill(int n, istate_t *istate);
 extern bool pht_refill_real(int n, istate_t *istate) __attribute__ ((section("K_UNMAPPED_TEXT_START")));
-extern void pht_init(void);
+extern void tlb_refill_real(int n, uint32_t tlbmiss, ptehi_t ptehi, ptelo_t ptelo, istate_t *istate) __attribute__ ((section("K_UNMAPPED_TEXT_START")));
 
 #endif
Index: kernel/arch/ppc32/src/exception.S
===================================================================
--- kernel/arch/ppc32/src/exception.S	(revision 7b187ef6f8a1aeda140487a35c3664962045e88c)
+++ kernel/arch/ppc32/src/exception.S	(revision 198a9efff7fb5190fcd2f9a787b7239ceba755cb)
@@ -209,5 +209,5 @@
 .global exc_syscall
 exc_syscall:
-	CONTEXT_STORE	
+	CONTEXT_STORE
 	
 	b jump_to_kernel_syscall
@@ -220,4 +220,25 @@
 	li r3, 12
 	b jump_to_kernel
+
+.org 0x1000
+.global exc_itlb_miss
+exc_itlb_miss:
+	CONTEXT_STORE
+	
+	b tlb_miss
+
+.org 0x1100
+.global exc_dtlb_miss_load
+exc_dtlb_miss_load:
+	CONTEXT_STORE
+	
+	b tlb_miss
+
+.org 0x1200
+.global exc_dtlb_miss_store
+exc_dtlb_miss_store:
+	CONTEXT_STORE
+	
+	b tlb_miss
 
 .org 0x4000
@@ -245,4 +266,15 @@
 	li r3, 3
 	b jump_to_kernel
+
+tlb_miss:
+	li r3, 16
+	mfspr r4, tlbmiss
+	mfspr r5, ptehi
+	mfspr r6, ptelo
+	mr r7, sp
+	addi r7, r7, 20
+	
+	bl tlb_refill_real
+	b iret_real
 
 jump_to_kernel:
Index: kernel/arch/ppc32/src/mm/tlb.c
===================================================================
--- kernel/arch/ppc32/src/mm/tlb.c	(revision 7b187ef6f8a1aeda140487a35c3664962045e88c)
+++ kernel/arch/ppc32/src/mm/tlb.c	(revision 198a9efff7fb5190fcd2f9a787b7239ceba755cb)
@@ -228,8 +228,8 @@
 
 
-/** Process Instruction/Data Storage Interrupt
- *
- * @param n		Interrupt vector number.
- * @param istate	Interrupted register context.
+/** Process Instruction/Data Storage Exception
+ *
+ * @param n      Exception vector number.
+ * @param istate Interrupted register context.
  *
  */
@@ -288,8 +288,8 @@
 
 
-/** Process Instruction/Data Storage Interrupt in Real Mode
- *
- * @param n		Interrupt vector number.
- * @param istate	Interrupted register context.
+/** Process Instruction/Data Storage Exception in Real Mode
+ *
+ * @param n      Exception vector number.
+ * @param istate Interrupted register context.
  *
  */
@@ -406,4 +406,38 @@
 	
 	return true;
+}
+
+
+/** Process ITLB/DTLB Miss Exception in Real Mode
+ *
+ *
+ */
+void tlb_refill_real(int n, uint32_t tlbmiss, ptehi_t ptehi, ptelo_t ptelo, istate_t *istate)
+{
+	uint32_t badvaddr = tlbmiss & 0xfffffffc;
+	
+	uint32_t physmem;
+	asm volatile (
+		"mfsprg3 %0\n"
+		: "=r" (physmem)
+	);
+	
+	if ((badvaddr < PA2KA(0)) || (badvaddr >= PA2KA(physmem)))
+		return; // FIXME
+	
+	ptelo.rpn = KA2PA(badvaddr) >> 12;
+	ptelo.wimg = 0;
+	ptelo.pp = 2; // FIXME
+	
+	uint32_t index = 0;
+	asm volatile (
+		"mtspr 981, %0\n"
+		"mtspr 982, %1\n"
+		"tlbld %2\n"
+		"tlbli %2\n"
+		: "=r" (index)
+		: "r" (ptehi),
+		  "r" (ptelo)
+	);
 }
 
