From 51a862e200766d563583b5e5085815fae4db770f Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka <gniibe@fsij.org> Date: Fri, 8 Nov 2013 12:37:55 +0900 Subject: Version 0.03 --- ChangeLog | 7 +++++++ NEWS | 10 ++++++++++ README | 2 +- chopstx.c | 6 ++++-- doc/chopstx.texi | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c94700b..19fea66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-08 Niibe Yutaka <gniibe@fsij.org> + + * Version 0.03. + * doc/chopstx.texi (VERSION): 0.03. + + * chopstx.c (preempt): Disable interrupt. + 2013-11-08 Niibe Yutaka <gniibe@fsij.org> * Version 0.02. diff --git a/NEWS b/NEWS index 108a745..3abce0c 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,15 @@ NEWS - Noteworthy changes +* Major changes in Chopstx 0.03 + + Released 2013-11-08, by NIIBE Yutaka + +** Bug fix of preemption +In the implementation of preemption, there was a bug which might cause +not to schedule proper thread. This is because the routine preepmt +itself might be interrupted. This is now fixed in 0.03. + + * Major changes in Chopstx 0.02 Released 2013-11-08, by NIIBE Yutaka diff --git a/README b/README index ea8aa5a..b97ef55 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ Chopstx - Threads and only Threads - Version 0.02 + Version 0.03 2013-11-08 Niibe Yutaka Flying Stone Technology diff --git a/chopstx.c b/chopstx.c index 231644c..a255097 100644 --- a/chopstx.c +++ b/chopstx.c @@ -431,7 +431,9 @@ preempt (void) { register struct chx_thread *tp asm ("r0"); - asm ("ldr r1, =running\n\t" + tp = (struct chx_thread *)CPU_EXCEPTION_PRIORITY_INHIBIT_SCHED; + asm ("msr BASEPRI, r0\n\t" + "ldr r1, =running\n\t" "ldr r0, [r1]\n\t" "cbnz r0, 0f\n\t" /* It's idle which was preempted. Discard saved registers on stack. */ @@ -449,7 +451,7 @@ preempt (void) "mrs r6, PSP\n\t" /* r13(=SP) in user space. */ "stm r1, {r2, r3, r4, r5, r6}" : "=r" (tp) - : /* no input */ + : "r" (tp) : "r1", "r2", "r3", "r4", "r5", "r6", "cc", "memory"); if (tp) diff --git a/doc/chopstx.texi b/doc/chopstx.texi index 0d8303e..e168c74 100644 --- a/doc/chopstx.texi +++ b/doc/chopstx.texi @@ -1,7 +1,7 @@ \input texinfo @c -*-texinfo-*- @c %**start of header @setfilename chopstx.info -@set VERSION 0.02 +@set VERSION 0.03 @settitle Chopstx Reference Manual @c Unify some of the indices. @syncodeindex tp fn -- cgit v1.2.3