From 9bf74673f928788b0ea4addabf045b94844d40ff Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 31 Jul 2013 13:30:42 +0200 Subject: score: Use an ISR lock for TOD Two issues are addressed. 1. On single processor configurations the set/get of the now/uptime timestamps is now consistently protected by ISR disable/enable sequences. Previously nested interrupts could observe partially written values since 64-bit writes are not atomic on 32-bit architectures in general. This could lead to non-monotonic uptime timestamps. 2. The TOD now/uptime maintanence is now independent of the giant lock. This is the first step to remove the giant lock in _Thread_Dispatch(). --- cpukit/rtems/src/clockgetuptimeseconds.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cpukit/rtems/src/clockgetuptimeseconds.c') diff --git a/cpukit/rtems/src/clockgetuptimeseconds.c b/cpukit/rtems/src/clockgetuptimeseconds.c index c1dfbf3785..3b597acaa8 100644 --- a/cpukit/rtems/src/clockgetuptimeseconds.c +++ b/cpukit/rtems/src/clockgetuptimeseconds.c @@ -24,18 +24,18 @@ #endif #include -#include #include time_t rtems_clock_get_uptime_seconds( void ) { - Timestamp_Control snapshot_as_timestamp; - struct timespec snapshot_as_timespec; - ISR_Level level; + TOD_Control *tod = &_TOD; + Timestamp_Control snapshot_as_timestamp; + struct timespec snapshot_as_timespec; + ISR_Level level; - _ISR_Disable( level ); - snapshot_as_timestamp = _TOD.uptime; - _ISR_Enable( level ); + _TOD_Acquire( tod, level ); + snapshot_as_timestamp = tod->uptime; + _TOD_Release( tod, level ); _Timestamp_To_timespec( &snapshot_as_timestamp, &snapshot_as_timespec ); -- cgit v1.2.3