Commit Graph

30713 Commits

Author SHA1 Message Date
Sebastian Huber
b3cb2c12d7 score: Fix debug thread queue context init
On ARM Thumb we may have function addresses ending with 0x7f, if we are
lucky.
2016-12-02 12:39:37 +01:00
Sebastian Huber
aadd318cd9 posix: Fix fall back spinlock implementation
Update #2674.
2016-12-02 09:56:40 +01:00
Chris Johns
e629076003 libdebugger: Build for ARM's without a CP15. 2016-12-02 15:39:56 +11:00
Joel Sherrill
de7b174e38 Remove sparc/sis BSP.
closes #2810.
2016-11-29 09:29:03 -06:00
Chris Johns
a0d4e9933c cpukit: Add libdebugger, a remote debugger agent for GDB. 2016-11-29 08:50:40 +11:00
Chris Johns
8fd465e67e arm/zynq: Wait for the UART TX FIFO to empty on reset. 2016-11-29 08:50:40 +11:00
Sebastian Huber
6a1b9e4152 sparc: Optimize _ISR_Handler()
Use _Thread_Do_dispatch() instead of _Thread_Dispatch().  Restore the
PSR[EF] state of the interrupted context via new system call
syscall_irqdis_fp in case floating-point support is enabled.
2016-11-28 16:08:43 +01:00
Sebastian Huber
c09db57f37 score: Fix thread queue context initialization
Initialize the thread queue context with invalid data in debug
configurations to catch missing set up steps.
2016-11-28 16:08:43 +01:00
Martin Erik Werner
9bf9068bb8 or1k: Avoid multiple iterations over cache
Previously, if the cache range operations were called with a range that
was larger than the cache size, this would lead to multiple iterations
over the cache, which is unnecessary.

Limit this so that if the range is larger than the cache size, the
operations will only iterate over the whole cache once.
2016-11-28 07:30:44 +01:00
Martin Erik Werner
a59dd5cc6f or1k: Remove secondary functions in cache manager
Move the code of the _CPU_OR1K_Cache_{enable,disable}_* functions into the
equivalent exported _CPU_cache_{enable,disable}_* functions instead, and
then delete them, in order to reduce the code indirection and aid
readability.

This does not touch the currently unused prefetch, writeback, and lock
functions.
2016-11-28 07:30:44 +01:00
Martin Erik Werner
3b4ddafe99 or1k: Avoid excessive ISR toggle in cache manager
Previously _ISR_Local_{disable,enable}() was executed twice for each
cache line operation, and since operations over the entire cache were
implemented by calling the single-line operations in a loop, this made
those operations rather costly.

Fix the double-toggle by calling _OR1K_mtspr() directly, and removing
the now-unused corresponding _CPU_OR1K_Cache_* functions.

Fix the entire-operations by moving the ISR toggle outside of the
loop, and by calling _OR1K_mtspr() directly instead of the single-line
operations.

Also implement range functions, since otherwise the cache manager falls
back on looping over the single-line operations.
2016-11-28 07:30:44 +01:00
Martin Erik Werner
4dcaa48e4a or1k: Indent & comment fix in cache.c
* Fix indentation of variable declarations.

* Change commented-out asm -> __asm__ to meet c99 standard if
  uncommented.
2016-11-28 07:30:44 +01:00
Martin Erik Werner
e639c026b9 or1k: Add functions for entire cache operations
Add functions for flushing and invalidating whole cache.

Since we don't have system calls that can operate on anything more than
a single cache line, these simply retrieves the cache size and iterates
over the full size, invalidating each line.

The current implementation assumes that there's only one level of cache.

These changes were contributed by Antmicro under contract by ÅAC
Microtec AB.

