Index: arch/ppc32/loader/asm.S
===================================================================
--- arch/ppc32/loader/asm.S	(revision c04bdb4a1adbf2e4881c065786370d1e6e75160f)
+++ arch/ppc32/loader/asm.S	(revision 2988616b5cdf842d27e95f78517fa3eaff7177b5)
@@ -191,17 +191,30 @@
 	
 	# initially fill segment registers
-
-	li r31, 16
-	mtctr r31
+	
 	li r31, 0
-	li r30, 0x2000
-
-	seg_fill:
+	
+	li r29, 8
+	mtctr r29
+	li r30, 0
+
+	seg_fill_uspace:
 	
 		mtsrin r30, r31
-		addi r30, r30, 0x111
+		addi r30, r30, 1
 		addis r31, r31, 0x1000    # move to next SR
 		
-		bdnz seg_fill
+		bdnz seg_fill_uspace
+	
+	li r29, 8
+	mtctr r29
+	li r30, 0x4000
+	
+	seg_fill_kernel:
+	
+		mtsrin r30, r31
+		addi r30, r30, 1
+		addis r31, r31, 0x1000    # move to next SR
+		
+		bdnz seg_fill_kernel
 	
 	# invalidate block address translation registers
@@ -242,7 +255,31 @@
 	ori r31, r31, 0x0000
 	
+	li r30, 0x4000
+	li r29, 0
+	
+	pht_clear:
+		
+		stw r29, 0(r31)
+		
+		addi r31, r31, 4
+		subi r30, r30, 4
+		
+		cmpwi r30, 0
+		beq clear_end
+		
+		bdnz pht_clear
+
+		DEBUG_end_pht_clear
+		
+	clear_end:
+	
+	lis r31, 0x07ff
+	ori r31, r31, 0x0000
+	
 	mtsdr1 r31
 	
 	# create identity mapping
+	
+#ifdef CONFIG_BAT
 	
 	DEBUG_mapping
@@ -261,4 +298,6 @@
 	mtspr dbat0u, r31
 	mtspr dbat0l, r30
+
+#endif
 	
 	DEBUG_tlb
@@ -271,5 +310,9 @@
 	# start the kernel
 	#
+	# pc = KERNEL_START_ADDR
 	# r3 = bootinfo (pa)
+	# sprg0 = KA2PA(KERNEL_START_ADDR)
+	# sprg3 = physical memory size
+	# sp = 0 (pa)
 	
 	lis r31, KERNEL_START_ADDR@ha
@@ -277,4 +320,12 @@
 	
 	mtspr srr0, r31
+	
+	subis r31, r31, 0x8000
+	mtsprg0 r31
+	
+	lwz r31, 0(r3)
+	mtsprg3 r31
+	
+	li sp, 0
 	
 	mfmsr r31
Index: arch/ppc32/loader/debug.inc
===================================================================
--- arch/ppc32/loader/debug.inc	(revision c04bdb4a1adbf2e4881c065786370d1e6e75160f)
+++ arch/ppc32/loader/debug.inc	(revision 2988616b5cdf842d27e95f78517fa3eaff7177b5)
@@ -8303,2 +8303,7 @@
 #endif
 .endm
+
+.macro DEBUG_end_pht_clear
+#ifdef CONFIG_DEBUG
+#endif
+.endm
Index: arch/ppc32/loader/main.h
===================================================================
--- arch/ppc32/loader/main.h	(revision c04bdb4a1adbf2e4881c065786370d1e6e75160f)
+++ arch/ppc32/loader/main.h	(revision 2988616b5cdf842d27e95f78517fa3eaff7177b5)
@@ -52,6 +52,6 @@
 
 typedef struct {
+	memmap_t memmap;
 	taskmap_t taskmap;
-	memmap_t memmap;
 	screen_t screen;
 	keyboard_t keyboard;
Index: boot.config
===================================================================
--- boot.config	(revision c04bdb4a1adbf2e4881c065786370d1e6e75160f)
+++ boot.config	(revision 2988616b5cdf842d27e95f78517fa3eaff7177b5)
@@ -20,4 +20,7 @@
 ! [ARCH=ppc32] CONFIG_DEBUG (n/y)
 
+# Use Block Address Translation
+! [ARCH=ppc32] CONFIG_BAT (y/n)
+
 # PPC64 Compiler
 @ "cross" Cross-compiler
