annotate experiments/qemu_vexpress_a9/startup.s @ 388:e07c2a9abac1

Enabled paging in kernel
author Windel Bouwman
date Fri, 02 May 2014 14:51:46 +0200
parents 34ac19044b8a
children b1daa462ee17
rev   line source
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
1
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
2 .section .init
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
3
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
4 .global _Reset;
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
5 _Reset:
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
6
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
7 _start:
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
8 LDR sp, =stack_top
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
9
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
10 ldr r2, =0x10009000
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
11
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
12 mov r1, #'1'
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
13 str r1, [r2]
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
14
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
15 // Load TTBR0 and TTBR1
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
16 ldr r0, =kernel_table0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
17 mcr p15, 0, r0, c2, c0, 1
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
18 mcr p15, 0, r0, c2, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
19
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
20 // Domain 0:
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
21 mov r0, #3
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
22 mcr p15, 0, r0, c3, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
23
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
24 # ; Enable paging:
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
25 mrc p15, 0, r0, c1, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
26 orr r0, r0, #1
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
27 mcr p15, 0, r0, c1, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
28
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
29 // Change uart DR pointer (now located at 0x109000:
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
30 ldr r2, =0x109000
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
31 mov r1, #'2'
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
32 str r1, [r2]
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
33
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
34 BL start
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
35 B .
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
36
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
37 .section .padata
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
38
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
39 /*
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
40 Maybe the kernel is loaded at 0x60000000, so we need to map that to first
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
41 megabyte also...
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
42 */
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
43
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
44 kernel_table0:
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
45 .long 0x00000000 + 0x402 // 0x00000000 # ; Identity map first 1 MB
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
46 .long 0x10000000 + 0x402 // 0x00100000 # ; second mb mapping to peripherals
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
47
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
48 .rept 0x600 - 2
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
49 .long 0x0
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
50 .endr
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
51 .long 0x00000402 // 0x60000000 maps 1 MB to first MB
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
52 .rept 0x1000 - 0x601
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
53 .long 0x0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
54 .endr
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
55