shithub: riscv

Download patch

ref: a70b93a356662355214f5405edda066786f6dd03
parent: b4cb19235eb84f5e08539a10fcdd671a06494e94
author: cinap_lenrek <[email protected]>
date: Wed Aug 21 15:34:24 EDT 2019

/sys/lib/acid/kernel: fix procstk() for arm64, set kdir for arm/arm64 to bcm/bcm64

--- a/sys/lib/acid/kernel
+++ b/sys/lib/acid/kernel
@@ -248,11 +248,15 @@
 		print("\n");
 	}
 }
-
+BY2PG=4096;
 KSTACK=4096;
 if objtype=="amd64" then {
 	KSTACK=16*1024;
 }
+if objtype=="arm64" then {
+	BY2PG=65536;
+	KSTACK=8*1024;
+}
 
 defn procstksize(p) {
 	complex Proc p;
@@ -267,14 +271,12 @@
 
 defn procstk(p) {
 	complex Proc p;
-	local l;
 
 	if p.state != 0 then {	// 0 is Dead
-		l = p.sched;
 		if objtype=="386" || objtype=="amd64" then
-			_stk(gotolabel, *l, linkreg(0), 0);
+			_stk(gotolabel, p.sched.sp, linkreg(0), 0);
 		else
-			_stk(*(l+4), *l, linkreg(0), 0);
+			_stk(p.sched.pc, p.sched.sp, linkreg(0), 0);
 	}
 }
 
@@ -383,7 +385,6 @@
 }
 
 PTEMAPMEM = (1024*1024);
-BY2PG = 4096;
 PTEPERTAB = (PTEMAPMEM/BY2PG);
 defn up() {
 	if objtype == "386" then {
@@ -401,6 +402,13 @@
 		complex Proc proc;
 		return proc;
 	}
+	if objtype == "arm64" then {
+		local proc;
+
+		proc = *R26;
+		complex Proc proc;
+		return proc;
+	}
 	print("up() not implemented for", objtype, "\n");
 	return -1;
 }
@@ -442,6 +450,12 @@
 	}
 	if (objtype == "mips" || objtype == "mips2") then {
 		kdir = "ch";
+	}
+	if objtype == "arm" then {
+		kdir = "bcm";
+	}
+	if objtype == "arm64" then {
+		kdir = "bcm64";
 	}
 	needacid("proc");
 	needacid("chan");