2008-07-16 Till Straumann <strauman@slac.stanford.edu>

* 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).
This commit is contained in:
Till Straumann
2008-07-16 23:10:55 +00:00
parent 6ce3f7b7e2
commit 03542996dd
2 changed files with 35 additions and 4 deletions

View File

@@ -1,3 +1,14 @@
2008-07-16 Till Straumann <strauman@slac.stanford.edu>
* 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).
2008-07-16 Till Straumann <strauman@slac.stanford.edu>
* new-exceptions/cpu.c: propagate R2 to all task contexts

View File

@@ -350,14 +350,34 @@ void ppc_exc_initialize(
uint32_t interrupt_stack_end = 0;
uint32_t interrupt_stack_pointer = 0;
uint32_t *p = NULL;
uint32_t r13, sda_base;
/* Ensure proper interrupt stack alignment */
interrupt_stack_start &= ~(CPU_STACK_ALIGNMENT - 1);
interrupt_stack_size &= ~(CPU_STACK_ALIGNMENT - 1);
/* Assembly code needs SDA_BASE in r13 (SVR4 or EABI). Make sure
* early init code put it there.
*/
asm volatile(
" lis %0, _SDA_BASE_@h \n"
" ori %0, %0, _SDA_BASE_@l \n"
" mr %1, 13 \n"
:"=r"(sda_base),"=r"(r13)
);
if ( sda_base != r13 ) {
printk("ppc_exc_initialize(): INTERNAL ERROR\n");
printk(" your BSP seems to not have loaded _SDA_BASE_\n");
printk(" into R13 as required by SVR4/EABI. Check early init code...\n");
printk(" _SDA_BASE_: 0x%08x, R13: 0x%08x\n", sda_base, r13);
while (1)
;
}
/* Interrupt stack end and pointer */
interrupt_stack_end = interrupt_stack_start + interrupt_stack_size;
interrupt_stack_pointer = interrupt_stack_end - PPC_MINIMUM_STACK_FRAME_SIZE;
interrupt_stack_pointer = interrupt_stack_end - PPC_MINIMUM_STACK_FRAME_SIZE;
/* Ensure proper interrupt stack alignment */
interrupt_stack_pointer &= ~(CPU_STACK_ALIGNMENT - 1);
/* Tag interrupt stack bottom */
p = (uint32_t *) interrupt_stack_pointer;