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
Line 
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
29#include <abi/asmtool.h>
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))
47
48 /* Information request tag */
49 .align 8
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
54 .long MULTIBOOT2_TAG_CMDLINE
55 .long MULTIBOOT2_TAG_MODULE
56 .long MULTIBOOT2_TAG_MEMMAP
57#ifdef CONFIG_FB
58 .long MULTIBOOT2_TAG_FBINFO
59#endif
60 tag_info_req_end:
61
62 /* Flags tag */
63 .align 8
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:
70
71#ifdef CONFIG_FB
72 /* Framebuffer tag */
73 .align 8
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:
82#endif
83
84 /* Module alignment tag */
85 .align 8
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:
92
93 /* Tag terminator */
94 .align 8
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.