/* * Condition at the entry of _stext: * * BSC has already been initialized. * INTC may or may not be initialized. * VBR may or may not be initialized. * MMU may or may not be initialized. * Cache may or may not be initialized. * Hardware (including on-chip modules) may or may not be initialized. *
*/
ENTRY(_stext) ! Initialize Status Register
mov.l 1f, r0 ! MD=1, RB=0, BL=0, IMASK=0xF
ldc r0, sr ! Initialize global interrupt mask
#ifdef CONFIG_CPU_HAS_SR_RB
mov #0, r0
ldc r0, r6_bank
#endif
#ifdef CONFIG_OF_EARLY_FLATTREE
mov r4, r12 ! Store device tree blob pointer in r12
#endif
/* * Prefetch if possible to reduce cache miss penalty. * * We do this early on for SH-4A as a micro-optimization, * as later on we will have speculative execution enabled * and this will become less of an issue.
*/
PREFI(5f, r0)
PREFI(6f, r0)
#ifdef CONFIG_PMB /* * Reconfigure the initial PMB mappings setup by the hardware. * * When we boot in 32-bit MMU mode there are 2 PMB entries already * setup for us. * * Entry VPN PPN V SZ C UB WT * --------------------------------------------------------------- * 0 0x80000000 0x00000000 1 512MB 1 0 1 * 1 0xA0000000 0x00000000 1 512MB 0 0 0 * * But we reprogram them here because we want complete control over * our address space and the initial mappings may not map PAGE_OFFSET * to __MEMORY_START (or even map all of our RAM). * * Once we've setup cached and uncached mappings we clear the rest of the * PMB entries. This clearing also deals with the fact that PMB entries * can persist across reboots. The PMB could have been left in any state * when the reboot occurred, so to be safe we clear all entries and start * with with a clean slate. * * The uncached mapping is constructed using the smallest possible * mapping with a single unbufferable page. Only the kernel text needs to * be covered via the uncached mapping so that certain functions can be * run uncached. * * Drivers and the like that have previously abused the 1:1 identity * mapping are unsupported in 32-bit mode and must specify their caching * preference when page tables are constructed. * * This frees up the P2 space for more nefarious purposes. * * Register utilization is as follows: * * r0 = PMB_DATA data field * r1 = PMB_DATA address field * r2 = PMB_ADDR data field * r3 = PMB_ADDR address field * r4 = PMB_E_SHIFT * r5 = remaining amount of RAM to map * r6 = PMB mapping size we're trying to use * r7 = cached_to_uncached * r8 = scratch register * r9 = scratch register * r10 = number of PMB entries we've setup * r11 = scratch register
*/
mov.l .LMMUCR, r1 /* Flush the TLB */
mov.l @r1, r0
or #MMUCR_TI, r0
mov.l r0, @r1
/* * First we need to walk the PMB and figure out if there are any * existing mappings that match the initial mappings VPN/PPN. * If these have already been established by the bootloader, we * don't bother setting up new entries here, and let the late PMB * initialization take care of things instead. * * Note that we may need to coalesce and merge entries in order * to reclaim more available PMB slots, which is much more than * we want to do at this early stage.
*/
mov #0, r10
mov #NR_PMB_ENTRIES, r9
#ifdef CONFIG_UNCACHED_MAPPING /* * Now that we can access it, update cached_to_uncached and * uncached_size.
*/
mov.l .Lcached_to_uncached, r0
mov.l r7, @r0
/* * Clear the remaining PMB entries. * * r3 = entry to begin clearing from * r10 = number of entries we've setup so far
*/
mov #0, r1
mov #NR_PMB_ENTRIES, r0
.Lagain:
mov.l r1, @r3 /* Clear PMB_ADDR entry */
add #1, r10 /* Increment the loop counter */
cmp/eq r0, r10
bf/s .Lagain
add r4, r3 /* Increment to the next PMB_ADDR entry */
mov.l 6f, r0
icbi @r0
.Lpmb_done:
#endif /* CONFIG_PMB */
#ifndef CONFIG_SH_NO_BSS_INIT /* * Don't clear BSS if running on slow platforms such as an RTL simulation, * remote memory via SHdebug link, etc. For these the memory can be guaranteed * to be all zero on boot anyway.
*/ ! Clear BSS area
#ifdef CONFIG_SMP
mov.l 3f, r0
cmp/eq #0, r0 ! skip clear if set to zero
bt 10f
#endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.