Commit Graph

1072 Commits

Author SHA1 Message Date
Sebastian Huber
df55d07f2e score: Untangle thread actions
Remove the thread action handler parameter from
_Thread_Action_initialize() and instead set it later in
_Thread_Add_post_switch_action().  This avoids a dependency on the
thread action handler via the thread initialization.
2015-12-11 08:20:48 +01:00
Sebastian Huber
d0c3983814 Use linker set for system initialization
Make rtems_initialize_data_structures(),
rtems_initialize_before_drivers() and rtems_initialize_device_drivers()
static.  Rename rtems_initialize_start_multitasking() to
rtems_initialize_executive() and call the registered system
initialization handlers in this function.  Add system initialization API
available via #include <rtems/sysinit.h>.  Update the documentation
accordingly.

This is no functional change, only the method to call the existing
initialization routines changes.  Instead of direct function calls a
table of function pointers contained in the new RTEMS system
initialization linker set is used.  This table looks like this (the
actual addresses depend on the target).

nm *.exe | grep _Linker | sort
0201a2d0 D _Linker_set__Sysinit_begin
0201a2d0 D _Linker_set__Sysinit_bsp_work_area_initialize
0201a2d4 D _Linker_set__Sysinit_bsp_start
0201a2d8 D _Linker_set__Sysinit_rtems_initialize_data_structures
0201a2dc D _Linker_set__Sysinit_bsp_libc_init
0201a2e0 D _Linker_set__Sysinit_rtems_initialize_before_drivers
0201a2e4 D _Linker_set__Sysinit_bsp_predriver_hook
0201a2e8 D _Linker_set__Sysinit_rtems_initialize_device_drivers
0201a2ec D _Linker_set__Sysinit_bsp_postdriver_hook
0201a2f0 D _Linker_set__Sysinit_end

Add test sptests/spsysinit01.

