From 2aab8110c00e31a278a6294b72054c7abb4aae74 Mon Sep 17 00:00:00 2001
From: Roberto Hexsel <roberto@inf.ufpr.br>
Date: Thu, 23 Jun 2016 11:24:36 -0300
Subject: [PATCH] stopCount missing in handlers.s

---
 cMIPS/include/handlers.s | 18 ++++++++++++++++++
 cMIPS/tests/count.c      |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/cMIPS/include/handlers.s b/cMIPS/include/handlers.s
index 38789a9..e02fef5 100644
--- a/cMIPS/include/handlers.s
+++ b/cMIPS/include/handlers.s
@@ -178,6 +178,24 @@ startCount:
 	#----------------------------------------------------------------
 
 
+	#================================================================
+	# stopCount disables the COUNT register, returns new CAUSE
+	#   CAUSE.dc <= 1 to disable counting
+	#----------------------------------------------------------------
+	.text
+	.set    noreorder
+	.global stopCount
+	.ent    stopCount
+stopCount:
+	mfc0 $v0, c0_cause
+	lui  $v1, 0x0800
+        or   $v0, $v0, $v1
+	jr   $ra
+	mtc0 $v0, c0_cause
+	.end    stopCount
+	#----------------------------------------------------------------
+
+
 	#================================================================
 	# readCount returns the value of the COUNT register
 	#----------------------------------------------------------------
diff --git a/cMIPS/tests/count.c b/cMIPS/tests/count.c
index 0b1ef6e..464c000 100644
--- a/cMIPS/tests/count.c
+++ b/cMIPS/tests/count.c
@@ -1,7 +1,7 @@
 //-------------------------------------------------------------------------
 // test if COUNT register counts up monotonically
 // returns error if the time to compute every 11th element of the Fibonacci
-//    sequence, as measured by COUNT is not monotonically increasing
+//    sequence, as measured by COUNT, is not monotonically increasing
 //-------------------------------------------------------------------------
 
 #include "cMIPS.h"
-- 
GitLab