Merge from amd64 branch:
[reactos.git] / reactos / boot / freeldr / freeldr / arch / arm / boot.s
1 /*
2 * PROJECT: ReactOS Boot Loader
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: boot/freeldr/arch/arm/boot.s
5 * PURPOSE: Implements the entry point for ARM machines
6 * PROGRAMMERS: ReactOS Portable Systems Group
7 */
8
9 .title "ARM FreeLDR Entry Point"
10 .include "ntoskrnl/include/internal/arm/kxarm.h"
11 .include "ntoskrnl/include/internal/arm/ksarm.h"
12
13 NESTED_ENTRY _start
14 PROLOG_END _start
15
16 //
17 // C entrypoint
18 //
19 ldr lr, L_ArmInit
20
21 //
22 // Turn off FIQs and IRQs
23 // FreeLDR runs without interrupts, and without paging, just like on x86
24 //
25 mrs r1, cpsr
26 orr r1, r1, #CPSR_IRQ_DISABLE | CPSR_FIQ_DISABLE
27 msr cpsr, r1
28
29 //
30 // Turn off caches and the MMU
31 //
32 mrc p15, 0, r1, c1, c0, 0
33 bic r1, r1, #C1_DCACHE_CONTROL
34 bic r1, r1, #C1_ICACHE_CONTROL
35 bic r1, r1, #C1_MMU_CONTROL
36 mcr p15, 0, r1, c1, c0, 0
37
38 //
39 // Flush everything away
40 //
41 mov r1, #0
42 mcr p15, 0, r1, c7, c7, 0
43
44 //
45 // Okay, now give us a stack
46 //
47 //ldr sp, L_BootStackEnd
48
49 //
50 // Go ahead and call the C initialization code
51 // r0 contains the ARM_BOARD_CONFIGURATION_DATA structure
52 //
53 bx lr
54 ENTRY_END _start
55
56 L_BootStackEnd:
57 .long BootStackEnd
58
59 L_ArmInit:
60 .long ArmInit
61
62 .section pagedata
63 .global TranslationTableStart
64 TranslationTableStart:
65
66 .global ArmTranslationTable
67 ArmTranslationTable:
68 .space 0x4000 // 0x00000000->0xFFFFFFFF
69
70 .global BootTranslationTable
71 BootTranslationTable:
72 .space 0x0400 // 0x00000000->0x800FFFFF
73 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
74 .space 0x0400 // 0x00100000->0x801FFFFF
75 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
76 .space 0x0400 // 0x00200000->0x802FFFFF
77 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
78 .space 0x0400 // 0x00300000->0x803FFFFF
79 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
80 .space 0x0400 // 0x00400000->0x804FFFFF
81 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
82 .space 0x0400 // 0x00500000->0x805FFFFF
83 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
84 .space 0x0400 // 0x00600000->0x806FFFFF
85 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
86 .space 0x0400 // 0x00700000->0x807FFFFF
87 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
88
89 .global KernelTranslationTable
90 KernelTranslationTable:
91 .space 0x0400 // 0x00800000->0x808FFFFF
92 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
93 .space 0x0400 // 0x00900000->0x809FFFFF
94 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
95 .space 0x0400 // 0x00A00000->0x80AFFFFF
96 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
97 .space 0x0400 // 0x00B00000->0x80BFFFFF
98 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
99 .space 0x0400 // 0x00C00000->0x80CFFFFF
100 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
101 .space 0x0400 // 0x00D00000->0x80DFFFFF
102 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
103
104 .global FlatMapTranslationTable
105 FlatMapTranslationTable:
106 .space 0x0400 // 0xYYYYYYYY->0xC00FFFFF
107 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
108 .space 0x0400 // 0xYYYYYYYY->0xC01FFFFF
109 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
110 .space 0x0400 // 0xYYYYYYYY->0xC02FFFFF
111 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
112 .space 0x0400 // 0xYYYYYYYY->0xC03FFFFF
113 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
114 .space 0x0400 // 0xYYYYYYYY->0xC04FFFFF
115 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
116 .space 0x0400 // 0xYYYYYYYY->0xC05FFFFF
117 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
118 .space 0x0400 // 0xYYYYYYYY->0xC06FFFFF
119 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
120 .space 0x0400 // 0xYYYYYYYY->0xC07FFFFF
121 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
122 .space 0x0400 // 0xYYYYYYYY->0xC08FFFFF
123 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
124 .space 0x0400 // 0xYYYYYYYY->0xC09FFFFF
125 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
126 .space 0x0400 // 0xYYYYYYYY->0xC0AFFFFF
127 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
128 .space 0x0400 // 0xYYYYYYYY->0xC0BFFFFF
129 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
130 .space 0x0400 // 0xYYYYYYYY->0xC0CFFFFF
131 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
132 .space 0x0400 // 0xYYYYYYYY->0xC0DFFFFF
133 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
134 .space 0x0400 // 0xYYYYYYYY->0xC0EFFFFF
135 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
136 .space 0x0400 // 0xYYYYYYYY->0xC0FFFFFF
137 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
138
139 .global MasterTranslationTable
140 MasterTranslationTable:
141 .space 0x0400 // 0xYYYYYYYY->0xC10FFFFF
142 .space 0x0C00 // PADDING FOR 4KB GRANULARITY
143
144 .global TranslationTableEnd
145 TranslationTableEnd: