URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 39 |
Rev 56 |
Line 18... |
Line 18... |
: "d" (mask));
|
: "d" (mask));
|
}
|
}
|
|
|
#define STACK_ALIGN 64
|
#define STACK_ALIGN 64
|
|
|
__inline static void *
|
__inline static void
|
set_stack (void* ptr)
|
set_stack (void* ptr)
|
{
|
{
|
ptr = (((int)ptr & (STACK_ALIGN-1))==0)
|
ptr = (void *)(((int)ptr + STACK_ALIGN - 1) & ~(STACK_ALIGN - 1));
|
? (void*)((int)ptr & (~(STACK_ALIGN-1)))
|
/* SP must be 64 bytes larger than FP at start. */
|
: (void*)((int)ptr & (~(STACK_ALIGN-1)))+STACK_ALIGN;
|
|
__asm__ volatile ("mov %0,sp"
|
__asm__ volatile ("mov %0,sp"
|
:
|
:
|
: "d" (ptr));
|
: "d" (ptr+STACK_ALIGN));
|
__asm__ volatile ("mov %0,fp"
|
__asm__ volatile ("mov %0,fp"
|
:
|
:
|
: "d" (ptr));
|
: "d" (ptr));
|
return ptr;
|
|
}
|
}
|
|
|
__inline static void
|
__inline static void
|
init_Cregs (void)
|
init_Cregs (void)
|
{
|
{
|
Line 51... |
Line 49... |
}
|
}
|
|
|
void
|
void
|
_start(void)
|
_start(void)
|
{
|
{
|
void *stack;
|
|
char *p;
|
char *p;
|
|
|
enable_tracing ();
|
enable_tracing ();
|
stack = set_stack (&end + 4096);
|
set_stack (&end);
|
init_Cregs ();
|
init_Cregs ();
|
brk (stack);
|
/* The stack grows upwards, so this makes the heap start after a 256K
|
|
stack area. PlumHall known to fail with less than 73K of stack. */
|
|
brk (&end+0x40000);
|
/* clear bss */
|
/* clear bss */
|
memset (&bss_start, 0, &end - &bss_start);
|
memset (&bss_start, 0, &end - &bss_start);
|
main(0, 0, 0);
|
main(0, 0, 0);
|
_exit(0);
|
exit(0);
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.