source: mainline/kernel/arch/amd64/src/boot/multiboot.S@ 76d0981d

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 76d0981d was a35b458, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 7 years ago

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

  • Property mode set to 100644
File size: 14.8 KB
RevLine 
[873c681]1/*
2 * Copyright (c) 2005 Ondrej Palkovsky
3 * Copyright (c) 2006 Martin Decky
4 * Copyright (c) 2008 Jakub Jermar
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * - The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
[1141c1a]30
[3b0f1b9a]31#include <abi/asmtool.h>
[46d26ee]32#include <arch/boot/boot.h>
[a1f60f3]33#include <arch/mm/page.h>
[6f878b7]34#include <arch/mm/ptl.h>
[8fc0d455]35#include <arch/pm.h>
[1f5c9c96]36#include <genarch/multiboot/multiboot.h>
[c4b3e3e]37#include <arch/cpuid.h>
[1f5c9c96]38#include <arch/cpu.h>
[1141c1a]39
[873c681]40#define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE)
[421c833]41
[874e312a]42.section K_TEXT_START, "ax"
[46d26ee]43
[8ccec3c1]44.code32
[873c681]45
46.macro pm_error msg
47 movl \msg, %esi
48 jmp pm_error_halt
49.endm
50
51.macro pm_status msg
52#ifdef CONFIG_EGA
53 pushl %esi
54 movl \msg, %esi
55 call pm_early_puts
56 popl %esi
57#endif
58.endm
59
60.macro pm2_status msg
61#ifndef CONFIG_FB
62 pm_status \msg
63#endif
64.endm
65
[8ccec3c1]66.align 4
67multiboot_header:
68 .long MULTIBOOT_HEADER_MAGIC
69 .long MULTIBOOT_HEADER_FLAGS
[873c681]70 .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) /* checksum */
[8725fb4]71 .long multiboot_header
72 .long unmapped_ktext_start
[8ccec3c1]73 .long 0
74 .long 0
[8725fb4]75 .long multiboot_image_start
[8ccec3c1]76
[3b0f1b9a]77SYMBOL(multiboot_image_start)
[f66c203d]78 cli
[e13daa5d]79 cld
[a35b458]80
[873c681]81 /* Initialize stack pointer */
82 movl $START_STACK, %esp
[a35b458]83
[f66c203d]84 /*
85 * Initialize Global Descriptor Table and
86 * Interrupt Descriptor Table registers
87 */
[873c681]88 lgdtl bootstrap_gdtr
[f66c203d]89 lidtl bootstrap_idtr
[a35b458]90
[873c681]91 /* Kernel data + stack */
[1d3d2cf]92 movw $GDT_SELECTOR(KDATA_DES), %cx
[1a67595]93 movw %cx, %es
[873c681]94 movw %cx, %ds
[1a67595]95 movw %cx, %ss
[a35b458]96
[873c681]97 /*
98 * Simics seems to remove hidden part of GS on entering user mode
99 * when _visible_ part of GS does not point to user-mode segment.
100 */
[1d3d2cf]101 movw $GDT_SELECTOR(UDATA_DES), %cx
[65640fef]102 movw %cx, %fs
103 movw %cx, %gs
[a35b458]104
[1d3d2cf]105 jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot_meeting_point
[1a67595]106 multiboot_meeting_point:
[a35b458]107
[1f5c9c96]108 /*
109 * Protected 32-bit. We want to reuse the code-seg descriptor,
110 * the Default operand size must not be 1 when entering long mode.
111 */
[a35b458]112
[1f5c9c96]113 /* Save multiboot arguments */
114 movl %eax, multiboot_eax
115 movl %ebx, multiboot_ebx
[a35b458]116
[873c681]117 pm_status $status_prot
[a35b458]118
[421c833]119 movl $(INTEL_CPUID_EXTENDED), %eax
120 cpuid
121 cmp $(INTEL_CPUID_EXTENDED), %eax
[4fb6bf36]122 ja extended_cpuid_supported
[a35b458]123
[873c681]124 pm_error $err_extended_cpuid
[a35b458]125
[4fb6bf36]126 extended_cpuid_supported:
[a35b458]127
[4fb6bf36]128 movl $(AMD_CPUID_EXTENDED), %eax
[ac88c93]129 cpuid
[4fb6bf36]130 bt $(AMD_EXT_LONG_MODE), %edx
[421c833]131 jc long_mode_supported
[a35b458]132
[873c681]133 pm_error $err_long_mode
[a35b458]134
[ac88c93]135 long_mode_supported:
[a35b458]136
[4fb6bf36]137 bt $(AMD_EXT_NOEXECUTE), %edx
138 jc noexecute_supported
[a35b458]139
[873c681]140 pm_error $err_noexecute
[a35b458]141
[4fb6bf36]142 noexecute_supported:
[a35b458]143
[4fb6bf36]144 movl $(INTEL_CPUID_STANDARD), %eax
145 cpuid
146 bt $(INTEL_FXSAVE), %edx
[421c833]147 jc fx_supported
[a35b458]148
[873c681]149 pm_error $err_fx
[a35b458]150
[4fb6bf36]151 fx_supported:
[a35b458]152
[4fb6bf36]153 bt $(INTEL_SSE2), %edx
[421c833]154 jc sse2_supported
[a35b458]155
[873c681]156 pm_error $err_sse2
[a35b458]157
[4fb6bf36]158 sse2_supported:
[a35b458]159
[421c833]160#include "vesa_prot.inc"
[a35b458]161
[873c681]162 pm2_status $status_prot2
[a35b458]163
[873c681]164 /*
165 * Enable 64-bit page translation entries - CR4.PAE = 1.
166 * Paging is not enabled until after long mode is enabled.
167 */
[a35b458]168
[6f878b7]169 movl %cr4, %eax
[811770c]170 orl $CR4_PAE, %eax
[6f878b7]171 movl %eax, %cr4
[a35b458]172
[873c681]173 /* Set up paging tables */
[6f878b7]174 leal ptl_0, %eax
175 movl %eax, %cr3
[a35b458]176
[873c681]177 /* Enable long mode */
[811770c]178 movl $AMD_MSR_EFER, %ecx
[873c681]179 rdmsr /* read EFER */
[811770c]180 orl $AMD_LME, %eax /* set LME = 1 */
[873c681]181 wrmsr
[a35b458]182
[873c681]183 /* Enable paging to activate long mode (set CR0.PG = 1) */
[6f878b7]184 movl %cr0, %eax
[811770c]185 orl $CR0_PG, %eax
[6f878b7]186 movl %eax, %cr0
[a35b458]187
[873c681]188 /* At this point we are in compatibility mode */
[1d3d2cf]189 jmpl $GDT_SELECTOR(KTEXT_DES), $start64
[c245372b]190
[873c681]191/** Print string to EGA display (in light red) and halt.
192 *
193 * Should be executed from 32 bit protected mode with paging
194 * turned off. Stack is not required. This routine is used even
195 * if CONFIG_EGA is not enabled. Since we are going to halt the
196 * CPU anyway, it is always better to at least try to print
197 * some hints.
198 *
[da52547]199 * @param %esi Pointer to the NULL-terminated string
200 * to be print.
[873c681]201 *
202 */
203pm_error_halt:
204 movl $0xb8000, %edi /* base of EGA text mode memory */
205 xorl %eax, %eax
[a35b458]206
[873c681]207 /* Read bits 8 - 15 of the cursor address */
208 movw $0x3d4, %dx
209 movb $0xe, %al
210 outb %al, %dx
[a35b458]211
[873c681]212 movw $0x3d5, %dx
213 inb %dx, %al
214 shl $8, %ax
[a35b458]215
[873c681]216 /* Read bits 0 - 7 of the cursor address */
217 movw $0x3d4, %dx
218 movb $0xf, %al
219 outb %al, %dx
[a35b458]220
[873c681]221 movw $0x3d5, %dx
222 inb %dx, %al
[a35b458]223
[873c681]224 /* Sanity check for the cursor on screen */
225 cmp $2000, %ax
226 jb err_cursor_ok
[a35b458]227
[873c681]228 movw $1998, %ax
[a35b458]229
[873c681]230 err_cursor_ok:
[a35b458]231
[873c681]232 movw %ax, %bx
233 shl $1, %eax
234 addl %eax, %edi
[a35b458]235
[873c681]236 err_ploop:
237 lodsb
[a35b458]238
[873c681]239 cmp $0, %al
240 je err_ploop_end
[a35b458]241
[873c681]242 movb $0x0c, %ah /* black background, light red foreground */
243 stosw
[a35b458]244
[873c681]245 /* Sanity check for the cursor on the last line */
246 inc %bx
247 cmp $2000, %bx
248 jb err_ploop
[a35b458]249
[873c681]250 /* Scroll the screen (24 rows) */
251 movl %esi, %edx
252 movl $0xb80a0, %esi
253 movl $0xb8000, %edi
[22c3444]254 movl $960, %ecx
255 rep movsl
[a35b458]256
[873c681]257 /* Clear the 24th row */
258 xorl %eax, %eax
[22c3444]259 movl $40, %ecx
260 rep stosl
[a35b458]261
[873c681]262 /* Go to row 24 */
263 movl %edx, %esi
264 movl $0xb8f00, %edi
265 movw $1920, %bx
[a35b458]266
[873c681]267 jmp err_ploop
268 err_ploop_end:
[a35b458]269
[873c681]270 /* Write bits 8 - 15 of the cursor address */
271 movw $0x3d4, %dx
272 movb $0xe, %al
273 outb %al, %dx
[a35b458]274
[873c681]275 movw $0x3d5, %dx
276 movb %bh, %al
277 outb %al, %dx
[a35b458]278
[873c681]279 /* Write bits 0 - 7 of the cursor address */
280 movw $0x3d4, %dx
281 movb $0xf, %al
282 outb %al, %dx
[a35b458]283
[873c681]284 movw $0x3d5, %dx
285 movb %bl, %al
286 outb %al, %dx
[a35b458]287
[873c681]288 cli
289 hlt1:
290 hlt
291 jmp hlt1
292
293/** Print string to EGA display (in light green).
294 *
295 * Should be called from 32 bit protected mode with paging
296 * turned off. A stack space of at least 24 bytes is required,
297 * but the function does not establish a stack frame.
298 *
299 * Macros such as pm_status and pm2_status take care that
300 * this function is used only when CONFIG_EGA is enabled
301 * and CONFIG_FB is disabled.
302 *
[da52547]303 * @param %esi Pointer to the NULL-terminated string
304 * to be print.
[873c681]305 *
306 */
307pm_early_puts:
308 pushl %eax
309 pushl %ebx
310 pushl %ecx
311 pushl %edx
312 pushl %edi
[a35b458]313
[873c681]314 movl $0xb8000, %edi /* base of EGA text mode memory */
315 xorl %eax, %eax
[a35b458]316
[873c681]317 /* Read bits 8 - 15 of the cursor address */
318 movw $0x3d4, %dx
319 movb $0xe, %al
320 outb %al, %dx
[a35b458]321
[873c681]322 movw $0x3d5, %dx
323 inb %dx, %al
324 shl $8, %ax
[a35b458]325
[873c681]326 /* Read bits 0 - 7 of the cursor address */
327 movw $0x3d4, %dx
328 movb $0xf, %al
329 outb %al, %dx
[a35b458]330
[873c681]331 movw $0x3d5, %dx
332 inb %dx, %al
[a35b458]333
[873c681]334 /* Sanity check for the cursor on screen */
335 cmp $2000, %ax
336 jb pm_puts_cursor_ok
[a35b458]337
[873c681]338 movw $1998, %ax
[a35b458]339
[873c681]340 pm_puts_cursor_ok:
[a35b458]341
[873c681]342 movw %ax, %bx
343 shl $1, %eax
344 addl %eax, %edi
[a35b458]345
[873c681]346 pm_puts_ploop:
347 lodsb
[a35b458]348
[873c681]349 cmp $0, %al
350 je pm_puts_ploop_end
[a35b458]351
[873c681]352 movb $0x0a, %ah /* black background, light green foreground */
353 stosw
[a35b458]354
[873c681]355 /* Sanity check for the cursor on the last line */
356 inc %bx
357 cmp $2000, %bx
358 jb pm_puts_ploop
[a35b458]359
[873c681]360 /* Scroll the screen (24 rows) */
361 movl %esi, %edx
362 movl $0xb80a0, %esi
363 movl $0xb8000, %edi
[22c3444]364 movl $960, %ecx
365 rep movsl
[a35b458]366
[873c681]367 /* Clear the 24th row */
368 xorl %eax, %eax
[22c3444]369 movl $40, %ecx
370 rep stosl
[a35b458]371
[873c681]372 /* Go to row 24 */
373 movl %edx, %esi
374 movl $0xb8f00, %edi
375 movw $1920, %bx
[a35b458]376
[873c681]377 jmp pm_puts_ploop
378 pm_puts_ploop_end:
[a35b458]379
[873c681]380 /* Write bits 8 - 15 of the cursor address */
381 movw $0x3d4, %dx
382 movb $0xe, %al
383 outb %al, %dx
[a35b458]384
[873c681]385 movw $0x3d5, %dx
386 movb %bh, %al
387 outb %al, %dx
[a35b458]388
[873c681]389 /* Write bits 0 - 7 of the cursor address */
390 movw $0x3d4, %dx
391 movb $0xf, %al
392 outb %al, %dx
[a35b458]393
[873c681]394 movw $0x3d5, %dx
395 movb %bl, %al
396 outb %al, %dx
[a35b458]397
[873c681]398 popl %edi
399 popl %edx
400 popl %ecx
401 popl %ebx
402 popl %eax
[a35b458]403
[873c681]404 ret
405
[6f878b7]406.code64
[873c681]407
408.macro long_status msg
409 pushq %rdi
410 movq \msg, %rdi
411 call early_puts
412 popq %rdi
413.endm
414
[6f878b7]415start64:
[a35b458]416
[873c681]417 /*
418 * Long mode.
419 */
[a35b458]420
[c4b3e3e]421 movq $(PA2KA(START_STACK)), %rsp
[a35b458]422
[873c681]423 /* Create the first stack frame */
424 pushq $0
425 movq %rsp, %rbp
[a35b458]426
[873c681]427 long_status $status_long
[a35b458]428
[36df4109]429 /* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
[1f5c9c96]430 movl multiboot_eax, %edi
431 movl multiboot_ebx, %esi
[a35b458]432
[4bf0926e]433#ifdef MEMORY_MODEL_large
434 movabsq $amd64_pre_main, %rax
435 callq *%rax
436#else
[36df4109]437 callq amd64_pre_main
[4bf0926e]438#endif
[a35b458]439
[873c681]440 long_status $status_main
[a35b458]441
[873c681]442 /* Call main_bsp() */
[4bf0926e]443#ifdef MEMORY_MODEL_large
444 movabsq $main_bsp, %rax
445 callq *%rax
446#else
447 callq main_bsp
448#endif
[a35b458]449
[873c681]450 /* Not reached */
[421c833]451 cli
452 hlt0:
453 hlt
454 jmp hlt0
[ac88c93]455
[873c681]456/** Print string to EGA display.
457 *
458 * Should be called from long mode (with paging enabled
459 * and stack established). This function is ABI compliant
460 * (without red-zone).
461 *
462 * If CONFIG_EGA is undefined or CONFIG_FB is defined
463 * then this function does nothing.
464 *
[da52547]465 * @param %rdi Pointer to the NULL-terminated string
466 * to be printed.
[873c681]467 *
468 */
469early_puts:
[a35b458]470
[873c681]471#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
[a35b458]472
[873c681]473 /* Prologue, save preserved registers */
474 pushq %rbp
475 movq %rsp, %rbp
476 pushq %rbx
[a35b458]477
[873c681]478 movq %rdi, %rsi
479 movq $(PA2KA(0xb8000)), %rdi /* base of EGA text mode memory */
480 xorq %rax, %rax
[a35b458]481
[873c681]482 /* Read bits 8 - 15 of the cursor address */
483 movw $0x3d4, %dx
[ac88c93]484 movb $0xe, %al
485 outb %al, %dx
[a35b458]486
[ac88c93]487 movw $0x3d5, %dx
488 inb %dx, %al
489 shl $8, %ax
[a35b458]490
[873c681]491 /* Read bits 0 - 7 of the cursor address */
492 movw $0x3d4, %dx
[ac88c93]493 movb $0xf, %al
494 outb %al, %dx
[a35b458]495
[ac88c93]496 movw $0x3d5, %dx
497 inb %dx, %al
[a35b458]498
[873c681]499 /* Sanity check for the cursor on screen */
500 cmp $2000, %ax
501 jb early_puts_cursor_ok
[a35b458]502
[873c681]503 movw $1998, %ax
[a35b458]504
[873c681]505 early_puts_cursor_ok:
[a35b458]506
[ac88c93]507 movw %ax, %bx
[873c681]508 shl $1, %rax
509 addq %rax, %rdi
[a35b458]510
[873c681]511 early_puts_ploop:
[ac88c93]512 lodsb
[a35b458]513
[ac88c93]514 cmp $0, %al
[873c681]515 je early_puts_ploop_end
[a35b458]516
[873c681]517 movb $0x0e, %ah /* black background, yellow foreground */
[ac88c93]518 stosw
[a35b458]519
[873c681]520 /* Sanity check for the cursor on the last line */
[421c833]521 inc %bx
[873c681]522 cmp $2000, %bx
523 jb early_puts_ploop
[a35b458]524
[873c681]525 /* Scroll the screen (24 rows) */
526 movq %rsi, %rdx
527 movq $(PA2KA(0xb80a0)), %rsi
528 movq $(PA2KA(0xb8000)), %rdi
[e80329d6]529 movl $480, %ecx
[22c3444]530 rep movsq
[a35b458]531
[873c681]532 /* Clear the 24th row */
[e80329d6]533 xorl %eax, %eax
534 movl $20, %ecx
[22c3444]535 rep stosq
[a35b458]536
[873c681]537 /* Go to row 24 */
538 movq %rdx, %rsi
539 movq $(PA2KA(0xb8f00)), %rdi
540 movw $1920, %bx
[a35b458]541
[873c681]542 jmp early_puts_ploop
543 early_puts_ploop_end:
[a35b458]544
[873c681]545 /* Write bits 8 - 15 of the cursor address */
546 movw $0x3d4, %dx
[ac88c93]547 movb $0xe, %al
548 outb %al, %dx
[a35b458]549
[ac88c93]550 movw $0x3d5, %dx
551 movb %bh, %al
552 outb %al, %dx
[a35b458]553
[873c681]554 /* Write bits 0 - 7 of the cursor address */
555 movw $0x3d4, %dx
[ac88c93]556 movb $0xf, %al
557 outb %al, %dx
[a35b458]558
[ac88c93]559 movw $0x3d5, %dx
560 movb %bl, %al
561 outb %al, %dx
[a35b458]562
[873c681]563 /* Epilogue, restore preserved registers */
564 popq %rbx
565 leave
[a35b458]566
[873c681]567#endif
[a35b458]568
[873c681]569 ret
[421c833]570
571#include "vesa_real.inc"
[19077a5]572
573.section K_INI_PTLS, "aw", @progbits
574
[873c681]575/** Generate initial page table contents.
576 *
577 * @param cnt Number of entries to generate. Must be multiple of 8.
578 * @param g Number of GB that will be added to the mapping.
579 *
580 */
[a1f60f3]581.macro ptl2gen cnt g
[64f6ef04]582 .if \cnt
583 ptl2gen "\cnt - 8" \g
584 .quad ((\cnt - 8) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
585 .quad ((\cnt - 7) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
586 .quad ((\cnt - 6) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
587 .quad ((\cnt - 5) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
588 .quad ((\cnt - 4) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
589 .quad ((\cnt - 3) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
590 .quad ((\cnt - 2) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
591 .quad ((\cnt - 1) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
592 .endif
[19077a5]593.endm
594
[873c681]595/* Page table for pages in the 1st gigabyte. */
[1141c1a]596.align 4096
[a1f60f3]597ptl_2_0g:
[19077a5]598 ptl2gen 512 0
599
[873c681]600/* Page table for pages in the 2nd gigabyte. */
[19077a5]601.align 4096
602ptl_2_1g:
603 ptl2gen 512 1
604
[873c681]605/* Page table for pages in the 3rd gigabyte. */
[19077a5]606.align 4096
607ptl_2_2g:
608 ptl2gen 512 2
609
[873c681]610/* Page table for pages in the 4th gigabyte. */
[19077a5]611.align 4096
612ptl_2_3g:
613 ptl2gen 512 3
[b9e97fb]614
[873c681]615/* Page table for pages in the 5th gigabyte. */
[64f6ef04]616.align 4096
617ptl_2_4g:
[fef504a]618 ptl2gen 512 4
[64f6ef04]619
[873c681]620/* Page table for pages in the 6th gigabyte. */
[64f6ef04]621.align 4096
622ptl_2_5g:
[fef504a]623 ptl2gen 512 5
[64f6ef04]624
[873c681]625/* Page table for pages in the 7th gigabyte. */
[64f6ef04]626.align 4096
627ptl_2_6g:
[fef504a]628 ptl2gen 512 6
[64f6ef04]629
[873c681]630/* Page table for pages in the 8th gigabyte. */
[64f6ef04]631.align 4096
632ptl_2_7g:
[fef504a]633 ptl2gen 512 7
[64f6ef04]634
[4bf0926e]635#ifdef MEMORY_MODEL_kernel
[6f878b7]636.align 4096
637ptl_1:
[873c681]638 /* Identity mapping for [0; 8G) */
[19077a5]639 .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
[a1f60f3]640 .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
[19077a5]641 .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
642 .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
[64f6ef04]643 .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
644 .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
645 .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
646 .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
[17af882]647 .fill 502, 8, 0
648 /* Mapping of [0; 2G) at -2G */
649 .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
650 .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
651
[6f878b7]652.align 4096
[3b0f1b9a]653SYMBOL(ptl_0)
[6f878b7]654 .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
[17af882]655 .fill 510, 8, 0
[6f878b7]656 .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
[4bf0926e]657#endif
658
659#ifdef MEMORY_MODEL_large
660.align 4096
661ptl_1:
662 /* Identity mapping for [0; 8G) */
663 .quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
664 .quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
665 .quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
666 .quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
667 .quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
668 .quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
669 .quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
670 .quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
671 .fill 504, 8, 0
672
673.align 4096
674SYMBOL(ptl_0)
675 .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
676 .fill 255, 8, 0
677 .quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
678 .fill 255, 8, 0
679#endif
[6f878b7]680
[19077a5]681.section K_DATA_START, "aw", @progbits
682
[3b0f1b9a]683SYMBOL(bootstrap_idtr)
[f66c203d]684 .word 0
685 .long 0
686
[3b0f1b9a]687SYMBOL(bootstrap_gdtr)
[1d3d2cf]688 .word GDT_SELECTOR(GDT_ITEMS)
[1a67595]689 .long KA2PA(gdt)
[46d26ee]690
[3b0f1b9a]691SYMBOL(multiboot_eax)
[46d26ee]692 .long 0
693
[3b0f1b9a]694SYMBOL(multiboot_ebx)
[46d26ee]695 .long 0
[ac88c93]696
[873c681]697err_extended_cpuid:
[fccc236]698 .asciz "Error: Extended CPUID not supported -- CPU is not 64-bit. System halted."
[873c681]699err_long_mode:
[fccc236]700 .asciz "Error: 64-bit long mode not supported. System halted."
[873c681]701err_noexecute:
[fccc236]702 .asciz "Error: No-execute pages not supported. System halted."
[873c681]703err_fx:
[fccc236]704 .asciz "Error: FXSAVE/FXRESTORE instructions not supported. System halted."
[873c681]705err_sse2:
[fccc236]706 .asciz "Error: SSE2 instructions not supported. System halted."
[873c681]707
708status_prot:
709 .asciz "[prot] "
710status_vesa_copy:
711 .asciz "[vesa_copy] "
[1f5c9c96]712status_multiboot_cmdline:
713 .asciz "[multiboot_cmdline] "
[873c681]714status_vesa_real:
715 .asciz "[vesa_real] "
716status_prot2:
717 .asciz "[prot2] "
718status_long:
719 .asciz "[long] "
720status_main:
721 .asciz "[main] "
Note: See TracBrowser for help on using the repository browser.