Hack on the loader
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 31 Dec 2016 01:34:31 +0000 (17:34 -0800)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 31 Dec 2016 01:34:31 +0000 (17:34 -0800)
arm_chainloader/boot.s
arm_chainloader/loader.cc

index cef40cd..345ed4e 100644 (file)
@@ -14,4 +14,7 @@ However, it's kind of ugly to do it in inline asm.. so here
 .globl boot_linux
 boot_linux:
     /* jump to kernel */
-    mov pc, r3
+    // mov pc, r3
+    //bx r3
+    ldr r3, =0x2000000
+    blx r3
index a4f6098..420e7e3 100644 (file)
@@ -31,6 +31,7 @@ FATFS g_BootVolumeFs;
 #define KERNEL_LOAD_ADDRESS 0x2000000
 
 extern "C" {
+        void flush_cache();
        void boot_linux(int zero, int machineID, void* dtb, void* kernel);
 }
 
@@ -139,11 +140,23 @@ struct LoaderImpl {
                /* read the kernel -- necessarily at fixed address */
                uint8_t* zImage = reinterpret_cast<uint8_t*>(KERNEL_LOAD_ADDRESS);
 
-               if(!read_file("zImage", zImage, false)) {
+               if(!read_file("zImage", zImage, sz, false)) {
                        panic("error reading zImage");
                }
 
                logf("zImage loaded at 0x%X\n", (unsigned int)zImage);
+
+                logf("First few of zImage.. %X%X%X%X\n", zImage[0], zImage[1], zImage[2], zImage[3]);
+
+                /* flush the cache */
+                logf("Flushing....\n")
+                //flush_cache();
+                //__builtin___clear_cache(zImage, zImage + sz);
+                for (uint8_t* i = zImage; i < zImage + sz; i += 32) {
+                    __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,1" : : "r" (i) : "memory");
+                }
+
+                /* fire away */
                logf("Jumping to the Linux kernel...\n");
                
                /* this should never return */
This page took 0.024272 seconds and 4 git commands to generate.