code: 9ferno

Download patch

ref: 07efa53a2516709225c49819bd45d7d7bc3b4f70
parent: c7019579acf8abbe181d3b97d03caf4c7e537c50
author: joe9 <>
date: Wed Aug 4 06:49:06 EDT 2021

allow the use of wakeup() in interrupts

inferno native driver processes waiting on an interrupt use
busy sleep unlike 9front drivers. The 9front drivers wakeup()
any processes waiting on the interrupt completion.

The wakeup() uses lock()/unlock(). unlock() calls sched()
to kick off other Ready processes. But, this cannot be done
in an interrupt handler. The interrupt needs to complete first.
Hence, the islo() check to ensure that we are not in an interrupt

--- a/os/port/taslock.c
+++ b/os/port/taslock.c
@@ -108,7 +108,11 @@
 	l->pc = 0;
 	l->key = 0;
-	if(up){
+	if(up && islo()){
+		/*
+		 * Call sched if the need arose while locks were held
+		 * But, don't do it from interrupt routines, hence the islo() test
+		 */
 		up->pri = p;
 		if(up->state == Running && anyhigher())