18
19 #include <sys/types.h>
20 #include <sys/param.h>
21 #include <sys/elf.h>
22 #include <sys/atag.h>
23 #include <sys/sysmacros.h>
24 #include <sys/machparam.h>
25
26 #include <vm/pte.h>
27
28 /*
29 * This is the stock ARM fake uniboot loader.
30 *
31 * Here's what we have to do:
32 * o Read the atag header and find the combined archive header
33 * o Determine the set of mappings we need to add for the following:
34 * - unix
35 * - boot_archive
36 * - atags
37 * o Enable unaligned access
38 * o Enable the caches + virtual memory
39 *
40 * There are several important constraints that we have here:
41 *
42 * o We cannot use any .data! Several loaders that come before us are broken
43 * and only provide us with the ability to map our .text and potentially our
44 * .bss. We should strive to avoid even that if we can.
45 */
46
47 #ifdef DEBUG
48 #define FAKELOAD_DPRINTF(x) fakeload_puts(x)
49 #else
50 #define FAKELOAD_DPRINTF(x)
51 #endif /* DEBUG */
52
53 /*
54 * XXX ASSUMES WE HAVE Free memory following the boot archive
55 */
56 static uintptr_t freemem;
57 static uintptr_t pt_arena;
58 static uintptr_t pt_arena_max;
685 aisp->ais_pt_arena_max = pt_arena_max;
686
687 /* Cache disable */
688 FAKELOAD_DPRINTF("Flushing and disabling caches\n");
689 armv6_dcache_flush();
690 armv6_dcache_disable();
691 armv6_dcache_inval();
692 armv6_icache_disable();
693 armv6_icache_inval();
694
695 /* Program the page tables */
696 FAKELOAD_DPRINTF("programming cp15 regs\n");
697 fakeload_pt_setup((uintptr_t)pt_addr);
698
699
700 /* MMU Enable */
701 FAKELOAD_DPRINTF("see you on the other side\n");
702 fakeload_mmu_enable();
703
704 FAKELOAD_DPRINTF("why helo thar\n");
705
706 /* Renable caches */
707 armv6_dcache_enable();
708 armv6_icache_enable();
709
710 /* we should never come back */
711 fakeload_exec(ident, ident2, chain, unix_start);
712 fakeload_panic("hit the end of the world\n");
713 }
|
18
19 #include <sys/types.h>
20 #include <sys/param.h>
21 #include <sys/elf.h>
22 #include <sys/atag.h>
23 #include <sys/sysmacros.h>
24 #include <sys/machparam.h>
25
26 #include <vm/pte.h>
27
28 /*
29 * This is the stock ARM fake uniboot loader.
30 *
31 * Here's what we have to do:
32 * o Read the atag header and find the combined archive header
33 * o Determine the set of mappings we need to add for the following:
34 * - unix
35 * - boot_archive
36 * - atags
37 * o Enable unaligned access
38 * o Enable virtual memory
39 *
40 * There are several important constraints that we have here:
41 *
42 * o We cannot use any .data! Several loaders that come before us are broken
43 * and only provide us with the ability to map our .text and potentially our
44 * .bss. We should strive to avoid even that if we can.
45 */
46
47 #ifdef DEBUG
48 #define FAKELOAD_DPRINTF(x) fakeload_puts(x)
49 #else
50 #define FAKELOAD_DPRINTF(x)
51 #endif /* DEBUG */
52
53 /*
54 * XXX ASSUMES WE HAVE Free memory following the boot archive
55 */
56 static uintptr_t freemem;
57 static uintptr_t pt_arena;
58 static uintptr_t pt_arena_max;
685 aisp->ais_pt_arena_max = pt_arena_max;
686
687 /* Cache disable */
688 FAKELOAD_DPRINTF("Flushing and disabling caches\n");
689 armv6_dcache_flush();
690 armv6_dcache_disable();
691 armv6_dcache_inval();
692 armv6_icache_disable();
693 armv6_icache_inval();
694
695 /* Program the page tables */
696 FAKELOAD_DPRINTF("programming cp15 regs\n");
697 fakeload_pt_setup((uintptr_t)pt_addr);
698
699
700 /* MMU Enable */
701 FAKELOAD_DPRINTF("see you on the other side\n");
702 fakeload_mmu_enable();
703
704 FAKELOAD_DPRINTF("why helo thar\n");
705
706 /* we should never come back */
707 fakeload_exec(ident, ident2, chain, unix_start);
708 fakeload_panic("hit the end of the world\n");
709 }
|