summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/sparc/cpu.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-05-20Update company nameSebastian Huber1-1/+1
The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
2022-10-14score: Add CPU_THREAD_LOCAL_STORAGE_VARIANTSebastian Huber1-1/+1
Update #3835.
2022-02-28score/cpu/sparc: Change license to BSD-2Joel Sherrill1-3/+22
Updates #3053.
2021-06-24sparc: More reliable bad trap handlingSebastian Huber1-0/+51
Statically initialize the trap table in start.S to jump to _SPARC_Bad_trap() for all unexpected traps. This enables a proper RTEMS fatal error handling right from the start. Do not rely on the stack and register settings which caused an unexpected trap. Use the ISR stack of the processor to do the fatal error handling. Save the full context which caused the trap. Fatal error handler may use it for error logging. Unify the _CPU_Exception_frame_print() implementations and move it to cpukit. Update #4459.
2021-06-24sparc: Move ISR handler install routinesSebastian Huber1-174/+7
Move _CPU_ISR_install_raw_handler() and _CPU_ISR_install_vector() to separate files. The goal is to make their use optional. Update #4458. Update #4459.
2019-03-14Remove superfluous <rtems/system.h> includesSebastian Huber1-1/+0
2018-11-12sparc: Remove use of proc_ptrSebastian Huber1-9/+9
Update #3585.
2018-11-08score: Remove _ISR_Dispatch()Sebastian Huber1-2/+2
This function was only used on some m68k variants. On these m68k variants there is no need to use a global symbol. Use a local label instead. Remove _ISR_Dispatch() from the architecture-independent layer.
2018-04-20sparc: Move _CPU_Trap_slot_templateSebastian Huber1-0/+16
The definition of _CPU_Trap_slot_template is BSP-independent. A potential para-virtualization support may use <rtems/score/paravirt.h>. This patch is a part of the BSP source reorganization. Update #3285.
2017-07-25sparc: Add lazy floating point switchSebastian Huber1-20/+45
The SPARC ABI is a bit special with respect to the floating point context. The complete floating point context is volatile. Thus, from an ABI point of view nothing needs to be saved and restored during a context switch. Instead the floating point context must be saved and restored during interrupt processing. Historically, the deferred floating point switch was used for SPARC and the complete floating point context is saved and restored during a context switch to the new floating point unit owner. This is a bit dangerous since post-switch actions (e.g. signal handlers) and context switch extensions may silently corrupt the floating point context. The floating point unit is disabled for interrupt handlers. Thus, in case an interrupt handler uses the floating point unit then this will result in a trap (INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT). In uniprocessor configurations, a lazy floating point context switch is used. In case an active floating point thread is interrupted (PSR[EF] == 1) and a thread dispatch is carried out, then this thread is registered as the floating point owner. When a floating point owner is present during a context switch, the floating point unit is disabled for the heir thread (PSR[EF] == 0). The floating point disabled trap checks that the use of the floating point unit is allowed and saves/restores the floating point context on demand. Update #3077.
2017-07-25sparc: Rename SPARC_USE_SAFE_FP_SUPPORTSebastian Huber1-2/+2
Rename SPARC_USE_SAFE_FP_SUPPORT in SPARC_USE_SYNCHRONOUS_FP_SWITCH. Update comment. Update #3077.
2016-11-18sparc: Use Per_CPU_Control::isr_dispatch_disableSebastian Huber1-6/+0
Update #2751.
2016-11-18score: Add Per_CPU_Control::Interrupt_frameSebastian Huber1-5/+0
Update #2809.
2016-11-18sparc: Move CPU_Interrupt_frame related definesSebastian Huber1-1/+6
Move CPU_Interrupt_frame related defines to <rtems/score/cpuimpl.h>. Update #2809.
2016-11-18sparc: Rename CPU_Minimum_stack_frameSebastian Huber1-1/+1
Rename SPARC-specific CPU_Minimum_stack_frame to SPARC_Minimum_stack_frame. Rename SPARC-specific CPU_MINIMUM_STACK_FRAME_SIZE to SPARC_MINIMUM_STACK_FRAME_SIZE. Update #2809.
2016-02-17sparc: Avoid SCORE_EXTERNSebastian Huber1-0/+4
Update #2559.
2015-11-16sparc: Fix context switch on SMPDaniel Cederman1-0/+3
We must not load registers (e.g. PSR) from the heir context area before the heir stopped execution. With this patch the write to PSR is divided into two steps. We first update the current window pointer and then we restore the status registers and enable traps. This allows us to move the first write to PSR to be before the write to WIM, as there is now no risk that we get an interrupt where the CWP and WIM would be inconsistent. We only need to make sure that we do not use any of the non-global registers or instructions that affects CWP for three instructions after the write. In the earlier code the non-global %o1 register was used right after the write to PSR, which required the use of three nop:s.
2015-06-09sparc: Add SPARC_USE_SAFE_FP_SUPPORTSebastian Huber1-1/+1
The SPARC ABI is a bit special with respect to the floating point context. The complete floating point context is volatile. Thus from an ABI point of view nothing needs to be saved and restored during a context switch. Instead the floating point context must be saved and restored during interrupt processing. Historically the deferred floating point switch is used for SPARC and the complete floating point context is saved and restored during a context switch to the new floating point unit owner. This is a bit dangerous since post-switch actions (e.g. signal handlers) and context switch extensions may silently corrupt the floating point context. The floating point unit is disabled for interrupt handlers. Thus in case an interrupt handler uses the floating point unit then this will result in a trap. On SMP configurations the deferred floating point switch is not supported in principle. So use here a safe floating point support. Safe means that the volatile floating point context is saved and restored around a thread dispatch issued during interrupt processing. Thus post-switch actions and context switch extensions may safely use the floating point unit. Update #2270.
2015-05-30sparc: Disable FPU in interrupt contextAlexander Krutwig1-0/+8
Update #2270.
2015-05-30sparc: Remove superfluous FP enableSebastian Huber1-0/+5
The FP context save/restore makes only sense in the context of FP threads. Update #2270.
2015-05-26sparc: Add static assertionSebastian Huber1-0/+5
2015-05-26sparc: Add static offset assertionsSebastian Huber1-0/+32
2014-08-22score/sparc: Add comment on icache flush after trap table updateDaniel Cederman1-3/+14
Changes to the trap table might be missed by other cores. If the system state is up, the other cores can be notified using SMP messages that they need to flush their icache. If the up state has not been reached there is no need to notify other cores. They will do an automatic flush of the icache just after entering the up state, but before enabling interrupts. Cache invalidation is required for both single and multiprocessor systems.
2014-06-03score/sparc: Add support for paravirtualizationChristian Mauderer1-17/+0
Guest systems in paravirtualization environments run usually in user mode. Thus it is not possible to directly access the PSR and TBR registers. Use functions instead of inline assembler to access these registers if RTEMS_PARAVIRT is defined.
2014-05-08score: Fix CPU context usage on SMPSebastian Huber1-4/+0
We must not alter the is executing indicator in _CPU_Context_Initialize() since this would cause an invalid state during a self restart. The is executing indicator must be valid at creation time since otherwise _Thread_Kill_zombies() uses an undefined value for not started threads. This could result in a system life lock.
2014-05-07score: Implement forced thread migrationSebastian Huber1-0/+8
The current implementation of task migration in RTEMS has some implications with respect to the interrupt latency. It is crucial to preserve the system invariant that a task can execute on at most one processor in the system at a time. This is accomplished with a boolean indicator in the task context. The processor architecture specific low-level task context switch code will mark that a task context is no longer executing and waits that the heir context stopped execution before it restores the heir context and resumes execution of the heir task. So there is one point in time in which a processor is without a task. This is essential to avoid cyclic dependencies in case multiple tasks migrate at once. Otherwise some supervising entity is necessary to prevent life-locks. Such a global supervisor would lead to scalability problems so this approach is not used. Currently the thread dispatch is performed with interrupts disabled. So in case the heir task is currently executing on another processor then this prolongs the time of disabled interrupts since one processor has to wait for another processor to make progress. It is difficult to avoid this issue with the interrupt latency since interrupts normally store the context of the interrupted task on its stack. In case a task is marked as not executing we must not use its task stack to store such an interrupt context. We cannot use the heir stack before it stopped execution on another processor. So if we enable interrupts during this transition we have to provide an alternative task independent stack for this time frame. This issue needs further investigation.
2014-04-28sparc: Add _CPU_Get_current_per_CPU_control()Sebastian Huber1-1/+0
Use register g6 for the per-CPU control of the current processor. The register g6 is reserved for the operating system by the SPARC ABI. On Linux register g6 is used for a similar purpose with the same method since 1996. The register g6 must be initialized during system startup and then must remain unchanged. Since the per-CPU control is used in all critical sections of the operating system, this is a performance optimization for the operating system core procedures. An additional benefit is that the low-level context switch and interrupt processing code is now identical on non-SMP and SMP configurations.
2014-04-28sparc: Optimize context switchSebastian Huber1-10/+11
The registers g2 through g4 are reserved for applications. GCC uses them as volatile registers by default. So they are treated like volatile registers in RTEMS as well.
2014-04-17score: Clarify TLS supportSebastian Huber1-1/+1
2014-03-21Change all references of rtems.com to rtems.org.Chris Johns1-1/+1
2014-02-12sparc: Save/restore only non-volatile contextSebastian Huber1-0/+38
The _CPU_Context_switch() is a normal function call. The following registers are volatile (the caller must assume that the register contents are destroyed by the callee) according to "SYSTEM V APPLICATION BINARY INTERFACE - SPARC Processor Supplement", Third Edition: g1, o0, o1, o2, o3, o4, o5. Drop these registers from the context. Ensure that offset defines match the structure offsets.
2014-02-04Add thread-local storage (TLS) supportSebastian Huber1-1/+9
Tested and implemented on ARM, m68k, PowerPC and SPARC. Other architectures need more work.
2013-08-09sparc: Make _CPU_ISR_Dispatch_disable per-CPUSebastian Huber1-7/+7
This variable must be available for each processor in the system.
2012-11-30score misc: Score misc: Clean up Doxygen #9 (GCI 2012)Alex Ivanov1-44/+6
This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. https://google-melange.appspot.com/gci/task/view/google/gci2012/7977211
2012-05-11Remove All CVS Id Strings Possible Using a ScriptJoel Sherrill1-2/+0
Script does what is expected and tries to do it as smartly as possible. + remove occurrences of two blank comment lines next to each other after Id string line removed. + remove entire comment blocks which only exited to contain CVS Ids + If the processing left a blank line at the top of a file, it was removed.
2011-07-242011-07-24 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill1-10/+5
* cpu.c: Remove /*PAGE markers which were interpreted by a long dead print script.
2010-11-162010-11-16 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill1-3/+0
* cpu.c: Remove unused variable reported by clang.
2010-03-272010-03-27 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill1-0/+4
* cpu.c, cpu_asm.S: Add include of config.h
2009-12-02Whitespace removal.Ralf Corsepius1-19/+19
2009-02-112009-02-11 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill1-5/+2
* cpu.c, rtems/score/cpu.h: Eliminate _CPU_Thread_dispatch_pointer and passing address of _Thread_Dispatch to _CPU_Initialize. Clean up comments.
2008-12-07Fix typo.Ralf Corsepius1-1/+1
2008-09-082008-09-08 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill1-3/+3
* cpu.c: Remove extraneous spaces.
2008-09-05Convert to "bool".Ralf Corsepius1-1/+1
2008-02-202008-02-20 Alexandru Bugnar <a-bugnar@criticalsoftware.com>Joel Sherrill1-1/+1
PR 1278/cpukit * cpu.c: Fix incorrect bit manipulation on returning old address of raw trap handler.
2007-12-042007-12-04 Joel Sherrill <joel.sherrill@OARcorp.com>Joel Sherrill1-2/+0
* cpu.c, rtems/score/cpu.h: Move interrupt_stack_size field from CPU Table to Configuration Table. Eliminate CPU Table from all ports. Delete references to CPU Table in all forms.
2007-11-022007-11-02 Joel Sherrill <joel.sherrill@OARcorp.com>Joel Sherrill1-2/+2
* score/cpu/sparc/cpu.c, score/cpu/sparc/rtems/score/cpu.h, score/include/rtems/score/context.h, score/src/threadhandler.c: Fix stack so gdb backtrace does not print corrupted frame message after _Thread_Handler. Daniel Hellstrom <daniel@gaisler.com> provided the SPARC implementation and I made it more general.
2007-05-222007-05-22 Joel Sherrill <joel.sherrill@OARcorp.com>Joel Sherrill1-6/+0
* score/cpu/arm/cpu.c, score/cpu/avr/cpu.c, score/cpu/bfin/cpu.c, score/cpu/c4x/cpu.c, score/cpu/h8300/cpu.c, score/cpu/i386/cpu.c, score/cpu/m68k/cpu.c, score/cpu/mips/cpu.c, score/cpu/nios2/cpu.c, score/cpu/no_cpu/cpu.c, score/cpu/sh/cpu.c, score/cpu/sparc/cpu.c, cpukit/sapi/src/exinit.c: Move copying of CPU Table to shared executive initialization.
2007-05-102007-05-10 Joel Sherrill <joel.sherrill@OARcorp.com>Joel Sherrill1-0/+13
PR 1237/rtems * cpu.c, cpu_asm.S, rtems/score/cpu.h: Add logic to prevent stack creep when interrupts occur at a sufficient rate that the interrupted thread never gets to clean its stack. This patch ensures that an interrupted thread will not nest ISR dispatches on its stack.
2007-04-17Use Context_Control_fp* instead of void* for fp_contexts.Ralf Corsepius1-1/+1
2004-03-302004-03-30 Ralf Corsepius <ralf_corsepius@rtems.org>Ralf Corsepius1-17/+17
* cpu.c, rtems/score/cpu.h, rtems/score/sparc.h: Convert to using c99 fixed size types.