annotate experiments/qemu_vexpress_a9/startup.s @ 407:9eb1fc6aad6c

Minor improvements
author Windel Bouwman
date Fri, 20 Feb 2015 15:47:54 +0100
parents b1daa462ee17
children
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
406
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
10 ldr r2, =0x10009000
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
11 mov r1, #'1'
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
12 str r1, [r2]
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
13
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
14 // Load TTBR0 and TTBR1
406
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
15 ldr r0, =kernel_table0
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
16 mcr p15, 0, r0, c2, c0, 1
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
17 mcr p15, 0, r0, c2, c0, 0
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
18
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
19 // Domain 0:
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
20 mov r0, #3
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
21 mcr p15, 0, r0, c3, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
22
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
23 # ; Enable paging:
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
24 mrc p15, 0, r0, c1, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
25 orr r0, r0, #1
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
26 mcr p15, 0, r0, c1, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
27
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
28 // Change uart DR pointer (now located at 0x109000:
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
29 ldr r2, =0x109000
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
30 mov r1, #'2'
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
31 str r1, [r2]
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
32
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
33 BL start
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
34 B .
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
35
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
36 .section .padata
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
37
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
38 /*
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
39 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
40 megabyte also...
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
41 */
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
42
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
43 kernel_table0:
406
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
44 .long 0x00000402 // 0x00000000 # ; Identity map first 1 MB
b1daa462ee17 Made kernel run again
Windel Bouwman
parents: 387
diff changeset
45 .long 0x10000402 // 0x00100000 # ; second mb mapping to peripherals
387
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
46 .rept 0x600 - 2
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
47 .long 0x0
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
48 .endr
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
49 .long 0x00000402 // 0x60000000 maps 1 MB to first MB
34ac19044b8a Hello world with paging in emulator
Windel Bouwman
parents: 386
diff changeset
50 .rept 0x1000 - 0x601
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
51 .long 0x0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
52 .endr
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 340
diff changeset
53