Close #2602
2016-11-28 07:30:44 +01:00
Sebastian Huber
0a9b6eb056 libblock: Fix for RTEMS_DEBUG 2016-11-24 12:04:15 +01:00
Sebastian Huber
562b0a014a bsps/arm: Add Cortex-M DWT CPU counter 2016-11-24 11:54:28 +01:00
Sebastian Huber
bd0d585807 arm: Fix _CPU_ISR_Is_enabled() for ARMv7-M
Update #2811.
2016-11-24 11:53:59 +01:00
Sebastian Huber
620b23ece5 score: Optimize _Thread_queue_Enqueue()
Move thread state for _Thread_queue_Enqueue() to the thread queue
context.  This reduces the parameter count of _Thread_queue_Enqueue()
from five to four (ARM for example has only four function parameter
registers).  Since the thread state is used after several function calls
inside _Thread_queue_Enqueue() this parameter was saved on the stack
previously.
2016-11-24 08:46:20 +01:00
Sebastian Huber
4b5ff47d15 score: Fix interrupt profiling
Callers of _Thread_Do_dispatch() must have a valid
Per_CPU_Control::Stats::thread_dispatch_disabled_instant.

Call _Profiling_Outer_most_interrupt_entry_and_exit() with the interrupt
stack to not exceed Per_CPU_Control::Interrupt_frame.

Update #2751.
2016-11-24 08:46:20 +01:00
Sebastian Huber
01ac1db824 powerpc: Fix interrupt profiling for e6500 2016-11-24 08:46:20 +01:00
Sebastian Huber
d42cf3388e posix: Fix typo
Update #2674.
2016-11-23 15:12:28 +01:00
Sebastian Huber
f6edd88079 score: Explicitly define the fatal source numbers
Update #2825.
2016-11-23 13:44:46 +01:00
Sebastian Huber
73f9c2c27b smptests/smpfatal03: Use timer to provoke error
Avoid use of internal _Thread_Dispatch_disable() function.

Update #2825.
2016-11-23 13:44:22 +01:00
Sebastian Huber
bee0323279 score: Uncomment unused internal error codes
Update #2825.
2016-11-23 12:52:07 +01:00
Sebastian Huber
c42be504c9 posix: Add self-contained pthread spinlock
Turn pthread_spinlock_t into a self-contained object.  On uni-processor
configurations, interrupts are disabled in the lock/trylock operations
and the previous interrupt status is restored in the corresponding
unlock operations.  On SMP configurations, a ticket lock is a acquired
and released in addition.

The self-contained pthread_spinlock_t object is defined by Newlib in
<sys/_pthreadtypes.h>.

typedef struct {
  struct _Ticket_lock_Control _lock;
  __uint32_t                  _interrupt_state;
} pthread_spinlock_t;

This implementation is simple and efficient.  However, this test case of
the Linux Test Project would fail due to call of printf() and sleep()
during spin lock ownership:

https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-2.c

There is only limited support for profiling on SMP configurations.

Delete CORE spinlock implementation.

Update #2674.
2016-11-23 12:52:06 +01:00
Sebastian Huber
520e07db86 score: Add RTEMS_ALIAS() 2016-11-23 12:52:06 +01:00
Sebastian Huber
a4217c674d score: Rename _Thread_queue_Enqueue_critical()
Delete unused _Thread_queue_Enqueue() and rename
_Thread_queue_Enqueue_critical() to _Thread_queue_Enqueue().
2016-11-23 12:52:06 +01:00
Sebastian Huber
125f248231 score: Add thread queue enqueue callout
Replace the expected thread dispatch disable level with a thread queue
enqueue callout.  This enables the use of _Thread_Dispatch_direct() in
the thread queue enqueue procedure.  This avoids impossible exection
paths, e.g. Per_CPU_Control::dispatch_necessary is always true.
2016-11-23 12:52:06 +01:00
Sebastian Huber
84e6f15c82 score: Robust thread dispatch
On SMP configurations, it is a fatal error to call blocking operating
system with interrupts disabled, since this prevents delivery of
inter-processor interrupts. This could lead to executing threads which
are not allowed to execute resulting in undefined behaviour.

The ARM Cortex-M port has a similar problem, since the interrupt state
is not a part of the thread context.

