From 01f8c12ee57230fca1581e1b5be91f3decba0488 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sat, 7 Dec 2019 11:48:36 +0100 Subject: rtems: Optimize semaphore control block Move variant, discipline, and global information to flags stored in a node pointer of active semaphores. Update #3833. --- cpukit/libmisc/monitor/mon-sema.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'cpukit/libmisc') diff --git a/cpukit/libmisc/monitor/mon-sema.c b/cpukit/libmisc/monitor/mon-sema.c index 87e784ea74..fabc3c952b 100644 --- a/cpukit/libmisc/monitor/mon-sema.c +++ b/cpukit/libmisc/monitor/mon-sema.c @@ -18,7 +18,8 @@ rtems_monitor_sema_canonical( const void *sema_void ) { - const Semaphore_Control *rtems_sema = (const Semaphore_Control *) sema_void; + const Semaphore_Control *rtems_sema; + uintptr_t flags; Thread_Control *owner; canonical_sema->attribute = 0; @@ -27,17 +28,20 @@ rtems_monitor_sema_canonical( canonical_sema->cur_count = 0; canonical_sema->holder_id = 0; + rtems_sema = (const Semaphore_Control *) sema_void; + flags = _Semaphore_Get_flags( rtems_sema ); + #if defined(RTEMS_MULTIPROCESSING) - if (rtems_sema->is_global) { + if ( _Semaphore_Is_global( flags ) ) { canonical_sema->attribute |= RTEMS_GLOBAL; } #endif - if (rtems_sema->discipline == SEMAPHORE_DISCIPLINE_PRIORITY) { + if ( _Semaphore_Get_discipline( flags ) == SEMAPHORE_DISCIPLINE_PRIORITY ) { canonical_sema->attribute |= RTEMS_PRIORITY; } - switch ( rtems_sema->variant ) { + switch ( _Semaphore_Get_variant( flags ) ) { case SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY: canonical_sema->attribute |= RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY; @@ -63,7 +67,7 @@ rtems_monitor_sema_canonical( break; } - switch ( rtems_sema->variant ) { + switch ( _Semaphore_Get_variant( flags ) ) { case SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING: canonical_sema->priority_ceiling = _Scheduler_Unmap_priority( _CORE_ceiling_mutex_Get_scheduler( &rtems_sema->Core_control.Mutex ), -- cgit v1.2.3