Changeset e0caabe in rtems


Ignore:
Timestamp:
Nov 20, 2018, 12:09:53 PM (8 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
59e7209f
Parents:
faafc22
git-author:
Sebastian Huber <sebastian.huber@…> (11/20/18 12:09:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/21/18 06:48:23)
Message:

bsps/arm: Avoid short range branch in start.S

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/shared/start/start.S

    rfaafc22 re0caabe  
    277277
    278278        /*
    279          * Branch to start hook 0.
     279         * Invoke the start hook 0.
    280280         *
    281281         * The previous code and parts of the start hook 0 may run with an
    282          * address offset.  This implies that only branches relative to the
    283          * program counter are allowed.  After the start hook 0 it is assumed
     282         * address offset.  After the return from start hook 0 it is assumed
    284283         * that the code can run at its intended position.  Thus the link
    285          * register will be loaded with the absolute address.  In THUMB mode
    286          * the start hook 0 must be within a 2kByte range due to the branch
    287          * instruction limitation.
     284         * register will be loaded with the absolute address and the branch
     285         * link instruction cannot be used.  In THUMB mode the branch
     286         * instruction as a very limited address range of 2KiB.  Use a bx to
     287         * the start hook 0 address instead corrected by the address offset.
    288288         */
    289289
    290290        ldr     lr, =.Lstart_hook_0_done
    291 #ifdef __thumb__
    292         orr     lr, #1
    293 #endif
    294 
    295         SWITCH_FROM_ARM_TO_THUMB        r0
     291        mov     r0, pc
     292        ldr     r1, =.Lget_absolute_pc
     293.Lget_absolute_pc:
     294        sub     r1, r0
     295        ldr     r7, =bsp_start_hook_0
     296        add     r7, r1
    296297
    297298        mov     r0, r4          /* original CPSR value */
     
    299300        mov     r2, r6          /* physical address of ATAGs or DTB */
    300301
    301         b       bsp_start_hook_0
     302        bx      r7
    302303
    303304.Lstart_hook_0_done:
    304 
    305         SWITCH_FROM_THUMB_TO_ARM
    306305
    307306        /*
Note: See TracChangeset for help on using the changeset viewer.