shithub: nix

Download patch

ref: 590d2b348f2c7d0f9aae4d8220e1f4196b76eb83
parent: e8f56cf888be366c443138afd33dfbe6c14d63a6
author: glenda <glenda@cirno>
date: Fri May 17 11:16:51 EDT 2024

getting it back to building.
The way this will work:
proc will create AC by ctl to /dev/nix
proc will access ac by ctl to /dev/nix
this requires that we bring in tcore.c again
we stop stressing about changing MACH and PROC,
we'll worry about that some time later.

--- a/sys/src/nix/pc64/acore.c
+++ b/sys/src/nix/pc64/acore.c
@@ -9,8 +9,6 @@
 #include	"ureg.h"
 #include	"pool.h"
 #include 	"mp.h"
-#include	"nix.h"
-
 /*
  * NIX code run at the AC.
  * This is the "AC kernel".
--- a/sys/src/nix/pc64/devnix.c
+++ b/sys/src/nix/pc64/devnix.c
@@ -12,7 +12,6 @@
 #include	"fns.h"
 #include	"../port/error.h"
 #include	"io.h"
-#include 	"nix.h"
 
 #define DBGREAD	0x01
 #define DBGWRIT	0x02
@@ -37,15 +36,14 @@
 typedef struct DEVNIX DEVNIX;
 
 struct DEVNIX {
-	int nixed;
-	NIX nix;
+	int _;
 } nixes[MAXMACH];
 
 int nnix = 0;
 static Segdesc *acidt;
 
-NIX *devnix() {
-	return &nixes[m->machno].nix;
+DEVNIX *devnix() {
+	return &nixes[m->machno];
 }
 
 void nixidt(uintptr *p)
@@ -76,7 +74,7 @@
 nixreset(void)
 {
 	Segdesc *idt;
-	DEVNIX *nix;
+	Mach *mp;
 	u32int d1, v;
 	uintptr vaddr;
 	extern char acidthandlers[];
@@ -115,9 +113,9 @@
 	}
 
 	for(nnix = 0; nnix < MAXMACH; nnix++){
-		nix = &nixes[nnix];
-		nix->nix.icc = mallocalign(64, 64, 0, 0);
-		print("nix %p %#p\n", nix, nix->nix.icc);
+		mp = machp[nnix];
+		mp->icc = mallocalign(64, 64, 0, 0);
+		print("nix %p %#p\n", mp, mp->icc);
 		}
 
 
@@ -212,7 +210,7 @@
 	int nf;
 	char *f[2];
 	void actouser(void);
-
+	//Mach *mp = machp[nnix];
 	nf = tokenize(p, f, nelem(f));	
 
 	/* A just attaches the AC but runs nothing on it.
@@ -219,7 +217,7 @@
 	 * It is useful for tests.
 	 */
 	if (strcmp(f[0], "a") == 0) {
-			void acsched(int i, NIX *);
+			void acsched(int i);
 		if (nf != 1)
 			error("a takes no arguments");
 
@@ -233,19 +231,19 @@
 		/* the next good part. We're by definition on
 		 * machno. So we can just take it.
 		 */
-		nixes[m->machno].nixed = 1;
-		nixes[m->machno].nix.icc->fn = nil;
+		m->nixtype = NIXAC;
+		m->icc->fn = nil;
 		print("NIX ME %d\n", m->machno);
 		/* acsched here */
-		acsched(1024, &nixes[m->machno].nix);
+		acsched(1024);
 		/* acsched returns and we're back. */
 		print("UN NIX ME %d\n", m->machno);
-		nixes[m->machno].nixed = 0;
+		m->nixtype = NIXTC;
 		return n;
 	}
 
 	if (strcmp(f[0], "run") == 0) {
-			void acsched(int i, NIX *);
+			void acsched(int i);
 		if (nf != 1)
 			error("run takes no arguments");
 
@@ -259,14 +257,14 @@
 		/* the next good part. We're by definition on
 		 * machno. So we can just take it.
 		 */
-		nixes[m->machno].nixed = 1;
-		nixes[m->machno].nix.icc->fn = actouser;
+		m->nixtype = NIXAC;
+		m->icc->fn = actouser;
 		print("NIX ME %d\n", m->machno);
 		/* acsched here */
-		acsched(1024, &nixes[m->machno].nix);
+		acsched(1024);
 		/* acsched returns and we're back. */
 		print("UN NIX ME %d\n", m->machno);
-		nixes[m->machno].nixed = 0;
+		m->nixtype = NIXTC;
 		return n;
 	
 	}
@@ -277,7 +275,7 @@
 		core = strtoull(f[1], 0, 0);
 		if (core > MAXMACH)
 			error("Core is > MAXMACH");
-		if (nixes[core].nixed == 0)
+		if (machp[core]->nixtype != NIXAC)
 			error("Core is not nixed");
 		print("I guess we run on it\n");
 		print("I guess we're back\n");
@@ -292,9 +290,9 @@
 		core = strtoull(f[1], 0, 0);
 		if (core > MAXMACH)
 			error("Core is > MAXMACH");
-		if (nixes[core].nixed == 0)
+		if (machp[core]->nixtype != NIXAC)
 			error("Core is not nixed");
-		testicc(core, &nixes[core].nix);
+		testicc(core, &machp[core]->NIX);
 		return n;
 	}
 
--- a/sys/src/nix/pc64/nix.h
+++ b/sys/src/nix/pc64/nix.h
@@ -8,6 +8,7 @@
 	int	vno;
 	char	name[KNAMELEN];		/* of driver */
 } ACVctl;
+#pragma incomplete Ureg
 
 struct NIX
 {