diff experiments/qemu_vexpress_a9/startup.s @ 387:34ac19044b8a

Hello world with paging in emulator
author Windel Bouwman
date Thu, 01 May 2014 22:09:18 +0200
parents 2a970e7270e2
children b1daa462ee17
line wrap: on
line diff
--- a/experiments/qemu_vexpress_a9/startup.s	Thu May 01 17:40:59 2014 +0200
+++ b/experiments/qemu_vexpress_a9/startup.s	Thu May 01 22:09:18 2014 +0200
@@ -3,6 +3,8 @@
 
 .global _Reset;
 _Reset:
+
+_start:
  LDR sp, =stack_top
 
  ldr r2, =0x10009000
@@ -10,44 +12,44 @@
  mov r1, #'1'
  str r1, [r2]
 
+// Load TTBR0 and TTBR1
  ldr r0, =kernel_table0
  mcr p15, 0, r0, c2, c0, 1
  mcr p15, 0, r0, c2, c0, 0
 
- mov r1, #'2'
- str r1, [r2]
-
- mov r1, #'3'
- str r1, [r2]
-
+ // Domain 0:
 mov r0, #3
 mcr p15, 0, r0, c3, c0, 0
 
- mov r1, #'4'
- str r1, [r2]
-
+ # ; Enable paging:
 mrc p15, 0, r0, c1, c0, 0
 orr r0, r0, #1
 mcr p15, 0, r0, c1, c0, 0
 
- mov r1, #'5'
+// Change uart DR pointer (now located at 0x109000:
+ ldr r2, =0x109000
+ mov r1, #'2'
  str r1, [r2]
 
-
  BL start
  B .
 
-
-
 .section .padata
 
+/*
+ Maybe the kernel is loaded at 0x60000000, so we need to map that to first 
+ megabyte also...
+*/
+
 kernel_table0:
- .long 0x0402
- .rept 0xFFF
+ .long 0x00000000 + 0x402 // 0x00000000 # ; Identity map first 1 MB
+ .long 0x10000000 + 0x402 // 0x00100000 # ; second mb mapping to peripherals
+
+ .rept 0x600 - 2
+  .long 0x0
+ .endr
+ .long 0x00000402 // 0x60000000 maps 1 MB to first MB
+ .rept 0x1000 - 0x601
   .long 0x0
  .endr
 
- .rept 0xFFF
-  .long 0x0
- .endr
-