Update #2811.
2016-11-23 12:52:06 +01:00
Sebastian Huber
a6283671f3 smptests/smplock01: Test TAS and TTAS locks
Cache align locks in the context.
2016-11-23 12:52:05 +01:00
Sebastian Huber
46b534388f libtests/cpuuse: Check status only
We may own the allocator mutex during context switches.
2016-11-23 12:52:05 +01:00
Sebastian Huber
db20706d5a smptests/smpscheduler02: Fix task initialization
Set scheduler before the task start.
2016-11-23 12:52:05 +01:00
Sebastian Huber
ec17ad4c24 score: Delete obsolete scheduler debug aid 2016-11-23 12:52:05 +01:00
Sebastian Huber
1d18a9027d arm: Fix _ARMV4_Exception_interrupt
Use the right register to determine if a thread dispatch is allowed and
necessary.

Update #2751.
2016-11-23 12:52:05 +01:00
Sebastian Huber
8954368f49 psxtests/psxkey08: Avoid rtems_semaphore_flush()
Avoid rtems_semaphore_flush() to reduce the maximum thread dispatch
disabled time of this test.  Remove superfluous yield and malloc().
Ensure that no resource leak occurs.
2016-11-23 11:54:29 +01:00
Sebastian Huber
a550b3f35a score: Force Per_CPU_Control::executing alignment
This fixes the CPU ports with relaxed alignment restrictions, e.g. type
alignment is less than the type size.

Close #2822.
Close #2823.
2016-11-23 07:52:42 +01:00
Sebastian Huber
3142727602 bsp/lpc23xx_tli800: Disable tar01 test
Close #2824.
2016-11-23 07:47:00 +01:00
Sebastian Huber
4e2bc0a308 arm: Fix Thumb-1 targets
We cannot use the MRS or MSR instructions in Thumb-1 mode.  Stay in ARM
mode for the Thumb-1 targets during interrupt low-level processing.

Update #2751.
2016-11-21 13:15:35 +01:00
Sebastian Huber
f730c25b70 powerpc/mpc5xx: Rename CPU_Interrupt_frame
The MPC5XX support uses a legacy interrupt/exception infrastructure.

Close #2819.
2016-11-21 11:19:37 +01:00
Sebastian Huber
ccc92b81c9 score: Group Per_CPU_Control members by alignment
Close #2820.
2016-11-21 10:26:32 +01:00
Sebastian Huber
27eccdad87 sparc64: Fix _CPU_ISR_Is_enabled()
Update #2820.
2016-11-21 10:25:58 +01:00
Sebastian Huber
fd6d3f1f03 nios2: Fix _CPU_ISR_Is_enabled()
Close #2818.
2016-11-21 10:13:37 +01:00
Sebastian Huber
9f225dea19 arm: Fix ARM_CONTEXT_CONTROL_ISR_DISPATCH_DISABLE
Close #2816.
2016-11-21 10:11:18 +01:00
Sebastian Huber
c6f446bd70 bfin: ASM compatibility for <rtems/score/cpu.h>
Close #2817.
2016-11-21 10:06:36 +01:00
Sebastian Huber
142628edcd score: Optimize self-contained objects
Avoid use of the stack for the hot paths.
2016-11-18 07:30:36 +01:00
Sebastian Huber
1b87f27cac score: Constify _MRSP_Get_owner() 2016-11-18 07:30:35 +01:00
Sebastian Huber
408609f6b9 score: Add _ISR_Is_enabled()
In contrast to _ISR_Get_level() the _ISR_Is_enabled() function evaluates
a level parameter and returns a boolean value.

Update #2811.
2016-11-18 07:30:35 +01:00
Sebastian Huber
537f00ebe8 score: Restrict task interrupt level to 0 on SMP
Update #2811.
2016-11-18 07:30:35 +01:00
Sebastian Huber
7ce60b378d powerpc: Use Per_CPU_Control::isr_dispatch_disable
Update #2751.
2016-11-18 07:30:35 +01:00
Sebastian Huber
d59585db26 arm: Use Per_CPU_Control::isr_dispatch_disable
Update #2751.
2016-11-18 07:30:35 +01:00
Sebastian Huber
2668e4f639 arm: Simplify _ARMV4_Exception_interrupt
Move profiling code closer to bsp_interrupt_disable() to allow re-use of
r9 later.
2016-11-18 07:30:34 +01:00