source: mainline/kernel/arch/amd64/src/boot/multiboot2.S@ 2214382

Last change on this file since 2214382 was 2214382, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 7 years ago

Fix x86 linker scripts and make multiboot load using ELF metadata

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[1f5c9c96]1/*
2 * Copyright (c) 2011 Martin Decky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
[3b0f1b9a]29#include <abi/asmtool.h>
[1f5c9c96]30#include <arch/boot/boot.h>
31#include <arch/mm/page.h>
32#include <arch/pm.h>
33#include <arch/cpuid.h>
34#include <arch/cpu.h>
35#include <genarch/multiboot/multiboot2.h>
36
37.section K_TEXT_START, "ax"
38
39.code32
40
41.align 8
42multiboot2_header_start:
43 .long MULTIBOOT2_HEADER_MAGIC
44 .long MULTIBOOT2_HEADER_ARCH_I386
45 .long multiboot2_header_end - multiboot2_header_start
46 .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
[a35b458]47
[1f5c9c96]48 /* Information request tag */
[cfb1217]49 .align 8
[1f5c9c96]50 tag_info_req_start:
51 .word MULTIBOOT2_TAG_INFO_REQ
52 .word MULTIBOOT2_FLAGS_REQUIRED
53 .long tag_info_req_end - tag_info_req_start
[9ef1fade]54 .long MULTIBOOT2_TAG_CMDLINE
[1f5c9c96]55 .long MULTIBOOT2_TAG_MODULE
56 .long MULTIBOOT2_TAG_MEMMAP
[40898df]57#ifdef CONFIG_FB
[1f5c9c96]58 .long MULTIBOOT2_TAG_FBINFO
[40898df]59#endif
[1f5c9c96]60 tag_info_req_end:
[a35b458]61
[1f5c9c96]62 /* Flags tag */
[cfb1217]63 .align 8
[1f5c9c96]64 tag_flags_start:
65 .word MULTIBOOT2_TAG_FLAGS
66 .word MULTIBOOT2_FLAGS_REQUIRED
67 .long tag_flags_end - tag_flags_start
68 .long MULTIBOOT2_FLAGS_CONSOLE
69 tag_flags_end:
[a35b458]70
[40898df]71#ifdef CONFIG_FB
[1f5c9c96]72 /* Framebuffer tag */
[cfb1217]73 .align 8
[1f5c9c96]74 tag_framebuffer_start:
75 .word MULTIBOOT2_TAG_FRAMEBUFFER
76 .word MULTIBOOT2_FLAGS_REQUIRED
77 .long tag_framebuffer_end - tag_framebuffer_start
78 .long CONFIG_BFB_WIDTH
79 .long CONFIG_BFB_HEIGHT
80 .long CONFIG_BFB_BPP
81 tag_framebuffer_end:
[40898df]82#endif
[a35b458]83
[1f5c9c96]84 /* Module alignment tag */
[cfb1217]85 .align 8
[1f5c9c96]86 tag_module_align_start:
87 .word MULTIBOOT2_TAG_MODULE_ALIGN
88 .word MULTIBOOT2_FLAGS_REQUIRED
89 .long tag_module_align_end - tag_module_align_start
90 .long 0
91 tag_module_align_end:
[a35b458]92
[1f5c9c96]93 /* Tag terminator */
[cfb1217]94 .align 8
[1f5c9c96]95 tag_terminator_start:
96 .word MULTIBOOT2_TAG_TERMINATOR
97 .word MULTIBOOT2_FLAGS_REQUIRED
98 .long tag_terminator_end - tag_terminator_start
99 tag_terminator_end:
100multiboot2_header_end:
Note: See TracBrowser for help on using the repository browser.