Update #2408.
2015-12-11 08:17:16 +01:00
Sebastian Huber
b618d8cfc5 Add RTEMS linker sets
Update #2408.
2015-12-08 09:25:22 +01:00
Sebastian Huber
9736283857 score: Statically initialize system state
Update #2408.
2015-12-08 08:43:41 +01:00
Sebastian Huber
bd91f446f2 score: Delete unused API extensions
Update #2408.
2015-12-08 08:38:10 +01:00
Sebastian Huber
60c5461547 score: Statically initialize API extensions
Update #2408.
2015-12-08 08:38:06 +01:00
Sebastian Huber
8054b1c718 Remove <rtems/debug.h>
Close #2477.
2015-12-07 13:11:07 +01:00
Sebastian Huber
ac5f2442e3 Require __getreent()
This function is used by Newlib since 2013-07-09 (Git commit
9b51cd8c6b9cdd067d9648a7ab952884019c56a5).
2015-11-25 08:33:31 +01:00
Sebastian Huber
bc792bb3bd basdefs.h: Add and use RTEMS_PACKED 2015-10-26 09:13:19 +01:00
Sebastian Huber
f97536dcd3 basdefs.h: Add and use RTEMS_UNUSED 2015-10-26 09:13:19 +01:00
Sebastian Huber
c52568dcdb basdefs.h: Add and use RTEMS_DEPRECATED 2015-10-26 09:13:19 +01:00
Sebastian Huber
a3ba5b3798 basdefs.h: Add RTEMS_PURE 2015-10-26 09:13:19 +01:00
Sebastian Huber
143696acbd basedefs.h: Add and use RTEMS_NO_RETURN 2015-10-26 09:13:19 +01:00
Sebastian Huber
2423857f38 basedefs.h: Add compiler attributes 2015-10-26 09:13:19 +01:00
Sebastian Huber
ba1ed5240b SMP: Optimize ticket lock implementation
This reverts the relevant part of commit
da06fe948c.  The acquire/release order is
superfluous for the next ticket increment.  The mutual exclusion is
guaranteed by the acquire load from and release store to the next
serving atomic variable.
2015-10-02 08:05:21 +02:00
Sebastian Huber
258ad71e96 SMP: Fix and optimize thread dispatching
According to the C11 and C++11 memory models only a read-modify-write
operation guarantees that we read the last value written in modification
order.  Avoid the sequential consistent thread fence and instead use the
inter-processor interrupt to set the thread dispatch necessary
indicator.
2015-09-28 13:56:57 +02:00
Sebastian Huber
aee6a1d05f SMP: Simplify thread lock operations 2015-09-28 07:45:54 +02:00
Sebastian Huber
8d296cd54e score: Use uintptr_t for atomic pointer operations
Do not obfuscate the standard API.
2015-09-26 21:23:53 +02:00
Sebastian Huber
1f7c5c88ca score: Fix atomic compare exchange 2015-09-25 21:48:24 +02:00
Sebastian Huber
dafa5d8843 score: Implement priority boosting 2015-09-04 13:26:17 +02:00
Sebastian Huber
3995e6d9c2 score: Implement SMP-specific priority queue 2015-09-04 13:25:03 +02:00
Sebastian Huber
c4db18a0bb score: Documentation 2015-09-04 13:14:54 +02:00
Sebastian Huber
edf640f8cf rbtree: Add _RBTree_Replace_node() 2015-09-03 13:58:24 +02:00
Sebastian Huber
e9fbaa3b48 rbtree: Replace implementation
Use the BSD <sys/tree.h> implementation since it is faster, more
flexible and uses less storage.  See https://github.com/sebhub/rb-bench.
2015-09-03 13:58:16 +02:00
Sebastian Huber
509e8d7f4d rbtree: Delete rtems_rbtree_find_control()
This function is hard to support in alternative implementations.  It has
no internal use case.
2015-09-01 09:07:08 +02:00
Sebastian Huber
f71e67dc56 rbtree: Delete unused RBTREE_NODE_*() macros 2015-08-31 09:59:42 +02:00
Sebastian Huber
ddb6a49bdf rbtree: Delete _RBTree_Initialize()
This function has no internal use case.
2015-08-31 09:59:42 +02:00
Sebastian Huber
b9877ee03d rbtree: Delete _RBTree_Get()
This function has no internal use case.
2015-08-31 09:59:42 +02:00
Sebastian Huber
2d48456ef5 rbheap: Drop direction from _RBTree_Iterate() 2015-08-31 09:59:42 +02:00
Sebastian Huber
3f49446e54 rbtree: Delete _RBTree_Is_first() 2015-08-31 09:59:41 +02:00
Sebastian Huber
341f629614 rbtree: Add _RBTree_Minimum(), _RBTree_Maximum() 2015-08-31 09:59:41 +02:00
Sebastian Huber
9e9e61d27d score: Add self-contained condition implementation 2015-07-30 09:11:18 +02:00
Sebastian Huber
40188718f2 score: Add self-contained futex implementation 2015-07-30 09:11:18 +02:00
Sebastian Huber
7237b3e076 score: Add self-contained semaphore implementation 2015-07-30 09:11:18 +02:00
Sebastian Huber
214d8edd18 score: Add self-contained mutex implementation
This mutex implementation uses a thread priority queue with a simple
priority inheritance mechanism (similar to the object based mutexes).
The storage space must be supplied by the user (16 bytes on 32-bit
targets).
2015-07-30 09:11:18 +02:00
Sebastian Huber
12f93fbb13 score: Add thread queue for self-contained objects 2015-07-30 09:11:17 +02:00
Sebastian Huber
0e3c59d65c score: Use a plain ticket lock for thread locks
This enables external libraries to use thread locks since they are
independent of the actual RTEMS build configuration, e.g. profiling
enabled or disabled.
2015-07-30 09:11:13 +02:00
Sebastian Huber
10e32a2634 score: Add potpourri lock statistics
These SMP lock statistics are used for all lock objects that lack a
storage space for the statistics.  Examples are lock objects used in
external libraries which are independent of the actual RTEMS build
configuration.
2015-07-30 08:06:01 +02:00
Sebastian Huber
e421936bbb score: Provide struct _Thread_queue_Heads
Use a leading underscore in the structure name to allow forward
declarations in standard header files provided by Newlib and GCC.
2015-07-30 08:06:01 +02:00
Sebastian Huber
48274706a7 score: Rename struct Thread_Control
Add a leading underscore to the structure name to allow forward
declarations in standard header files provided by Newlib and GCC.
2015-07-30 08:06:00 +02:00
Sebastian Huber
21789a2117 score: Rename _POSIX_Absolute_timeout_to_ticks()
Rename _POSIX_Absolute_timeout_to_ticks() to
_TOD_Absolute_timeout_to_ticks() and move it to the score directory.
Delete empty <rtems/posix/time.h>.
2015-07-28 14:54:51 +02:00
Sebastian Huber
9c53910190 score: Add comment 2015-07-24 09:13:31 +02:00
Sebastian Huber
e709aa8522 score: Move wait flag update to tq extract
This makes it possible to use _Thread_queue_Extract_locked() for barrier
operations which extract all threads on the queue in one critical
section.
2015-07-23 08:01:14 +02:00
Sebastian Huber
d7665823b2 score: Introduce Thread_queue_Heads
Move the storage for the thread queue heads to the threads.  Each thread
provides a set of thread queue heads allocated from a dedicated memory
pool.  In case a thread blocks on a queue, then it lends its heads to
the queue.  In case the thread unblocks, then it takes a free set of
threads from the queue.  Since a thread can block on at most one queue
this works.  This mechanism is used in FreeBSD.  The motivation for this
change is to reduce the memory demands of the synchronization objects.
On a 32-bit uni-processor configuration the Thread_queue_Control size is
now 8 bytes, compared to 64 bytes in RTEMS 4.10 (other changes reduced
the size as well).
2015-07-23 08:01:13 +02:00
Sebastian Huber
e273501233 score: Introduce Thread_queue_Queue
Separate the thread queue heads and lock from the operations.  This
enables the support for light weight objects which only support one
queuing discipline.
2015-07-23 08:00:19 +02:00
Sebastian Huber
f5d4570fe6 score: Simplify _Thread_Lock_set()
Exploit the fact that the current thread lock must be the default thread
lock and interrupts are disabled if we call _Thread_Lock_set().
2015-07-13 08:56:57 +02:00
Sebastian Huber
9341773152 score: Typo 2015-07-13 08:56:57 +02:00
Sebastian Huber
372bee84a1 score: Simplify _SMP_ticket_lock_Release()
Add a SMP lock statistics pointer to SMP_lock_Stats_context and drop the
SMP lock statistics parameter from _SMP_ticket_lock_Release().
2015-07-01 08:28:01 +02:00
Sebastian Huber
f59f2fe93e score: Accept NULL pointer in _Freechain_Put()
With this a _Freechain_Put( _Freechain_Get() ) works always.
2015-07-01 08:24:45 +02:00
Sebastian Huber
fdb45d6b26 score: Freechain handler API changes
Replace the extend function with an allocator since this fits better
to the current use case.
2015-07-01 08:24:31 +02:00