annotate kernel/arch/qemu_vexpress/start.asm @ 389:2ec730e45ea1

Added check for recursive struct
author Windel Bouwman
date Fri, 16 May 2014 12:29:31 +0200
parents kernel/arch/qemu_vexpress/startup_a9.asm@e07c2a9abac1
children a284749c5729
rev   line source
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
1
385
d056b552d3f4 Made better use of layout
Windel Bouwman
parents: 381
diff changeset
2 section reset
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
3
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
4 interrupt_vector_table:
389
2ec730e45ea1 Added check for recursive struct
Windel Bouwman
parents: 388
diff changeset
5 ivt_reset: B start ; 0x0 reset
2ec730e45ea1 Added check for recursive struct
Windel Bouwman
parents: 388
diff changeset
6 ivt_undef: B undef_handler ; 0x4 undefined instruction
2ec730e45ea1 Added check for recursive struct
Windel Bouwman
parents: 388
diff changeset
7 ivt_svc: B undef_handler ; 0x08 Supervisor call
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
8 ivt_prefetch: B undef_handler ; 0x0C prefetch abort
389
2ec730e45ea1 Added check for recursive struct
Windel Bouwman
parents: 388
diff changeset
9 ivt_data: B undef_handler ; 0x10 data abort
2ec730e45ea1 Added check for recursive struct
Windel Bouwman
parents: 388
diff changeset
10 ivt_hyptrap: B undef_handler ; 0x14 not used
2ec730e45ea1 Added check for recursive struct
Windel Bouwman
parents: 388
diff changeset
11 ivt_irq: B undef_handler ; 0x18 IRQ
2ec730e45ea1 Added check for recursive struct
Windel Bouwman
parents: 388
diff changeset
12 ivt_fiq: B undef_handler ; 0x18 FIQ
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
13
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
14
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
15 start:
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
16
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
17 ; Setup TTBR1 (translation table base register)
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
18
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
19 ldr r0, =kernel_table0 ; pseudo instruction which loads the value of the symbol
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
20 ; -KERNEL_BASE
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
21 mcr p15, 0, r0, c2, c0, 1 ; TTBR1
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
22 mcr p15, 0, r0, c2, c0, 0 ; TTBR0
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
23
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
24 ; Prepare the TTBCR (translation table base control register)
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
25 mov r0, 0x1 ; TBD: why set this to 1?
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
26 mcr p15, 0, r0, c2, c0, 2
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
27
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
28
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
29 ; Set domain 0 to manager:
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
30 mov r0, 3
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
31 mcr p15, 0, r0, c3, c0, 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
32
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
33
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
34 ; Enable the VMSA (Virtual memory system architecture):
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
35 mrc p15, 0, r0, c1, c0, 0
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
36 ; TODO:
388
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
37 mov r1, 0x1
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
38 orr r0, r0, r1 ; TODO: implement orr r0, r0, 1
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
39 mcr p15, 0, r0, c1, c0, 0
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
40
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
41 ; Setup stack:
352
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 340
diff changeset
42 mov sp, 0x30000
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 340
diff changeset
43 BL kernel_start ; Branch to main (this is actually in the interrupt vector)
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 340
diff changeset
44 local_loop:
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 340
diff changeset
45 B local_loop
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
46
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
47
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
48 ; Interrupt handlers:
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
49
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
50 undef_handler:
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
51 B undef_handler
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
52
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
53
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
54 ; Assembly language helpers:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
55 ; Called to identify the proc:
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
56 arch_pfr0:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
57 mrc p15, 0, r0, c0, c1, 0
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
58 mov pc, lr
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
59
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
60 arch_pfr1:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
61 mrc p15, 0, r0, c0, c1, 1
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
62 mov pc, lr
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
63
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
64 arch_mmfr0:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
65 mrc p15, 0, r0, c0, c1, 4
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
66 mov pc, lr
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
67
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
68 arch_mpuir:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
69 mrc p15, 0, r0, c0, c0, 4
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
70 mov pc, lr
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
71
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
72
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
73 ; Memory map tables:
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
74
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
75 section mem_tables
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
76
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
77 kernel_table0:
388
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
78 dcd 0x00000402 ; Identity map first 1 MB
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
79 dcd 0x10000402 ; Map to peripheral space 1 MB
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
80 repeat 0x5FE
386
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
81 dcd 0
2a970e7270e2 Added repeat assembler macro
Windel Bouwman
parents: 385
diff changeset
82 endrepeat
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
83
388
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
84 dcd 0x00000402 ; Alias to 0x0
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
85
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
86 repeat 0x9FF
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
87 dcd 0
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
88 endrepeat
e07c2a9abac1 Enabled paging in kernel
Windel Bouwman
parents: 386
diff changeset
89