summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-05-26score: Simplify calling _Thread_Exit()Sebastian Huber2-25/+2
Move common code into _Thread_Exit(). This enables a tail call optimization in most cases.
2021-05-26rtems: Return RTEMS_CALLED_FROM_ISRSebastian Huber1-5/+15
If rtems_task_delete() is called from within interrupt context, then return RTEMS_CALLED_FROM_ISR. This makes the behaviour predictable. Update #4414.
2021-05-14rtems: Fix task restart within interrupt contextSebastian Huber1-7/+1
rtems_task_restart() may be called from within interrupt context. So checking only that the thread to restart is equal to the executing thread is insufficient to determine a self restart. We have to also check that no ISR is in progress. Merge _Thread_Restart_other() and _Thread_Restart_self() into one _Thread_Restart() since they share a lot of common code. Close #4412.
2021-05-14score: Return status in _Thread_Restart_other()Sebastian Huber1-3/+4
This simplifies rtems_task_restart().
2021-05-14rtems: Check entry point in rtems_task_start()Sebastian Huber1-0/+4
Close #4410.
2021-05-14rtems: Add TOD_Ticks_validationSebastian Huber1-3/+5
Replace defines with an enum. Update #4406.
2021-05-12rtems: Constify rtems_task_wake_when()Sebastian Huber4-10/+7
Add a parameter to _TOD_Validate() to disable the validation of the ticks member. There are two reasons for this change. Firstly, in rtems_task_wake_when() was a double check for time_buffer == NULL (one in rtems_task_wake_when() and one in _TOD_Validate()). Secondly, the ticks member is ignored by rtems_task_wake_when(). This was done with a write of zero to the ticks member and thus a modification of the user-provided structure. Now the structure is no longer modified. Using a mask parameter is quite efficient. You just have to load an immediate value and there are no additional branches in _TOD_Validate(). Close #4406.
2021-05-12rtems: Use rtems_clock_get_ticks_per_second()Sebastian Huber1-2/+2
This avoids an integer division at runtime.
2021-05-12_TOD_Validate(): Fix incorrect return codeFrank Kühndel4-33/+44
This patch fixes bug #4403. Directives * rtems_timer_fire_when() * rtems_timer_server_fire_when() * rtems_task_wake_when() are documented to return RTEMS_INVALID_ADDRESS when their time-of-day argument is NULL. But actually they return RTEMS_INVALID_CLOCK. To fix the issue this patch changes _TOD_Validate() to return a status code instead of just true/false. Close #4403
2021-05-11rtems: Use _Objects_Free_nothing() for msg queuesSebastian Huber1-1/+6
Use _Objects_Free_nothing() for rtems_message_queue_construct() to avoid unreachable code in _CORE_message_queue_Close() in case only user-provided message buffers are used. Update #4007.
2021-05-11score: Rename _Stack_Free_nothing()Sebastian Huber1-1/+1
Rename _Stack_Free_nothing() in _Objects_Free_nothing() to make it reusable for the message queue buffers. Update #4007.
2021-05-06rtems: rtems_scheduler_get_processor_set() statusSebastian Huber1-1/+1
In case the processor set is not large enough to contain the processor set owned by the scheduler return RTEMS_INVALID_SIZE instead of RTEMS_INVALID_NUMBER. This is more in line with other directives since the issue is related to the size of an object. Close #4401.
2021-05-06rtems: rtems_scheduler_ident_by_processor_set()Sebastian Huber1-0/+4
Check for a NULL processor set pointer.
2021-05-04rtems: Use allocator mutex for timer serverSebastian Huber1-4/+2
The allocator mutex is recursive and already used for the task creation in rtems_timer_initiate_server(). Just use this mutex instead of the once mutex to serialize the initialization. This avoids a dependency on condition variables which are not used here.
2021-05-02score: Add _Thread_Dispatch_direct_no_return()Sebastian Huber1-1/+1
The __builtin_unreachable() cannot be used with current GCC versions to tell the compiler that a function does not return to the caller, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99151 Add a no return variant of _Thread_Dispatch_direct() to avoid generation of dead code.
2021-04-30Use alias for rtems_task_self() and pthread_self()Sebastian Huber1-28/+0
This may reduce the code size a bit.
2021-04-27Return status code for _Thread_Start()Sebastian Huber1-3/+4
This avoids having conditional statements to get the API-specific status code.
2021-04-27Return status code for _Scheduler_Set_affinity()Sebastian Huber1-3/+4
This avoids having conditional statements to get the API-specific status code.
2021-04-27Simplify get affinitiy directivesSebastian Huber1-3/+0
There is no need to disable thread dispatching to get the affinity of a task.
2021-04-27Return status code for _Scheduler_Get_affinity()Sebastian Huber1-3/+4
This avoids having conditional statements to get the API-specific status code.
2021-04-27rtems: Constify timer fire when directivesSebastian Huber2-2/+2
Close #4392.
2021-04-23rtems: Check for NULL config in task constructSebastian Huber1-0/+4
Since there are already excessive NULL pointer checks in the Classic API, do this also in rtems_task_construct(). Update #3959.
2021-04-23rtems: Check for NULL config in msgq constructSebastian Huber1-0/+4
Since there are already excessive NULL pointer checks in the Classic API, do this also in rtems_message_queue_construct(). Update #4007.
2021-04-21clock:_TOD_To_seconds(): Fix year 2514 overflowFrank Kühndel2-1/+2
This patch fixes issue #4338 by changing _TOD_Validate() to only accept years till 2105. This requires another patch to change the documentation of rtems_clock_set() and other affected API functions (indicating the end date is 2105 not 2514). I tried to support till year 2514 but it turned out that this needs changing the Timer Manager too. That in turn would mean to change _TOD_Seconds_since_epoch( void ) from 32 to 64 bit. Sebastian pointed out that a naive extension leads to trouble with 32 bit processors. He deemed a safe re-implementation too costly performance wise considering that year 2106 is far away and current binaries using RTEMS Classic API are unlikely to be in use by 2106. The constant TOD_SECONDS_AT_2100_03_01_00_00 in cpukit/rtems/src/clocktodtoseconds.c happens to be wrong by 1 hour. When setting the date 2100-Feb-28 23:59:59 and then reading the date again you will find yourself in 2100-Feb-27. Update #4338
2021-04-07score: Replace Objects_Name_or_id_lookup_errorsSebastian Huber4-36/+9
Replace Objects_Name_or_id_lookup_errors with new Status_Control codes. Get rid of the _Status_Object_name_errors_to_status lookup table.
2021-04-07score: Fix internal error status numberSebastian Huber1-0/+22
The value of STATUS_CLASSIC_INTERNAL_ERROR must be equal to RTEMS_INTERNAL_ERROR. Add static assertions to ensure that the status codes match.
2021-03-19rtems: Relax mode checks in rtems_signal_catch()Sebastian Huber1-2/+8
Check only for invalid modes if a valid handler is presented to rtems_signal_catch(). When NULL is used for the handler, ASR processing is disabled and the mode is not used. Update #4244.
2021-03-18rtems: Fix rtems_task_mode()Sebastian Huber1-16/+22
Do the ASR and preemption mode change only if requested by the mode mask. The bug was introduced by 508f868237225a75e566d9fd304206363cfe441d.
2021-03-16rtems: Improve semaphore create error checksSebastian Huber1-6/+4
Do not mix checks for different error indicators (RTEMS_NOT_DEFINED and RTEMS_INVALID_NUMBER). This simplifies the specification of rtems_semaphore_create().
2021-03-16rtems: Require RTEMS_PRIORITY for MrsP semaphoresSebastian Huber1-2/+2
MrsP semaphores are a generalization of the priority ceiling semaphores for SMP configurations. Priority ceiling semaphores are required to use the priority task wait queue discipline. Require this discipline also for MrsP semaphores. Close #4347.
2021-03-02rtems: Simplify rtems_signal_catch()Sebastian Huber1-1/+19
In uniprocessor configurations, we can simplify rtems_signal_catch(). Add a validation test for the SMP special case.
2021-03-02rtems: Simplify _Signal_Action_handler()Sebastian Huber1-8/+3
Use the invariant that an ASR is only processed if ASR processing is enabled.
2021-02-26score: Fix thread initializationSebastian Huber1-16/+7
Close the thread object if a thread create extension fails. Also call the delete extension to avoid resource leaks in early extensions if a late extension fails. Close #4270.
2021-02-24score: Simplify core barrierSebastian Huber1-14/+15
Use the number of threads which must arrive at the barrier to trip the automatic release also to indicate if the barrier is a manual release barrier.
2021-02-24score: Remove _Objects_Open()Sebastian Huber9-35/+16
Use the type safe _Objects_Open_u32() instead. Return the object identifier to enforce a common usage pattern.
2021-02-20rtems: Simplify rtems_task_mode()Sebastian Huber1-32/+25
Do the preemption and ASR processing changes in one rush and acquire the thread state lock only once.
2021-02-20rtems: Avoid potential recursion in ASR handlingSebastian Huber1-7/+91
Do the mode changes necessary for the ASR processing directly under protection of the thread state lock to avoid the recursive calls to thread dispatching done in rtems_task_mode(). Close #4244.
2021-02-20rtems: Add _Modes_Apply_timeslice_to_thread()Sebastian Huber1-8/+2
Update #4244.
2021-02-20rtems: New errors for rtems_signal_catch()Sebastian Huber2-10/+19
Ensure that no invalid modes are set during ASR processing. Update #4244.
2021-02-20rtems: Remove _Modes_Set_interrupt_level()Sebastian Huber1-5/+3
This call just obfuscated the call to _ISR_Set_level(). Update #4244.
2021-02-20rtems: Simplify signal handlingSebastian Huber3-32/+33
Remove superfluous ASR_Information::signals_posted. Move code out of trivial inline functions. Update #4244.
2021-02-20rtems: Move _Signal_Action_handler()Sebastian Huber2-54/+54
Move _Signal_Action_handler() and signal MP initialization to rtems_signal_send(). The goal is to make _Signal_Action_handler() a static function in a follow up patch. Update #4244.
2021-02-20rtems: Remove unused ASR_Information::nest_levelSebastian Huber1-2/+0
Update #4244.
2021-02-20score: Change thread action lockingSebastian Huber1-2/+4
Require that the corresponding lock is acquired before the action handler returns. This helps to avoid recursion in the signal processing. Update #4244.
2021-02-13cputkit/rtems: Remove warningChris Johns1-0/+1
2021-02-10libcsupport: Add sbrk greedy support to consume all sbrk memoryChris Johns1-2/+10
- Move the heap sbrk code into a separate routnine. - Update heap and workspace greedy allocators to use the common sbrk greedy support. Closes #3982
2021-02-03rtems: Avoid duplicated implemenationSebastian Huber1-2/+7
Use the rtems_clock_get_ticks_per_second() macro to implement the rtems_clock_get_ticks_per_second() function.
2021-02-03rtems: Rework object services APISebastian Huber8-98/+72
Add a "Constraints" paragraph to the documentation. Provide prototypes for programming language bindings. Use the macro implementation to implement the corresponding functions. Update #3993.
2021-02-01rtems: Mark value as usedSebastian Huber1-0/+1
This fix relates to a Coverity issue (UNUSED_VALUE).
2021-02-01score: Add _Thread_Get_objects_information()Sebastian Huber1-0/+8
We do not need all the checks if we have a valid indentifier to a thread class object. Using the new _Thread_Get_objects_information() instead of the inline function _Thread_Get_objects_information_by_id() avoids dead code since the identifier in a thread control is always valid and the return NULL path in _Thread_Get_objects_information_by_id() would be dead code. The _Thread_Get_objects_information_by_id() should be an inline function since it is used by _Thread_Get() and thus performance critical. Static analyzers which cannot derive that the identifier in a thread control is always valid, may find a potential NULL pointer access (or otherwise find dead code). The identifier in an object control is always valid, see _Objects_Initialize_information() and _Objects_Extend_information(). Move _RTEMS_tasks_Free() to the only source file which calls this function.