comparison 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
comparison
equal deleted inserted replaced
386:2a970e7270e2 387:34ac19044b8a
1 1
2 .section .init 2 .section .init
3 3
4 .global _Reset; 4 .global _Reset;
5 _Reset: 5 _Reset:
6
7 _start:
6 LDR sp, =stack_top 8 LDR sp, =stack_top
7 9
8 ldr r2, =0x10009000 10 ldr r2, =0x10009000
9 11
10 mov r1, #'1' 12 mov r1, #'1'
11 str r1, [r2] 13 str r1, [r2]
12 14
15 // Load TTBR0 and TTBR1
13 ldr r0, =kernel_table0 16 ldr r0, =kernel_table0
14 mcr p15, 0, r0, c2, c0, 1 17 mcr p15, 0, r0, c2, c0, 1
15 mcr p15, 0, r0, c2, c0, 0 18 mcr p15, 0, r0, c2, c0, 0
16 19
17 mov r1, #'2' 20 // Domain 0:
18 str r1, [r2]
19
20 mov r1, #'3'
21 str r1, [r2]
22
23 mov r0, #3 21 mov r0, #3
24 mcr p15, 0, r0, c3, c0, 0 22 mcr p15, 0, r0, c3, c0, 0
25 23
26 mov r1, #'4' 24 # ; Enable paging:
27 str r1, [r2]
28
29 mrc p15, 0, r0, c1, c0, 0 25 mrc p15, 0, r0, c1, c0, 0
30 orr r0, r0, #1 26 orr r0, r0, #1
31 mcr p15, 0, r0, c1, c0, 0 27 mcr p15, 0, r0, c1, c0, 0
32 28
33 mov r1, #'5' 29 // Change uart DR pointer (now located at 0x109000:
30 ldr r2, =0x109000
31 mov r1, #'2'
34 str r1, [r2] 32 str r1, [r2]
35
36 33
37 BL start 34 BL start
38 B . 35 B .
39 36
40
41
42 .section .padata 37 .section .padata
43 38
39 /*
40 Maybe the kernel is loaded at 0x60000000, so we need to map that to first
41 megabyte also...
42 */
43
44 kernel_table0: 44 kernel_table0:
45 .long 0x0402 45 .long 0x00000000 + 0x402 // 0x00000000 # ; Identity map first 1 MB
46 .rept 0xFFF 46 .long 0x10000000 + 0x402 // 0x00100000 # ; second mb mapping to peripherals
47
48 .rept 0x600 - 2
49 .long 0x0
50 .endr
51 .long 0x00000402 // 0x60000000 maps 1 MB to first MB
52 .rept 0x1000 - 0x601
47 .long 0x0 53 .long 0x0
48 .endr 54 .endr
49 55
50 .rept 0xFFF
51 .long 0x0
52 .endr
53