Commit Graph

323 Commits

Author SHA1 Message Date
Sebastian Huber
b437a36064 arm: Fix CPU context validation for Cortex-R4
Do not touch the FPSCR[QC] bit since this is DNM/RAZ on Cortex-R4.
2017-03-09 14:32:04 +01:00
Sebastian Huber
2433a8ab1c arm: Remove legacy execption support 2017-03-08 15:36:54 +01:00
Christian Mauderer
180107e971 bsps/arm: Fix Cortex-M DWT CPU counter.
It is necessary to enable the DWT using a special initialization
sequence before the CYCCNT can be enabled. See for example the
RESET_CYCLE_COUNTER in libbsp/arm/atsam/utils/utility.h.

Note that this problem only occurs if no debugger is connected. A
debugger most likely already enables the necessary module.
2017-01-30 11:35:31 +01:00
Sebastian Huber
27bfcd88f7 score: Delete _CPU_Context_Fp_start()
Since the FP area pointer is passed by reference in
_CPU_Context_Initialize_fp() the optional FP area adjustment via
_CPU_Context_Fp_start() is superfluous.  It is also wrong with respect
to memory management, e.g. pointer passed to _Workspace_Free() may be
not the one returned by _Workspace_Allocate().

Close #1400.
2017-01-26 07:31:09 +01:00
Kevin Kirspel
b43c2e8952 Adding ARM VFP V2 support 2017-01-24 15:42:05 +01:00
Sebastian Huber
4aa23c9641 Remove CPU_BIG_ENDIAN and CPU_LITTLE_ENDIAN
Use de-facto standard BYTE_ORDER instead.

Close #2803.
2017-01-24 08:39:22 +01:00
Sebastian Huber
f65dcc712a score: Fix ARM and PowerPC context initialization
Update #2751.
2016-12-02 13:11:13 +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
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
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
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
9f225dea19 arm: Fix ARM_CONTEXT_CONTROL_ISR_DISPATCH_DISABLE
Close #2816.
2016-11-21 10:11:18 +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
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
Sebastian Huber
4924756f69 arm: Use local labels 2016-11-18 07:30:34 +01:00
Sebastian Huber
d5e073cde7 score: Allow interrupts during thread dispatch
Use a processor-specific interrupt frame during context switches in case
the executing thread is longer executes on the processor and the heir
thread is about to start execution.  During this period we must not use
a thread stack for interrupt processing.

Update #2809.
2016-11-18 07:30:34 +01:00
Sebastian Huber
dbeccf0ec0 arm: Provide CPU_Interrupt_frame for ARMv4
Update #2809.
2016-11-18 07:30:33 +01:00
Sebastian Huber
141e16d225 rtems: Conditionally define rtems_interrupt_frame
Update #2808.
2016-11-18 07:30:32 +01:00
Sebastian Huber
82d30a310c score: Move CPU_PER_CPU_CONTROL_SIZE
Move CPU_PER_CPU_CONTROL_SIZE and the optional CPU_Per_CPU_control to
<rtems/score/cpuimpl.h> to hide it from <rtems.h>.
2016-11-18 07:30:32 +01:00
Sebastian Huber
acc6d9bf37 score: Remove obsolete defines
The thread dispatch inline option is no longer used.
2016-11-18 07:30:31 +01:00
Sebastian Huber
04bd261726 arm: Use TPIDRPRW for current per-CPU control
Use the previously unused TPIDRPRW register to get the per-CPU control
of the current processor.  This avoids instructions in
GET_SELF_CPU_CONTROL which are not available in Thumb mode.
2016-11-18 07:30:31 +01:00
Sebastian Huber
df63fbd1ac score: Add <rtems/score/cpuimpl.h>
The aim of this file is to encapsulate CPU port implementation details.
This helps to hide implementation details from <rtems.h> which
indirectly includes <rtems/score/cpu.h>.
2016-11-07 07:39:41 +01:00
Pavel Pisa
8714684129 score/arm: Correct logic to select 64 byte cache line maximum size for Cortex-A.
The use of actual cache line max bytes and minimum required alignment
in architecture but not-BSP dependent code could be problematic
because there exists even ARM instruction set implementations
with 128 byte line length and real maximum can be quite problematic
to say. But actually supported ARM BSPs should be OK with these values.
2016-10-04 23:30:22 +02:00
Sebastian Huber
9149c87ec7 score: Fix C/C++ compatibility issue
Only use CPU_Per_CPU_control if it contains at least one filed.  In GNU
C empty structures have a size of zero.  In C++ structures have a
non-zero size.  In case CPU_PER_CPU_CONTROL_SIZE is defined to zero,
then this structure is not used anymore.
2016-09-23 06:57:03 +02:00
Kevin Kirspel
36fad91f00 arm: Add VFP context validate support for ARMv5 2016-08-19 07:40:45 +02:00
Sebastian Huber
75fc27ad39 score: Fix printk() format specifiers 2016-07-26 07:54:05 +02:00
Pavel Pisa
0cb50ab25b score/arm: Ensure that copile time alignment is 64 bytes for Cortex-A multilib.
Some/many Cortex-A cores have data cache line length 64 bytes and maximum
value has to be used for system structures alignment.
2016-07-04 15:55:57 +02:00
Pavel Pisa
19a9090164 arm/score and shared: define ARM hypervisor mode and alternate vector table base access.
The main reason for inclusion of minimum hypervisor related defines
is that current ARM boards firmware and loaders (U-boot for example)
start loaded operating system kernel in HYP mode to allow it take
control of virtualization (Linux/KVM for example).
2016-07-04 15:55:56 +02:00
Sebastian Huber
b04b76c6a0 score: Simplify priority bit map implementation
The priority bit map can deal with a maximum of 256 priority values
ranging from 0 to 255.  Consistently use an unsigned int for
computation, due to the usual integer promotion rules.

