public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] or1k: Fix critical handling in malloc locks
@ 2015-08-07 19:02 Jeff Johnston
0 siblings, 0 replies; only message in thread
From: Jeff Johnston @ 2015-08-07 19:02 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4098f69c4302664c4dc65812779a8849ccc323b6
commit 4098f69c4302664c4dc65812779a8849ccc323b6
Author: Jeff Johnston <jjohnstn@redhat.com>
Date: Fri Aug 7 14:49:16 2015 -0400
or1k: Fix critical handling in malloc locks
Only on first call to the recursive malloc lock the restore value of
exception enable fields is stored.
* libc/sys/or1k/mlock.c: Fix exception enable saving
Diff:
---
newlib/ChangeLog | 4 ++++
newlib/libc/sys/or1k/mlock.c | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 6500651..e887c9a 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,7 @@
+2015-08-07 Stefan Wallentowitz <stefan.wallentowitz@tum.de>
+
+ * libc/sys/or1k/mlock.c: Fix exception enable saving
+
2015-08-03 Shoichi Sakon <s-sakon@ap.jp.nec.com>
* libc/stdio/vfwscanf.c (__SVFWSCANF_R): Convert wrong usage of va_arg
diff --git a/newlib/libc/sys/or1k/mlock.c b/newlib/libc/sys/or1k/mlock.c
index a439da6..ccb8401 100644
--- a/newlib/libc/sys/or1k/mlock.c
+++ b/newlib/libc/sys/or1k/mlock.c
@@ -65,7 +65,9 @@ void __malloc_lock(struct _reent *ptr) {
}
// Store the TEE and IEE flags for later restore
- _or1k_malloc_lock_restore = restore;
+ if (_or1k_malloc_lock_cnt == 0) {
+ _or1k_malloc_lock_restore = restore;
+ }
// Increment counter. The lock may be accessed recursively
_or1k_malloc_lock_cnt++;
@@ -85,7 +87,7 @@ void __malloc_unlock(struct _reent *ptr) {
// unset lock
_or1k_malloc_lock = 0;
// Restore flags
- or1k_critical_end(_or1k_malloc_lock_restore);
+ or1k_critical_end(restore);
}
return;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-08-07 19:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 19:02 [newlib-cygwin] or1k: Fix critical handling in malloc locks Jeff Johnston
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).