annotate kernel/arch/qemu_vexpress/startup_a9.asm @ 381:6df89163e114

Fix section and ldr pseudo instruction
author Windel Bouwman
date Sat, 26 Apr 2014 17:41:56 +0200
parents kernel/startup_a9.asm@9667d78ba79e
children d056b552d3f4
rev   line source
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents:
diff changeset
1
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
2 section code
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:
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
5 ivt_reset: B start ; 0x0 reset
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
6 ivt_undef: B undef_handler ; 0x4 undefined instruction
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
7 ivt_svc: B undef_handler ; 0x08 Supervisor call
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
8 ivt_prefetch: B undef_handler ; 0x0C prefetch abort
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
9 ivt_data: B undef_handler ; 0x10 data abort
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
10 ivt_hyptrap: B undef_handler ; 0x14 not used
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
11 ivt_irq: B undef_handler ; 0x18 IRQ
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
12 ivt_fiq: B undef_handler ; 0x18 FIQ
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
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
28 ; Enable the VMSA (Virtual memory system architecture):
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
29 mrc p15, 0, r0, c1, c0, 0
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
30 ; TODO:
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
31 ; orr r0, r0, 0x1
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
32 mcr p15, 0, r0, c1, c0, 0
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
33
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
34 ; Setup stack:
352
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 340
diff changeset
35 mov sp, 0x30000
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 340
diff changeset
36 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
37 local_loop:
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 340
diff changeset
38 B local_loop
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
39
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
40
375
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
41 ; Interrupt handlers:
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
42
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
43 undef_handler:
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
44 B undef_handler
19eacf4f7270 Started on memory manager
Windel Bouwman
parents: 367
diff changeset
45
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
46
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
47 ; Assembly language helpers:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
48 ; Called to identify the proc:
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
49 arch_pfr0:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
50 mrc p15, 0, r0, c0, c1, 0
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
51 mov pc, lr
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
52
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
53 arch_pfr1:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
54 mrc p15, 0, r0, c0, c1, 1
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
55 mov pc, lr
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
56
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
57 arch_mmfr0:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
58 mrc p15, 0, r0, c0, c1, 4
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
59 mov pc, lr
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
60
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
61
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
62 arch_mpuir:
362
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
63 mrc p15, 0, r0, c0, c0, 4
c05ab629976a Added CPUID for arm
Windel Bouwman
parents: 352
diff changeset
64 mov pc, lr
381
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
65
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
66
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
67 ; Memory map tables:
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
68
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
69 section mem_tables
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
70
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
71 kernel_table0:
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
72 dcd 0x000402
6df89163e114 Fix section and ldr pseudo instruction
Windel Bouwman
parents: 377
diff changeset
73