summaryrefslogtreecommitdiff
path: root/arch/x86/machine/boot.h
blob: 03e934ce4eb2b8b69abd920eafe3fc53b9f381ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * Copyright (c) 2010, 2012 Richard Braun.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _X86_BOOT_H
#define _X86_BOOT_H

/*
 * The kernel is physically loaded at BOOT_OFFSET by the boot loader. It
 * will quickly establish the necessary mappings to run at KERNEL_OFFSET.
 *
 * See the linker script for more information.
 */
#define BOOT_OFFSET     0x00100000

#ifdef __LP64__
#define KERNEL_OFFSET   0xffffffff80000000
#else /* __LP64__ */
#define KERNEL_OFFSET   0xc0000000
#endif /* __LP64__ */

/*
 * Size of the stack used to bootstrap the kernel.
 */
#define BOOT_STACK_SIZE 4096

/*
 * Address where the MP trampoline code is copied and run at.
 *
 * It must reside at a free location in the first segment and be page
 * aligned.
 */
#define BOOT_MP_TRAMPOLINE_ADDR 0x7000

#ifndef __ASSEMBLY__

#include <lib/macros.h>

/*
 * Virtual to physical address translation macro.
 */
#define BOOT_VTOP(addr) ((unsigned long)(addr) - KERNEL_OFFSET)

/*
 * Functions and data used before paging is enabled must be part of the .boot
 * and .bootdata sections respectively, so that they use physical addresses.
 * Once paging is enabled, their access relies on the kernel identity mapping.
 */
#define __boot __section(".boot")
#define __bootdata __section(".bootdata")

/*
 * Boundaries of the .boot section.
 */
extern char _boot;
extern char _eboot;

/*
 * Size of the trampoline code used for APs.
 */
extern unsigned long boot_ap_size;

/*
 * Address of the MP trampoline code.
 */
void boot_ap_start(void);

#endif /* __ASSEMBLY__ */

#endif /* _X86_BOOT_H */