shithub: riscv

Download patch

ref: 72aa2827920722b1c9b45a1376ae19beeee22ef8
parent: c2ec061689ec8825c9af36944738f951858d5e70
author: cinap_lenrek <[email protected]>
date: Wed Jan 17 14:54:07 EST 2024

pc64: no need to CLI in noteret() and forkret()

Interrupts are disabled when returning from
trap() or when gotolabel()'ing to forkret().

--- a/sys/src/9/pc64/l.s
+++ b/sys/src/9/pc64/l.s
@@ -141,7 +141,7 @@
 	MOVL	DX, PDPO(KZERO+GiB)(AX)
 
 	ADDL	$PTSZ, AX			/* PD0 at PML4 + 2*PTSZ */
-	MOVL	$(PTESIZE|PTEGLOBAL|PTEWRITE|PTEVALID), DX
+	MOVL	$(PTEACCESSED|PTEDIRTY|PTESIZE|PTEGLOBAL|PTEWRITE|PTEVALID), DX
 	MOVL	DX, PDO(0)(AX)			/* PDE for double-map */
 
 	/*
@@ -942,7 +942,6 @@
 	CALL	syscall(SB)
 
 TEXT forkret(SB), 1, $-4
-	CLI
 	SWAPGS
 
 	MOVQ	8(SP), AX			/* return value */
@@ -1001,7 +1000,7 @@
 	PUSHQ	SP
 	CALL	trap(SB)
 
-TEXT _intrr(SB), 1, $-4
+TEXT noteret(SB), 1, $-4
 _intrestore:
 	POPQ	AX
 
@@ -1030,10 +1029,6 @@
 _iretnested:
 	ADDQ	$40, SP
 	IRETQ
-
-TEXT noteret(SB), 1, $-4
-	CLI
-	JMP	_intrestore
 
 TEXT vectortable(SB), $0
 	CALL _strayintr(SB); BYTE $0x00		/* divide error */
--- a/sys/src/9/pc64/trap.c
+++ b/sys/src/9/pc64/trap.c
@@ -349,14 +349,11 @@
 static void
 debugbpt(Ureg* ureg, void*)
 {
-	char buf[ERRMAX];
-
 	if(up == 0)
 		panic("kernel bpt");
 	/* restore pc to instruction that caused the trap */
 	ureg->pc--;
-	snprint(buf, sizeof(buf), "sys: breakpoint");
-	postnote(up, 1, buf, NDebug);
+	postnote(up, 1, "sys: breakpoint", NDebug);
 }
 
 static void
@@ -478,9 +475,7 @@
 			splx(s);
 			startns = todget(nil);
 		}
-		if(scallnr >= nsyscall || systab[scallnr] == 0){
-			pprint("bad sys call number %lud pc %#p\n",
-				scallnr, ureg->pc);
+		if(scallnr >= nsyscall || systab[scallnr] == nil){
 			postnote(up, 1, "sys: bad sys call", NDebug);
 			error(Ebadarg);
 		}