shithub: riscv

Download patch

ref: c03913c62ddb751d2992e8a3d70e945229ed8e15
parent: 8e11ff283f1e7c36b23e6e52c2ab0ca12a7713f9
author: aiju <[email protected]>
date: Fri Jul 13 14:09:42 EDT 2012

fixed multiboot booting

--- a/sys/src/9/pc/l.s
+++ b/sys/src/9/pc/l.s
@@ -46,11 +46,27 @@
 	LONG	$_startKADDR-KZERO(SB)		/* load_addr */
 	LONG	$edata-KZERO(SB)		/* load_end_addr */
 	LONG	$end-KZERO(SB)			/* bss_end_addr */
-	LONG	$_startKADDR-KZERO(SB)		/* entry_addr */
+	LONG	$_multibootentry-KZERO(SB)		/* entry_addr */
 	LONG	$0				/* mode_type */
 	LONG	$0				/* width */
 	LONG	$0				/* height */
 	LONG	$0				/* depth */
+
+TEXT _multibootentry(SB), $0
+	MOVL	$etext-KZERO(SB), SI
+	MOVL	SI, DI
+	ADDL	$0xfff, DI
+	ANDL	$~0xfff, DI
+	MOVL	$edata-KZERO(SB), CX
+	SUBL	DI, CX
+	ADDL	CX, SI
+	ADDL	CX, DI
+	STD
+	REP; MOVSB
+	CLD
+	MOVL	$_startPADDR(SB), AX
+	ANDL	$~KZERO, AX
+	JMP*	AX
 
 /*
  * In protected mode with paging turned off and segment registers setup