shithub: nix

Download patch

ref: 17302b4cd15fd302b4875d1075e20a6954ca8c48
parent: beacaa8db0edc753cf5231d2fd6532b6cc27749a
author: glenda <glenda@cirno>
date: Sun May 5 13:46:41 EDT 2024

Building. Not tested.

--- a/sys/src/nix/pc64/acore.c
+++ b/sys/src/nix/pc64/acore.c
@@ -100,7 +100,7 @@
 //	DBG("acmmuswitch mpl4 %#p mach0pml4 %#p m0pml4 %#p\n", m->pml4->pa, mach0pml4.pa, sys->machptr[0]->pml4->pa);
 
 
-panic("	cr3put(m->pml4->pa);");
+	putcr3(PADDR(m->pml4));
 }
 
 /*
--- a/sys/src/nix/pc64/tcore.c
+++ b/sys/src/nix/pc64/tcore.c
@@ -232,7 +232,7 @@
 	if(up->procctl == Proc_tracesyscall){	/* Would this work? */
 		up->procctl = Proc_stopme;
 		s = splhi();
-		procctl(up);
+		uprocctl(up);
 		splx(s);
 	}
 
@@ -273,12 +273,15 @@
 	int rc, flush, s;
 	char *n;
 	uvlong t1;
+	void	actouser(void);
+	void syscall(Ureg*);
+	extern char **rolename;
 
 	if(waserror())
 		panic("runacore: error: %s\n", up->errstr);
 	ureg = up->dbgreg;
 	fakeretfromsyscall(ureg);
-	fpusysrfork(ureg);
+//	panic("fpusysrfork(ureg);\n");
 
 	procpriority(up, PriKproc, 1);
 	rc = runac(up->ac, actouser, 1, nil, 0);
@@ -294,7 +297,7 @@
 			DBG("runacore: trap %ulld cr2 %#ullx ureg %#p\n",
 				ureg->type, m->cr2, ureg);
 			switch(ureg->type){
-			case IdtIPI:
+			case 62: //IdtIPI:
 				if(up->procctl || up->nnote)
 					notify(up->dbgreg);
 				if(up->ac == nil)
@@ -301,9 +304,9 @@
 					goto ToTC;
 				kexit(up->dbgreg);
 				break;
-			case IdtNM:
-			case IdtMF:
-			case IdtXF:
+			case VectorNMI:
+			case VectorCERR:
+			case VectorSIMD:
 				/* these are handled in the AC;
 				 * If we get here, they left in m->icc->data
 				 * a note to be posted to the process.
@@ -312,18 +315,18 @@
 				n = up->ac->icc->note;
 				if(n != nil)
 					postnote(up, 1, n, NDebug);
-				ureg->type = IdtIPI;		/* NOP */
+				ureg->type =  62; //IdtIPI:;		/* NOP */
 				break;
 			default:
-				cr3put(m->pml4->pa);
-				if(0 && ureg->type == IdtPF){
+				putcr3(PADDR(m->pml4));
+				if(0 && ureg->type == VectorPF){
 					print("before PF:\n");
 					print("AC:\n");
-					dumpptepg(4, up->ac->pml4->pa);
-					print("\n%s:\n", rolename[NIXTC]);
-					dumpptepg(4, m->pml4->pa);
+			//		dumpptepg(4, up->ac->pml4);
+			/*		print("\n%s:\n", rolename[NIXTC]);
+					dumpptepg(4, m->pml4);*/
 				}
-				trap(ureg);
+				panic("	trap(ureg);");
 			}
 			splx(s);
 			flush = 1;
@@ -332,13 +335,10 @@
 		case ICCSYSCALL:
 			DBG("runacore: syscall ax %#ullx ureg %#p\n",
 				ureg->ax, ureg);
-			cr3put(m->pml4->pa);
-			syscall(ureg->ax, ureg);
+			putcr3(PADDR(m->pml4));
+			syscall(ureg);
 			flush = 1;
 			fn = acsysret;
-			if(0)
-			if(up->nqtrap > 2 || up->nsyscall > 1)
-				goto ToTC;
 			if(up->ac == nil)
 				goto ToTC;
 			break;
--- a/sys/src/nix/port/portdat.h
+++ b/sys/src/nix/port/portdat.h
@@ -794,6 +794,8 @@
 	uvlong nactrap;
 	uvlong actime;
 	uvlong actime1;
+	uvlong nicc;
+	uvlong tctime;
 	Mach *ac;
 };