Browse Source

riscv: print an error in timerset if delta is < 1 more than 256 times

Ronald G. Minnich 7 years ago
parent
commit
16e1f0a7d0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      sys/src/9/riscv/devarch.c

+ 5 - 1
sys/src/9/riscv/devarch.c

@@ -607,6 +607,9 @@ timerset(uint64_t x)
 	extern uint64_t *mtime;
 	uint64_t now;
 	int64_t delta;
+	// bust is the number of times that we are called
+	// with a delta < 0
+	static uint8_t bust;
 
 	now = rdtsc();
 	//print("now 0x%llx timerset to 0x%llx\n", now , x);
@@ -617,7 +620,8 @@ timerset(uint64_t x)
 	//print("delta is %llx\n", delta);
 	delta /= 200;
 	if (delta < 1) {
-		print("BUST!\n");
+		if (++bust == 0)
+			print("timerset: delta was < 1 256 times\n");
 		delta = 10 /* one microsecond */ * 1000 /* one millisecond */ ;
 	}
 	//print("adjest x to timer ticks, divide by 500 ... 0x%llx %llx %llx \n", *mtime , delta, *mtime + delta);