source: mainline/kernel/arch/ia32/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.1 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/pm.h>
32#include <arch/cpuid.h>
33#include <genarch/multiboot/multiboot2.h>
34
35.section K_TEXT_START, "ax"
36
37.code32
38
39.align 8
40multiboot2_header_start:
41 .long MULTIBOOT2_HEADER_MAGIC
42 .long MULTIBOOT2_HEADER_ARCH_I386
43 .long multiboot2_header_end - multiboot2_header_start
44 .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
45
46 /* Information request tag */
47 .align 8
48 tag_info_req_start:
49 .word MULTIBOOT2_TAG_INFO_REQ
50 .word MULTIBOOT2_FLAGS_REQUIRED
51 .long tag_info_req_end - tag_info_req_start
52 .long MULTIBOOT2_TAG_CMDLINE
53 .long MULTIBOOT2_TAG_MODULE
54 .long MULTIBOOT2_TAG_MEMMAP
55#ifdef CONFIG_FB
56 .long MULTIBOOT2_TAG_FBINFO
57#endif
58 tag_info_req_end:
59
60 /* Flags tag */
61 .align 8
62 tag_flags_start:
63 .word MULTIBOOT2_TAG_FLAGS
64 .word MULTIBOOT2_FLAGS_REQUIRED
65 .long tag_flags_end - tag_flags_start
66 .long MULTIBOOT2_FLAGS_CONSOLE
67 tag_flags_end:
68
69#ifdef CONFIG_FB
70 /* Framebuffer tag */
71 .align 8
72 tag_framebuffer_start:
73 .word MULTIBOOT2_TAG_FRAMEBUFFER
74 .word MULTIBOOT2_FLAGS_REQUIRED
75 .long tag_framebuffer_end - tag_framebuffer_start
76 .long CONFIG_BFB_WIDTH
77 .long CONFIG_BFB_HEIGHT
78 .long CONFIG_BFB_BPP
79 tag_framebuffer_end:
80#endif
81
82 /* Module alignment tag */
83 .align 8
84 tag_module_align_start:
85 .word MULTIBOOT2_TAG_MODULE_ALIGN
86 .word MULTIBOOT2_FLAGS_REQUIRED
87 .long tag_module_align_end - tag_module_align_start
88 .long 0
89 tag_module_align_end:
90
91 /* Tag terminator */
92 .align 8
93 tag_terminator_start:
94 .word MULTIBOOT2_TAG_TERMINATOR
95 .word MULTIBOOT2_FLAGS_REQUIRED
96 .long tag_terminator_end - tag_terminator_start
97 tag_terminator_end:
98multiboot2_header_end:
Note: See TracBrowser for help on using the repository browser.