add a memory map file to describe the memory layout of the chain loader
authorKristina <tinab@hush.ai>
Wed, 7 Sep 2016 06:55:17 +0000 (07:55 +0100)
committerKristina <tinab@hush.ai>
Wed, 7 Sep 2016 06:55:17 +0000 (07:55 +0100)
arm_chainloader/boot.s
arm_chainloader/chainloader.h
arm_chainloader/main.c
arm_chainloader/memory_map.h [new file with mode: 0644]
arm_chainloader/start.s

index ac6a6ab..cef40cd 100644 (file)
@@ -11,9 +11,7 @@ However, it's kind of ugly to do it in inline asm.. so here
    r3: kernel address
    */
 
-.globl bootLinux
-bootLinux:
-    //cli /* TODO: figure out how to disable interrupts correctly */
-
+.globl boot_linux
+boot_linux:
     /* jump to kernel */
     mov pc, r3
index 14d3c27..05ada30 100644 (file)
@@ -5,6 +5,7 @@
 #include <lib/panic.h>\r
 #include <lib/xprintf.h>\r
 #include <lib/tlsf/tlsf.h>\r
+#include <memory_map.h>\r
 \r
 #ifdef __cplusplus\r
 extern "C" {\r
index 644537b..c3df8d9 100644 (file)
@@ -22,8 +22,8 @@ static void cxx_init() {
 }
 
 static void heap_init() {
-       void* start_of_heap = (void*)&_end;
-       size_t hs = 0x100000;
+       void* start_of_heap = (void*)MEM_HEAP_START;
+       size_t hs = MEM_HEAP_SIZE;
 
        logf("Initializing heap at 0x%x with size 0x%x\n", start_of_heap, hs);
 
@@ -31,16 +31,10 @@ static void heap_init() {
 }
 
 void main() {
-       logf("Started on ARM, continuing boot from here ...\n", __FUNCTION__);
+       logf("Started on ARM, continuing boot from here ...\n");
 
        heap_init();
 
-#if 0
-       /* poke the VPU */
-       logf("\nPoking the VPU....\n");
-       mmio_write32(0x7E00B8A0, 0xA1755A01);
-#endif
-
        /* c++ runtime */
        cxx_init();
 
diff --git a/arm_chainloader/memory_map.h b/arm_chainloader/memory_map.h
new file mode 100644 (file)
index 0000000..07fc05c
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ [ CODE ][ STACK ][    HEAP    ]
+*/
+
+#pragma once
+
+#define MEM_CODE_END 0x20000
+
+#define MEM_STACK_SIZE 0x4000
+#define MEM_STACK_END (MEM_CODE_END + MEM_STACK_SIZE)
+
+#define MEM_HEAP_START MEM_STACK_END
+#define MEM_HEAP_SIZE 0x100000
+#define MEM_HEAP_END (MEM_HEAP_START + MEM_HEAP_SIZE)
+
+#define MEM_USABLE_START MEM_HEAP_END
\ No newline at end of file
index 19d8506..782b138 100644 (file)
@@ -22,6 +22,8 @@ the boot process.
 \r
 =============================================================================*/\r
 \r
+#include "memory_map.h"\r
+\r
 .text\r
 .globl _start\r
 _start:\r
@@ -43,15 +45,15 @@ _start:
 \r
 L_all_cores_start:\r
         /* check CPU id */\r
-       mrc p15, 0, r0, c0, c0, 5       @ read MPIDR
-       and r3, r0, #0xc0000000         @ multiprocessing extensions and
-       teq r3, #0x80000000             @ not part of a uniprocessor system?
-       bne L_core0                     @ no, assume UP
-       ands r0, r0, #0x03              @ CPU 0?
-       bne L_deadloop                  @ if not, spin.
-
+       mrc p15, 0, r0, c0, c0, 5       @ read MPIDR\r
+       and r3, r0, #0xc0000000         @ multiprocessing extensions and\r
+       teq r3, #0x80000000             @ not part of a uniprocessor system?\r
+       bne L_core0                     @ no, assume UP\r
+       ands r0, r0, #0x03              @ CPU 0?\r
+       bne L_deadloop                  @ if not, spin.\r
+\r
 L_core0:\r
-       mov sp, #0x2000000\r
+       mov sp, #(MEM_STACK_END)\r
        b _firmware_rendezvous\r
 \r
 L_deadloop:\r
This page took 0.033264 seconds and 4 git commands to generate.