#3659 new defect

LEON3 kernel entry point is overwritten - secondary processors may enter into spurious handler

Reported by: Martin Aberg Owned by:
Priority: normal Milestone:
Component: arch/sparc Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

When linking a LEON3 RTEMS SMP application, the entry point in the ELF output file is set to the symbol "start".

"start" is the first entry in the trap table and directly jumps to "hard_reset".

The boot CPU does the following in the boot_card():

  1. Release other CPUs from power-down (but does not wait here)
  2. Some other initializations
  3. Overwrite trap entry 0 with spurious interrupt handler
  4. The rest

It means that the entry point is guaranteed to be valid for the first CPU entering the RTEMS kernel. But 1. and 3. above gives a race. non-first CPU:s will either enter the kernel properly or end up in the spurious interrupt handler depending on how quick it reaches the "start" label.

One example where this has been an issue is when secondary processors run for some time (self-tests) in a ROM boot loader before entering the RTEMS (ELF) entry point. It is convenient to use the ELF file entry point for all processors.

Possible solutions:

a.
Do not install spurious handler on trap table entry 0. For example by changing bsps/sparc/leon3/start/spurious.c:

    -  for ( trap=1 ; trap<256 ; trap++ ) {
    +  for ( trap=0 ; trap<256 ; trap++ ) {

(This changes address 0 on GR740. So following a null function pointer may not end up in spurious trap anymore.)

b.
Change the SPARC ELF entry point. For example to the symbol hard_reset.

c.
Document that the entry point for boot processor is "start" and entry point for other processors is "hard_reset".

Change History (0)

Note: See TracTickets for help on using tickets.