Rev 1052 | Rev 1291 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1052 | Rev 1063 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (C) 2005 Ondrej Palkovsky |
2 | # Copyright (C) 2005 Ondrej Palkovsky |
3 | # Copyright (C) 2006 Martin Decky |
3 | # Copyright (C) 2006 Martin Decky |
4 | # All rights reserved. |
4 | # All rights reserved. |
5 | # |
5 | # |
6 | # Redistribution and use in source and binary forms, with or without |
6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions |
7 | # modification, are permitted provided that the following conditions |
8 | # are met: |
8 | # are met: |
9 | # |
9 | # |
10 | # - Redistributions of source code must retain the above copyright |
10 | # - Redistributions of source code must retain the above copyright |
11 | # notice, this list of conditions and the following disclaimer. |
11 | # notice, this list of conditions and the following disclaimer. |
12 | # - Redistributions in binary form must reproduce the above copyright |
12 | # - Redistributions in binary form must reproduce the above copyright |
13 | # notice, this list of conditions and the following disclaimer in the |
13 | # notice, this list of conditions and the following disclaimer in the |
14 | # documentation and/or other materials provided with the distribution. |
14 | # documentation and/or other materials provided with the distribution. |
15 | # - The name of the author may not be used to endorse or promote products |
15 | # - The name of the author may not be used to endorse or promote products |
16 | # derived from this software without specific prior written permission. |
16 | # derived from this software without specific prior written permission. |
17 | # |
17 | # |
18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
20 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
21 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
22 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
23 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | # |
28 | # |
29 | 29 | ||
30 | #include <arch/boot/boot.h> |
30 | #include <arch/boot/boot.h> |
31 | #include <arch/boot/memmap.h> |
31 | #include <arch/boot/memmap.h> |
32 | #include <arch/mm/page.h> |
32 | #include <arch/mm/page.h> |
33 | #include <arch/mm/ptl.h> |
33 | #include <arch/mm/ptl.h> |
34 | #include <arch/pm.h> |
34 | #include <arch/pm.h> |
35 | #include <arch/cpu.h> |
35 | #include <arch/cpu.h> |
36 | #include <arch/cpuid.h> |
36 | #include <arch/cpuid.h> |
37 | 37 | ||
38 | #define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE) |
38 | #define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE) |
39 | 39 | ||
40 | .section K_TEXT_START, "ax" |
40 | .section K_TEXT_START, "ax" |
41 | 41 | ||
42 | .code32 |
42 | .code32 |
43 | .align 4 |
43 | .align 4 |
44 | .global multiboot_image_start |
44 | .global multiboot_image_start |
45 | multiboot_header: |
45 | multiboot_header: |
46 | .long MULTIBOOT_HEADER_MAGIC |
46 | .long MULTIBOOT_HEADER_MAGIC |
47 | .long MULTIBOOT_HEADER_FLAGS |
47 | .long MULTIBOOT_HEADER_FLAGS |
48 | .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) # checksum |
48 | .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) # checksum |
49 | .long multiboot_header |
49 | .long multiboot_header |
50 | .long unmapped_ktext_start |
50 | .long unmapped_ktext_start |
51 | .long 0 |
51 | .long 0 |
52 | .long 0 |
52 | .long 0 |
53 | .long multiboot_image_start |
53 | .long multiboot_image_start |
54 | 54 | ||
55 | multiboot_image_start: |
55 | multiboot_image_start: |
56 | movl $START_STACK, %esp # initialize stack pointer |
56 | movl $START_STACK, %esp # initialize stack pointer |
57 | lgdt bootstrap_gdtr # initialize Global Descriptor Table register |
57 | lgdt bootstrap_gdtr # initialize Global Descriptor Table register |
58 | 58 | ||
59 | movw $gdtselector(KDATA_DES), %cx |
59 | movw $gdtselector(KDATA_DES), %cx |
60 | movw %cx, %es |
60 | movw %cx, %es |
61 | movw %cx, %ds # kernel data + stack |
61 | movw %cx, %ds # kernel data + stack |
62 | movw %cx, %ss |
62 | movw %cx, %ss |
63 | # Simics seems to remove hidden part of GS on entering user mode |
63 | # Simics seems to remove hidden part of GS on entering user mode |
64 | # when _visible_ part of GS does not point to user-mode segment |
64 | # when _visible_ part of GS does not point to user-mode segment |
65 | movw $gdtselector(UDATA_DES), %cx |
65 | movw $gdtselector(UDATA_DES), %cx |
66 | movw %cx, %fs |
66 | movw %cx, %fs |
67 | movw %cx, %gs |
67 | movw %cx, %gs |
68 | 68 | ||
69 | jmpl $gdtselector(KTEXT32_DES), $multiboot_meeting_point |
69 | jmpl $gdtselector(KTEXT32_DES), $multiboot_meeting_point |
70 | multiboot_meeting_point: |
70 | multiboot_meeting_point: |
71 | 71 | ||
72 | movl %eax, grub_eax # save parameters from GRUB |
72 | movl %eax, grub_eax # save parameters from GRUB |
73 | movl %ebx, grub_ebx |
73 | movl %ebx, grub_ebx |
74 | 74 | ||
75 | # Protected 32-bit. We want to reuse the code-seg descriptor, |
75 | # Protected 32-bit. We want to reuse the code-seg descriptor, |
76 | # the Default operand size must not be 1 when entering long mode |
76 | # the Default operand size must not be 1 when entering long mode |
77 | 77 | ||
78 | movl $0x80000000, %eax |
78 | movl $0x80000000, %eax |
79 | cpuid |
79 | cpuid |
80 | cmp $0x80000000, %eax # any function > 80000000h? |
80 | cmp $0x80000000, %eax # any function > 80000000h? |
81 | jbe long_mode_unsupported |
81 | jbe long_mode_unsupported |
82 | movl $(AMD_CPUID_EXTENDED), %eax # Extended function code 80000001 |
82 | movl $(AMD_CPUID_EXTENDED), %eax # Extended function code 80000001 |
83 | cpuid |
83 | cpuid |
84 | bt $29, %edx # Test if long mode is supported. |
84 | bt $29, %edx # Test if long mode is supported. |
85 | jc long_mode_supported |
85 | jc long_mode_supported |
86 | 86 | ||
87 | long_mode_unsupported: |
87 | long_mode_unsupported: |
88 | cli |
88 | cli |
89 | hlt |
89 | hlt |
90 | 90 | ||
91 | long_mode_supported: |
91 | long_mode_supported: |
92 | 92 | ||
93 | # Enable 64-bit page transaltion entries - CR4.PAE = 1. |
93 | # Enable 64-bit page transaltion entries - CR4.PAE = 1. |
94 | # Paging is not enabled until after long mode is enabled |
94 | # Paging is not enabled until after long mode is enabled |
95 | 95 | ||
96 | movl %cr4, %eax |
96 | movl %cr4, %eax |
97 | btsl $5, %eax |
97 | btsl $5, %eax |
98 | movl %eax, %cr4 |
98 | movl %eax, %cr4 |
99 | 99 | ||
100 | # Set up paging tables |
100 | # Set up paging tables |
101 | 101 | ||
102 | leal ptl_0, %eax |
102 | leal ptl_0, %eax |
103 | movl %eax, %cr3 |
103 | movl %eax, %cr3 |
104 | 104 | ||
105 | # Enable long mode |
105 | # Enable long mode |
106 | 106 | ||
107 | movl $EFER_MSR_NUM, %ecx # EFER MSR number |
107 | movl $EFER_MSR_NUM, %ecx # EFER MSR number |
108 | rdmsr # Read EFER |
108 | rdmsr # Read EFER |
109 | btsl $AMD_LME_FLAG, %eax # Set LME=1 |
109 | btsl $AMD_LME_FLAG, %eax # Set LME=1 |
110 | wrmsr # Write EFER |
110 | wrmsr # Write EFER |
111 | 111 | ||
112 | # Enable paging to activate long mode (set CR0.PG=1) |
112 | # Enable paging to activate long mode (set CR0.PG=1) |
113 | 113 | ||
114 | movl %cr0, %eax |
114 | movl %cr0, %eax |
115 | btsl $31, %eax |
115 | btsl $31, %eax |
116 | movl %eax, %cr0 |
116 | movl %eax, %cr0 |
117 | 117 | ||
118 | # At this point we are in compatibility mode |
118 | # At this point we are in compatibility mode |
119 | 119 | ||
120 | jmpl $gdtselector(KTEXT_DES), $start64 |
120 | jmpl $gdtselector(KTEXT_DES), $start64 |
121 | 121 | ||
122 | .code64 |
122 | .code64 |
123 | start64: |
123 | start64: |
124 | movq $(PA2KA(START_STACK)), %rsp |
124 | movq $(PA2KA(START_STACK)), %rsp |
125 | movl grub_eax, %eax |
125 | movl grub_eax, %eax |
126 | movl grub_ebx, %ebx |
126 | movl grub_ebx, %ebx |
127 | 127 | ||
128 | cmpl $MULTIBOOT_LOADER_MAGIC, %eax # compare GRUB signature |
128 | cmpl $MULTIBOOT_LOADER_MAGIC, %eax # compare GRUB signature |
129 | je valid_boot |
129 | je valid_boot |
130 | 130 | ||
131 | xorl %ecx, %ecx # no memory size or map available |
131 | xorl %ecx, %ecx # no memory size or map available |
132 | movl %ecx, e801memorysize |
132 | movl %ecx, e801memorysize |
133 | movl %ecx, e820counter |
133 | movl %ecx, e820counter |
134 | 134 | ||
135 | jmp invalid_boot |
135 | jmp invalid_boot |
136 | 136 | ||
137 | valid_boot: |
137 | valid_boot: |
138 | 138 | ||
139 | movl (%ebx), %eax # ebx = physical address of struct multiboot_info |
139 | movl (%ebx), %eax # ebx = physical address of struct multiboot_info |
140 | 140 | ||
141 | bt $0, %eax # mbi->flags[0] (mem_lower, mem_upper valid) |
141 | bt $0, %eax # mbi->flags[0] (mem_lower, mem_upper valid) |
142 | jc mem_valid |
142 | jc mem_valid |
143 | 143 | ||
144 | xorl %ecx, %ecx |
144 | xorl %ecx, %ecx |
145 | jmp mem_invalid |
145 | jmp mem_invalid |
146 | 146 | ||
147 | mem_valid: |
147 | mem_valid: |
148 | movl 4(%ebx), %ecx # mbi->mem_lower |
148 | movl 4(%ebx), %ecx # mbi->mem_lower |
149 | addl 8(%ebx), %ecx # mbi->mem_upper |
149 | addl 8(%ebx), %ecx # mbi->mem_upper |
150 | 150 | ||
151 | mem_invalid: |
151 | mem_invalid: |
152 | movl %ecx, e801memorysize |
152 | movl %ecx, e801memorysize |
153 | 153 | ||
154 | bt $3, %eax # mbi->flags[3] (mods_count, mods_addr valid) |
154 | bt $3, %eax # mbi->flags[3] (mods_count, mods_addr valid) |
155 | jc mods_valid |
155 | jc mods_valid |
156 | 156 | ||
157 | xorq %rcx, %rcx |
157 | xorq %rcx, %rcx |
158 | movq %rcx, init |
158 | movq %rcx, init |
159 | jmp mods_end |
159 | jmp mods_end |
160 | 160 | ||
161 | mods_valid: |
161 | mods_valid: |
162 | 162 | ||
163 | xorq %rcx, %rcx |
163 | xorq %rcx, %rcx |
164 | movl 20(%ebx), %ecx # mbi->mods_count |
164 | movl 20(%ebx), %ecx # mbi->mods_count |
165 | movq %rcx, init |
165 | movq %rcx, init |
166 | 166 | ||
167 | cmpl $0, %ecx |
167 | cmpl $0, %ecx |
168 | je mods_end |
168 | je mods_end |
169 | 169 | ||
170 | movl 24(%ebx), %esi # mbi->mods_addr |
170 | movl 24(%ebx), %esi # mbi->mods_addr |
171 | movq $init, %rdi |
171 | movq $init, %rdi |
172 | 172 | ||
173 | mods_loop: |
173 | mods_loop: |
174 | 174 | ||
175 | xorq %rdx, %rdx |
175 | xorq %rdx, %rdx |
176 | movl 0(%esi), %edx # mods->mod_start |
176 | movl 0(%esi), %edx # mods->mod_start |
177 | addq $0xffffffff80000000, %rdx |
177 | movq $0xffff800000000000, %r10 |
- | 178 | addq %r10, %rdx |
|
178 | movq %rdx, 8(%rdi) |
179 | movq %rdx, 8(%rdi) |
179 | 180 | ||
180 | xorq %rdx, %rdx |
181 | xorq %rdx, %rdx |
181 | movl 4(%esi), %edx |
182 | movl 4(%esi), %edx |
182 | subl 0(%esi), %edx # mods->mod_end - mods->mod_start |
183 | subl 0(%esi), %edx # mods->mod_end - mods->mod_start |
183 | movq %rdx, 16(%rdi) |
184 | movq %rdx, 16(%rdi) |
184 | 185 | ||
185 | addl $16, %esi |
186 | addl $16, %esi |
186 | addq $16, %rdi |
187 | addq $16, %rdi |
187 | 188 | ||
188 | loop mods_loop |
189 | loop mods_loop |
189 | 190 | ||
190 | mods_end: |
191 | mods_end: |
191 | 192 | ||
192 | bt $6, %eax # mbi->flags[6] (mmap_length, mmap_addr valid) |
193 | bt $6, %eax # mbi->flags[6] (mmap_length, mmap_addr valid) |
193 | jc mmap_valid |
194 | jc mmap_valid |
194 | 195 | ||
195 | xorl %edx, %edx |
196 | xorl %edx, %edx |
196 | jmp mmap_invalid |
197 | jmp mmap_invalid |
197 | 198 | ||
198 | mmap_valid: |
199 | mmap_valid: |
199 | movl 44(%ebx), %ecx # mbi->mmap_length |
200 | movl 44(%ebx), %ecx # mbi->mmap_length |
200 | movl 48(%ebx), %esi # mbi->mmap_addr |
201 | movl 48(%ebx), %esi # mbi->mmap_addr |
201 | movq $e820table, %rdi |
202 | movq $e820table, %rdi |
202 | xorl %edx, %edx |
203 | xorl %edx, %edx |
203 | 204 | ||
204 | mmap_loop: |
205 | mmap_loop: |
205 | cmpl $0, %ecx |
206 | cmpl $0, %ecx |
206 | jle mmap_end |
207 | jle mmap_end |
207 | 208 | ||
208 | movl 4(%esi), %eax # mmap->base_addr_low |
209 | movl 4(%esi), %eax # mmap->base_addr_low |
209 | movl %eax, (%rdi) |
210 | movl %eax, (%rdi) |
210 | 211 | ||
211 | movl 8(%esi), %eax # mmap->base_addr_high |
212 | movl 8(%esi), %eax # mmap->base_addr_high |
212 | movl %eax, 4(%rdi) |
213 | movl %eax, 4(%rdi) |
213 | 214 | ||
214 | movl 12(%esi), %eax # mmap->length_low |
215 | movl 12(%esi), %eax # mmap->length_low |
215 | movl %eax, 8(%rdi) |
216 | movl %eax, 8(%rdi) |
216 | 217 | ||
217 | movl 16(%esi), %eax # mmap->length_high |
218 | movl 16(%esi), %eax # mmap->length_high |
218 | movl %eax, 12(%rdi) |
219 | movl %eax, 12(%rdi) |
219 | 220 | ||
220 | movl 20(%esi), %eax # mmap->type |
221 | movl 20(%esi), %eax # mmap->type |
221 | movl %eax, 16(%rdi) |
222 | movl %eax, 16(%rdi) |
222 | 223 | ||
223 | movl (%esi), %eax # mmap->size |
224 | movl (%esi), %eax # mmap->size |
224 | addl $0x4, %eax |
225 | addl $0x4, %eax |
225 | addl %eax, %esi |
226 | addl %eax, %esi |
226 | subl %eax, %ecx |
227 | subl %eax, %ecx |
227 | addq $MEMMAP_E820_RECORD_SIZE, %rdi |
228 | addq $MEMMAP_E820_RECORD_SIZE, %rdi |
228 | incl %edx |
229 | incl %edx |
229 | jmp mmap_loop |
230 | jmp mmap_loop |
230 | 231 | ||
231 | mmap_end: |
232 | mmap_end: |
232 | 233 | ||
233 | mmap_invalid: |
234 | mmap_invalid: |
234 | movl %edx, e820counter |
235 | movl %edx, e820counter |
235 | 236 | ||
236 | invalid_boot: |
237 | invalid_boot: |
237 | 238 | ||
238 | #ifdef CONFIG_SMP |
239 | #ifdef CONFIG_SMP |
239 | 240 | ||
240 | # copy AP bootstrap routines below 1 MB |
241 | # copy AP bootstrap routines below 1 MB |
241 | 242 | ||
242 | movq $BOOT_OFFSET, %rsi |
243 | movq $BOOT_OFFSET, %rsi |
243 | movq $AP_BOOT_OFFSET, %rdi |
244 | movq $AP_BOOT_OFFSET, %rdi |
244 | movq $_hardcoded_unmapped_size, %rcx |
245 | movq $_hardcoded_unmapped_size, %rcx |
245 | cld |
246 | cld |
246 | rep movsb |
247 | rep movsb |
247 | 248 | ||
248 | #endif |
249 | #endif |
249 | 250 | ||
250 | call main_bsp # never returns |
251 | call main_bsp # never returns |
251 | 252 | ||
252 | cli |
253 | cli |
253 | hlt |
254 | hlt |
254 | 255 | ||
255 | .section K_DATA_START, "aw", @progbits |
256 | .section K_DATA_START, "aw", @progbits |
256 | .align 4096 |
257 | .align 4096 |
257 | 258 | ||
258 | # Identical mapping of first 64MB and the same of -2GB -> 0 |
259 | # Identical mapping of first 64MB and the same of -2GB -> 0 |
259 | .global ptl_2 |
260 | .global ptl_2 |
260 | ptl_2: |
261 | ptl_2: |
261 | .quad 0x0 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
262 | .quad 0x0 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
262 | .quad 0x200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
263 | .quad 0x200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
263 | .quad 0x400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
264 | .quad 0x400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
264 | .quad 0x600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
265 | .quad 0x600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
265 | .quad 0x800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
266 | .quad 0x800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
266 | .quad 0xa00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
267 | .quad 0xa00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
267 | .quad 0xc00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
268 | .quad 0xc00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
268 | .quad 0xe00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
269 | .quad 0xe00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
269 | .quad 0x1000000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
270 | .quad 0x1000000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
270 | .quad 0x1200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
271 | .quad 0x1200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
271 | .quad 0x1400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
272 | .quad 0x1400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
272 | .quad 0x1600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
273 | .quad 0x1600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
273 | .quad 0x1800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
274 | .quad 0x1800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
274 | .quad 0x1a00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
275 | .quad 0x1a00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
275 | .quad 0x1c00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
276 | .quad 0x1c00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
276 | .quad 0x1e00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
277 | .quad 0x1e00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
277 | .quad 0x2000000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
278 | .quad 0x2000000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
278 | .quad 0x2200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
279 | .quad 0x2200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
279 | .quad 0x2400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
280 | .quad 0x2400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
280 | .quad 0x2600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
281 | .quad 0x2600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
281 | .quad 0x2800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
282 | .quad 0x2800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
282 | .quad 0x2a00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
283 | .quad 0x2a00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
283 | .quad 0x2c00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
284 | .quad 0x2c00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
284 | .quad 0x2e00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
285 | .quad 0x2e00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
285 | .quad 0x3000000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
286 | .quad 0x3000000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
286 | .quad 0x3200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
287 | .quad 0x3200000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
287 | .quad 0x3400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
288 | .quad 0x3400000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
288 | .quad 0x3600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
289 | .quad 0x3600000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
289 | .quad 0x3800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
290 | .quad 0x3800000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
290 | .quad 0x3a00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
291 | .quad 0x3a00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
291 | .quad 0x3c00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
292 | .quad 0x3c00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
292 | .quad 0x3e00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
293 | .quad 0x3e00000 | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE) |
293 | 294 | ||
294 | .align 4096 |
295 | .align 4096 |
295 | .global ptl_1 |
296 | .global ptl_1 |
296 | ptl_1: |
297 | ptl_1: |
297 | .quad ptl_2 + (PTL_WRITABLE | PTL_PRESENT) |
298 | .quad ptl_2 + (PTL_WRITABLE | PTL_PRESENT) |
298 | .fill 509,8,0 |
299 | .fill 509,8,0 |
299 | .quad ptl_2 + (PTL_WRITABLE | PTL_PRESENT) |
300 | .quad ptl_2 + (PTL_WRITABLE | PTL_PRESENT) |
300 | .fill 1,8,0 |
301 | .fill 1,8,0 |
301 | 302 | ||
302 | .align 4096 |
303 | .align 4096 |
303 | .global ptl_0 |
304 | .global ptl_0 |
304 | ptl_0: |
305 | ptl_0: |
305 | .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT) |
306 | .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT) |
306 | .fill 510,8,0 |
307 | .fill 255,8,0 |
- | 308 | .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT) |
|
- | 309 | .fill 254,8,0 |
|
307 | .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT) |
310 | .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT) |
308 | 311 | ||
309 | .global bootstrap_gdtr |
312 | .global bootstrap_gdtr |
310 | bootstrap_gdtr: |
313 | bootstrap_gdtr: |
311 | .word gdtselector(GDT_ITEMS) |
314 | .word gdtselector(GDT_ITEMS) |
312 | .long KA2PA(gdt) |
315 | .long KA2PA(gdt) |
313 | 316 | ||
314 | grub_eax: |
317 | grub_eax: |
315 | .long 0 |
318 | .long 0 |
316 | 319 | ||
317 | grub_ebx: |
320 | grub_ebx: |
318 | .long 0 |
321 | .long 0 |
319 | 322 |