shithub: riscv

Download patch

ref: 8caec8564d6221146e055937b6ae344a647c7c82
parent: 80658d6ccf522200c286f02e947f3c9d2afe7ea9
author: cinap_lenrek <[email protected]>
date: Sun Mar 22 13:49:28 EDT 2015

vl, libmach, kernel: mips has 16K alignment for segments (for bigpages)

--- a/sys/src/9/port/sysproc.c
+++ b/sys/src/9/port/sysproc.c
@@ -284,9 +284,14 @@
 		text = l2be(exec.text);
 		entry = l2be(exec.entry);
 		if(n==sizeof(Exec) && (magic == AOUT_MAGIC)){
-			if(magic == S_MAGIC){
+			switch(magic){
+			case S_MAGIC:
 				text += 8;
 				align = 0x200000ull;	/* 2MB segment alignment for amd64 */
+				break;
+			case V_MAGIC:
+				align = 0x4000ull;	/* MIPS has 16K page alignment */
+				break;
 			}
 			if(text >= (USTKTOP-USTKSIZE)-(UTZERO+sizeof(Exec))
 			|| entry < UTZERO+sizeof(Exec)
--- a/sys/src/cmd/vl/obj.c
+++ b/sys/src/cmd/vl/obj.c
@@ -14,7 +14,7 @@
 /*
  *	-H0 -T0x40004C -D0x10000000	is abbrev unix
  *	-H1 -T0x80020000 -R4		is bootp() format for 3k
- *	-H2 -T4128 -R4096		is plan9 format
+ *	-H2 -T0x4020 -R0x4000		is plan9 format
  *	-H3 -T0x80020000 -R8		is bootp() format for 4k
  *	-H4 -T0x400000 -R4		is sgi unix coff executable
  *	-H5 -T0x4000A0 -R4		is sgi unix elf executable
@@ -124,12 +124,12 @@
 		break;
 	case 2:	/* plan 9 */
 		HEADR = 32L;
-		if(INITTEXT == -1)
-			INITTEXT = 4128;
 		if(INITDAT == -1)
 			INITDAT = 0;
 		if(INITRND == -1)
-			INITRND = 4096;
+			INITRND = 16*1024;
+		if(INITTEXT == -1)
+			INITTEXT = INITRND+HEADR;
 		break;
 	case 3:	/* boot for 4k */
 		HEADR = 20L+56L+3*40L;
--- a/sys/src/libmach/v.c
+++ b/sys/src/libmach/v.c
@@ -109,9 +109,9 @@
 	"R31",		/* name of link register */
 	"setR30",	/* static base register name */
 	0,		/* value */
-	0x1000,		/* page size */
-	0xC0000000ULL,	/* kernel base */
-	0x40000000ULL,	/* kernel text mask */
+	16*1024,	/* page size */
+	0x80000000ULL,	/* kernel base */
+	0x80000000ULL,	/* kernel text mask */
 	0x7FFFFFFFULL,	/* user stack top */
 	4,		/* quantization of pc */
 	4,		/* szaddr */