summaryrefslogtreecommitdiffstats
path: root/bsps/sparc/shared/start/start.S (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-02-10bsp/leon3: Move SMP data to start.SSebastian Huber1-11/+24
The LEON3_Boot_Cpu global object is only used by start.S. Move the definition of this object to start.S and use a local symbol .Lbootcpuindex for it. Use a compare-and-swap instruction to assign the boot CPU. This allows a concurrent initialization. Close #4845.
2022-11-14bsps/sparc: Change license to BSD-2 for files with Gaisler copyrightDaniel Cederman1-3/+22
This patch changes the license to BSD-2 for all source files where the copyright is held by Aeroflex Gaisler, Cobham Gaisler, or Gaisler Research. Some files also includes copyright right statements from OAR and/or embedded Brains in addition to Gaisler. Updates #3053.
2021-06-24sparc: Simplify trap table initializationSebastian Huber1-16/+23
Move _ISR_Handler() to a separate file since it is now only used if a handler is installed by _CPU_ISR_install_raw_handler(). Statically initialize the traps for external interrupts to use the new _SPARC_Interrupt_trap() which directly dispatches the interrupt handlers installed by rtems_interrupt_handler_install() via the BSP-provided _SPARC_Interrupt_dispatch(). Since the trap table is now fully statically initialized, there is no longer a dependency on the Cache Manager in the default configuration. Update #4458.
2021-06-24sparc: More reliable bad trap handlingSebastian Huber1-5/+2
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-24bsps/sparc: Add a symbol for each trap table entrySebastian Huber1-95/+264
This makes it easier to review start.o and set break points to trap table entries. This change was checked by inspecting the trap table in start.o with objdump. Update #4458.
2021-06-10bsps/sparc: Simplify memory initializationSebastian Huber1-10/+4
Directly initialize the memory in the start sequence defined by start.S instead of using a system initialization handler. This avoids using the global variable rdb_start which used a memory location which was shared with _ERC32_MEC_Timer_Control_Mirror. This change makes it possible to use _Memory_Allocate() even before the system initialization is started. Change license to BSD-2-Clause according to file history and re-licensing agreement. Update #3053.
2021-06-10bsps/sparc: Simplify stack initializationSebastian Huber1-28/+21
Initialize the stacks for all processors in one place. Do not rely on Per_CPU_Control::interrupt_stack_high and directly use the statically allocated interrupt stack area.
2021-06-10bsps/sparc: Unify stack initializationSebastian Huber1-8/+6
Initialize the stacks in start.S in one place and identical to _CPU_Context_Initialize().
2021-06-10bsps/sparc: Remove support to load data sectionSebastian Huber1-32/+4
Remove the support to load the data section and rely on the boot loader. The code is an artifact from the old erc32 days, when we would boot and execute from ROM and the .data had to be copied over to RAM. With leon1/2/3, this is not used anymore as a boot loader is made from the RAM image using a custom tool (mkprom). In SMP configurations, this support was also broken since LEON3_Boot_Cpu (in the data section due to the -1 initialization value) was used quite early in the start sequence. If the data copy is really necessary, then an application can still add this step as a very early system initialization step, since boot_card() and the system initialization loop does not use initialized read-write data (only read-only and BSS data). However, the SMP startup would still not work in this case. A boot loader is a better place to load the sections.
2021-06-10bsps/sparc: Remove unused __bsp_mem_init symbolSebastian Huber1-1/+1
2018-11-08score: Rename interrupt stack symbolsSebastian Huber1-2/+2
Rename * _Configuration_Interrupt_stack_area_begin in _ISR_Stack_area_begin, * _Configuration_Interrupt_stack_area_end in _ISR_Stack_area_end, and * _Configuration_Interrupt_stack_size in _ISR_Stack_size. Move definitions to <rtems/score/isr.h>. The new names are considerable shorter and in the right namespace. Update #3459.
2018-08-24sparc,smp: typo in start.S causing SMP not workingDaniel Hellstrom1-1/+1
2018-08-01bsps/sparc: Fix typo in start.SSebastian Huber1-1/+1
Fix typo in start.S introduced by 4678d1a8b0e74a12809122ef071324c99e78d7ff.
2018-07-25bsps: bsp_start_on_secondary_processor()Sebastian Huber1-0/+1
Pass current processor control as first parameter in bsp_start_on_secondary_processor() and qoriq_start_thread() to make dependency more explicit.
2018-06-27Rework initialization and interrupt stack supportSebastian Huber1-3/+9
Statically initialize the interrupt stack area (_Configuration_Interrupt_stack_area_begin, _Configuration_Interrupt_stack_area_end, and _Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the interrupt stack area in a special section ".rtemsstack.interrupt". Let BSPs define the optimal placement of this section in their linker command files (e.g. in a fast on-chip memory). This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the low level initialization code has all information available via global symbols. This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define superfluous, since the interrupt stacks are allocated by confdefs.h for all architectures. There is no need for BSP-specific linker command file magic (except the section placement), see previous ARM linker command file as a bad example. Remove _CPU_Install_interrupt_stack(). Initialize the hardware interrupt stack in _CPU_Initialize() if necessary (e.g. m68k_install_interrupt_stack()). The optional _CPU_Interrupt_stack_setup() is still useful to customize the registration of the interrupt stack area in the per-CPU information. The initialization stack can reuse the interrupt stack, since * interrupts are disabled during the sequential system initialization, and * the boot_card() function does not return. This stack resuse saves memory. Changes per architecture: arm: * Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases. * Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp. bfin: * Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value. lm32, m32c, mips, nios2, riscv, sh, v850: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. m68k: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. powerpc: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. * Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA). sparc: * Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM. Update #3459.
2018-04-20bsps: Move start files to bspsSebastian Huber1-0/+0
This patch is a part of the BSP source reorganization. Update #3285.
2017-07-25sparc: Add lazy floating point switchSebastian Huber1-1/+14
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-05-14sparc: only define start if it is different from SYM(start)Jacob Hansen1-0/+2
The SYM define concatenates the input with the compiler set __USER_LABEL_PREFIX__ define. This define appears to be '_' in GCC but empty in Clang. Therefore when compiling with Clang/LLVM 'SYM(start)' and 'start' defines the same symbol, and the compiler complains that the symbol is defined twice.
2017-05-14sparc: Adjust assembly to improve compability with LLVMJacob Hansen1-2/+2
- All references of %0 changed to %g0 - 'call label,0' changed to 'call label'. According to the sparc specification call does not take any registers - '.seg "text"' changed to '.section ".text"' - the synonym stub is replaced with stb - the synonym stuh is replaced with sth
2017-05-14leon: allow SMP boot from any CPUMartin Aberg1-5/+9
2016-11-29Remove sparc/sis BSP.Joel Sherrill1-56/+0
closes #2810.
2016-11-28sparc: Optimize _ISR_Handler()Sebastian Huber1-1/+6
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-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-11-02bsps/sparc: Fix copy of initialized dataSebastian Huber1-7/+7
The text and data sections may have different alignment requirements. Support a data section alignment greater than 16.
2016-03-17sparc: Fix window underflow trap handlerDaniel Hellstrom1-1/+1
The window underflow trap handler used %i5 which destroyed the %o5 of the calling context. Bug introduced by 0d3b5d47429effb350448d9e9123a67db722109f. Go back to the pre 0d3b5d47429effb350448d9e9123a67db722109f behaviour and use the two unused instructions in the trap vector to optimize a bit. Update #2651.
2014-12-04SPARC: optimize IRQ enable & disableDaniel Hellstrom1-5/+25
* Coding style cleanups. * Use OS reserved trap 0x89 for IRQ Disable * Use OS reserved trap 0x8A for IRQ Enable * Add to SPARC CPU supplement documentation This will result in faster Disable/Enable code since the system trap handler does not need to decode which function the user wants. Besides the IRQ disable/enabled can now be inline which avoids the caller to take into account that o0-o7+g1-g4 registers are destroyed by trap handler. It was also possible to reduce the interrupt trap handler by five instructions due to this.
2014-12-02SPARC: optimize window underflow trapDaniel Hellstrom1-1/+10
Save five instructions on underflow handling. By using an optimized trap entry we can move instructions from the window underflow function into the trap entry vector. By setting WIM=0 and using RESTORE it is possible to move the new WIM register content from the trapped window into the to-be-restored register window. It is then possible to avoid the WIM write delay.
2014-12-02SPARC: window overflow optimizationDaniel Hellstrom1-1/+10
I see no need for waiting the 3 instruction delay for wim to be written in this case, since the STD after does not depend on WIM
2014-10-06erc32,leon2: replace bsp_reset with SPARC fatal handlerDaniel Hellstrom1-7/+0
Now that a SPARC fatal handler is defined, we no longer need the BSP specific reset routine.
2014-10-06SPARC: add BSP specific error handlerDaniel Hellstrom1-3/+2
Instead of calling the system call TA instruction directly it is better paractise to isolate the trap implementation to the system call functions. BSP_fatal_exit() is added.
2014-10-06SPARC BSPs: remove BSP_fatal_return unreached codeDaniel Hellstrom1-7/+2
2014-05-28SPARC: syscall optimizations and PSR-write fixDaniel Hellstrom1-1/+10
The last optimization missed was incorrect in regards to PSR write instruction delay must be 3 instructions. New optimizations: * align to 32-byte cache line. * rearrange code into three "blocks" of 4 instructions that is executed by syscall 2 and 3. This is to optimize for 16/32 byte cache lines. * use delay-slot instruction in trap table to reduce by one instruction. * use the fact that "wr %PSR" implements XOR to reduce by one instruction.
2014-05-14bsps/sparc: Fix BSS initializationSebastian Huber1-2/+0
Use __bss_start available via %g2 to clear the BSS section. The usage of _edata resulted in a copy of [_edata, __bss_start) from ROM to RAM and then a clear to zero of this area. Clear now only [__bss_start, _end).
2014-05-14bsps/sparc: Fix data copy in start procedureSebastian Huber1-9/+9
Use the register %g4 for the data content since it must be an even numbered register due to the std/ldd. Use the register %g2 for the BSS start address, so that it can be later re-used for the BSS zero loop.
2014-05-12bsps: Use bsp_start_on_secondary_processor()Sebastian Huber1-1/+1
Use a standard function for startup on secondary processors.
2014-04-28sparc: Add _CPU_Get_current_per_CPU_control()Sebastian Huber1-12/+13
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-03-21Change all references of rtems.com to rtems.org.Chris Johns1-1/+1
2014-02-21bsp/leon3: Add bsp_reset() for SMP configurationSebastian Huber1-0/+2
2014-02-14sparc: Add LEON3_ASR17_PROCESSOR_INDEX_SHIFTSebastian Huber1-1/+1
Add _LEON3_Get_current_processor().
2014-02-05bsp/leon3: Fix SMP initializationSebastian Huber1-24/+23
Avoid usage of the same stack area by multiple secondary processors at the same time. Avoid magic delay loops.
2013-12-07sparc shared: improve doxygenToma Radu1-2/+0
Add doxygen to the header files in sparc/shared/include directory.
2013-12-03sparc: refactored shared/start.S to shared/start/start.SDaniel Ramirez1-0/+0
2013-10-31SPARC BSPs: disable interrupts as early as possibleDaniel Hellstrom1-2/+2
There is no point having interrupts enabled before reaching boot_card() that disables interrupt. We better have it off all the time. It is required to turn off interrupt on secondary CPUs in an SMP system.
2012-11-14bsps/sparc: Define bsp_reset()Sebastian Huber1-0/+2
This is declared in <bsp/bootcard.h> and is the usual function to reset a board.
2012-11-07bsps/sparc: Delete unused symbol declarationSebastian Huber1-1/+0
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-06-282011-06-28 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill1-5/+37
Jennifer Averett <jennifer.averett@OARcorp.com> PR 1801/bsps * shared/start.S: Add SMP support to LEON3 BSP.
2009-11-29Whitespace removal.Ralf Corsepius1-14/+14
2009-08-282009-08-28 Joel Sherrill <joel.sherrill@OARcorp.com>Joel Sherrill1-1/+1
* shared/start.S: Fix comment.
2009-05-042009-05-03 Joel Sherrill <joel.sherrill@oarcorp.com>Joel Sherrill1-5/+0
* shared/start.S: Checked and OK.