Changeset 0354299 in rtems


Ignore:
Timestamp:
Jul 16, 2008, 11:10:55 PM (11 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.9, master
Children:
84a25d8
Parents:
6ce3f7b
Message:

2008-07-16 Till Straumann <strauman@…>

  • new-exceptions/bspsupport/vectors_init.c: must not align start of stack downwards (we don't 'own' memory below start). Instead, use original boundaries but align the stack pointer as required.

Added test to verify that R13 was loaded with _SDA_BASE_
during early initialization (low-level assembly code
relies on it).

Location:
c/src/lib/libcpu/powerpc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/ChangeLog

    r6ce3f7b r0354299  
     12008-07-16      Till Straumann <strauman@slac.stanford.edu>
     2
     3        * new-exceptions/bspsupport/vectors_init.c: must not
     4        align start of stack downwards (we don't 'own' memory
     5        below start). Instead, use original boundaries but
     6        align the stack pointer as required.
     7
     8        Added test to verify that R13 was loaded with _SDA_BASE_
     9        during early initialization (low-level assembly code
     10        relies on it).
     11
    1122008-07-16      Till Straumann <strauman@slac.stanford.edu>
    213
  • c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors_init.c

    r6ce3f7b r0354299  
    351351        uint32_t interrupt_stack_pointer = 0;
    352352        uint32_t *p = NULL;
    353 
    354         /* Ensure proper interrupt stack alignment */
    355         interrupt_stack_start &= ~(CPU_STACK_ALIGNMENT - 1);
    356         interrupt_stack_size &= ~(CPU_STACK_ALIGNMENT - 1);
     353        uint32_t r13, sda_base;
     354
     355        /* Assembly code needs SDA_BASE in r13 (SVR4 or EABI). Make sure
     356         * early init code put it there.
     357         */
     358        asm volatile(
     359                "       lis %0,     _SDA_BASE_@h  \n"
     360                "       ori %0, %0, _SDA_BASE_@l  \n"
     361                "       mr  %1, 13                \n"
     362        :"=r"(sda_base),"=r"(r13)
     363        );
     364
     365        if ( sda_base != r13 ) {
     366                printk("ppc_exc_initialize(): INTERNAL ERROR\n");
     367                printk("  your BSP seems to not have loaded _SDA_BASE_\n");
     368                printk("  into R13 as required by SVR4/EABI. Check early init code...\n");
     369                printk("  _SDA_BASE_: 0x%08x, R13: 0x%08x\n", sda_base, r13);
     370                while (1)
     371                        ;
     372        }
    357373
    358374        /* Interrupt stack end and pointer */
    359375        interrupt_stack_end = interrupt_stack_start + interrupt_stack_size;
    360         interrupt_stack_pointer = interrupt_stack_end - PPC_MINIMUM_STACK_FRAME_SIZE;
     376
     377        interrupt_stack_pointer  = interrupt_stack_end - PPC_MINIMUM_STACK_FRAME_SIZE;
     378
     379        /* Ensure proper interrupt stack alignment */
     380        interrupt_stack_pointer &= ~(CPU_STACK_ALIGNMENT - 1);
    361381
    362382        /* Tag interrupt stack bottom */
Note: See TracChangeset for help on using the changeset viewer.