diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2015-08-07 21:49:16 +0300 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2015-08-07 22:01:58 +0300 |
commit | 4098f69c4302664c4dc65812779a8849ccc323b6 (patch) | |
tree | f4709441b36bb510f74fd93b8a06b525d632bd21 /newlib | |
parent | 0d04c03829f9b88b86c5a47b340731a4cb39fdcb (diff) |
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
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 4 | ||||
-rw-r--r-- | newlib/libc/sys/or1k/mlock.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 6500651f5..e887c9a6a 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 a439da603..ccb840161 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; |