Make Priority_bit_map_Word definition architecture-independent and
define it to uint16_t.  This was already the case for all architectures
except PowerPC.  Adjust the PowerPC bitmap support accordingly.
2016-06-08 15:48:03 +02:00
Sebastian Huber
18e29faf98 score: Delete CPU_USE_GENERIC_BITFIELD_DATA
Rename __log2table into _Bitfield_Leading_zeros since it acually returns
the count of leading zeros of an 8-bit integer.  The value for zero is a
bit odd.  Provide it unconditionally.
2016-06-08 15:48:03 +02:00
Chris Johns
23213135d1 arm: Fix printk warnings. 2016-06-03 17:28:58 +10:00
Sebastian Huber
2471316321 score: Rename _ISR_Disable() and _ISR_Enable()
Rename _ISR_Disable() into _ISR_Local_disable().  Rename _ISR_Enable()
into _ISR_Local_enable().  Remove _Debug_Is_owner_of_giant().

This is a preparation to remove the Giant lock.

Update #2555.
2016-05-20 07:50:37 +02:00
Sebastian Huber
decff899ec score: Add CPU_MAXIMUM_PROCESSORS
Maximum number of processors of all systems supported by this CPU port.
2016-03-04 13:36:08 +01:00
Martin Galvan
86a276b5f3 _ARMV7M_Is_vector_an_irq: Use ARMV7M_VECTOR_SYSTICK instead of hardcoded 16
Also add a comment explaining why we use that value.
2016-02-19 16:11:29 -06:00
Sebastian Huber
e4b5289ad3 arm: Fix Cortex-M7 support 2016-02-04 14:37:02 +01:00
Sebastian Huber
a8865f8b41 score: Introduce CPU_CACHE_LINE_BYTES
Add CPU_CACHE_LINE_BYTES for the maximum cache line size in bytes.  The
actual processor may use no cache or a smaller cache line size.
2016-01-26 09:07:30 +01:00
Sebastian Huber
01b32d44a4 score: Delete obsolete CPU_TIMESTAMP_* defines
Update #2271.
2016-01-25 12:05:10 +01:00
Sebastian Huber
370cdefdbc arm: Use DWT CYCCNT for timecounter if available 2016-01-21 13:25:07 +01:00
Sebastian Huber
819a6b35cc arm: Honor cache for Cortex-M7 support 2016-01-15 14:23:38 +01:00
Sebastian Huber
32521269dc arm: Accept Cortex-M7 multilib 2016-01-15 14:19:42 +01:00
Sebastian Huber
5c7bfcf82e Fix interrupt epilogue for ARMv7-AR and PowerPC 2015-11-12 08:21:45 +01:00
Sebastian Huber
143696acbd basedefs.h: Add and use RTEMS_NO_RETURN 2015-10-26 09:13:19 +01: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
Martin Galvan
f52885b6bc ARMv7M: Improve exception handler routine and add comments on SP selection
This patch adds a brief description of how context state is saved into the
SP on exception entry, and makes a few changes to _ARMV7M_Exception_default
in order to make it a bit more efficient. I also removed the unused 'v7mfsz'
input parameter.

This should apply over Sudarshan's patch.
2015-09-23 14:53:25 +02:00
Sudarshan Rajagopalan
7263a50d6c Fix exception handler for supporting FPU 2015-09-23 14:52:55 +02:00
Sebastian Huber
95b43d0dde arm: Replace __sync_synchronize() implementation 2015-09-01 09:59:26 +02:00
Sebastian Huber
39e3e20140 arm: Use compiler memory barrier by default 2015-09-01 09:59:18 +02:00
Jan Sommer
7e798b4758 Add __synch_synchronize function for arm
Fixes link failure when linking Ada programs on the raspberry pi
2015-08-01 10:19:40 -07:00
Sebastian Huber
98a41f419c arm: Include proper header file 2015-07-23 20:34:19 +02:00