Line 47... |
Line 47... |
//####OTHERCOPYRIGHTEND####
|
//####OTHERCOPYRIGHTEND####
|
//==========================================================================
|
//==========================================================================
|
//#####DESCRIPTIONBEGIN####
|
//#####DESCRIPTIONBEGIN####
|
//
|
//
|
// Author(s): Piotr Skrzypek
|
// Author(s): Piotr Skrzypek
|
|
// Contributor: R.Diez
|
// Date: 2012-06-08
|
// Date: 2012-06-08
|
// Purpose:
|
// Purpose:
|
// Description: Based on ARM code
|
// Description: Based on ARM code
|
//
|
//
|
// This code is part of RedBoot (tm).
|
// This code is part of RedBoot (tm).
|
Line 169... |
Line 170... |
trampoline = CYGPKG_REDBOOT_OPENRISC_TRAMPOLINE_ADDRESS;
|
trampoline = CYGPKG_REDBOOT_OPENRISC_TRAMPOLINE_ADDRESS;
|
trampoline(base_addr, base_addr + length, target, entry);
|
trampoline(base_addr, base_addr + length, target, entry);
|
|
|
// This code is executed from the trampoline address. Trampoline never returns.
|
// This code is executed from the trampoline address. Trampoline never returns.
|
asm volatile (
|
asm volatile (
|
|
|
|
// All code below must be position independent,
|
|
// as it will run on another memory address.
|
|
// Accorting to ABI:
|
|
// R3 is base_addr
|
|
// R4 is base_addr + length
|
|
// R5 is target
|
|
// R6 is the entry point to jump to at the end
|
|
|
"__tramp_start__:\n"
|
"__tramp_start__:\n"
|
"1: l.sfeq r3, r4\n"
|
"1: l.sfeq r3, r4\n"
|
" l.bf 2f\n"
|
" l.bf 2f\n"
|
" l.lwz r13,0x00(r3)\n"
|
" l.lwz r13,0x00(r3)\n"
|
" l.sw 0x00(r5), r13\n"
|
" l.sw 0x00(r5), r13\n"
|
" l.addi r3, r3, 4\n"
|
" l.addi r3, r3, 4\n"
|
|
#ifdef CYGHWR_BRANCH_SLOT_IMPLEMENTED
|
" l.j 1b\n"
|
" l.j 1b\n"
|
" l.addi r5, r5, 4\n"
|
" l.addi r5, r5, 4\n"
|
|
#else
|
|
" l.addi r5, r5, 4\n"
|
|
" l.j 1b\n"
|
|
#endif
|
"2: l.jr r6\n"
|
"2: l.jr r6\n"
|
|
#ifdef CYGHWR_BRANCH_SLOT_IMPLEMENTED
|
" l.nop\n"
|
" l.nop\n"
|
|
#endif
|
"__tramp_end__:\n"
|
"__tramp_end__:\n"
|
: /* no output registers */
|
: /* no output registers */
|
: /* no input registers */
|
: /* no input registers */
|
: /* no clobbered registers */
|
: /* no clobbered registers */
|
);
|
);
|