summaryrefslogtreecommitdiff
path: root/arch/x86/machine/boot.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/machine/boot.h')
-rw-r--r--arch/x86/machine/boot.h68
1 files changed, 63 insertions, 5 deletions
diff --git a/arch/x86/machine/boot.h b/arch/x86/machine/boot.h
index 69b8f5a2..4c7efb54 100644
--- a/arch/x86/machine/boot.h
+++ b/arch/x86/machine/boot.h
@@ -19,6 +19,7 @@
#define _X86_BOOT_H
#include <lib/macros.h>
+#include <machine/param.h>
/*
* The kernel is physically loaded at BOOT_OFFSET by the boot loader. It
@@ -31,13 +32,13 @@
#ifdef __LP64__
#define KERNEL_OFFSET DECL_CONST(0xffffffff80000000, UL)
#else /* __LP64__ */
-#define KERNEL_OFFSET DECL_CONST(0xc0000000, UL)
+#define KERNEL_OFFSET VM_MAX_ADDRESS
#endif /* __LP64__ */
/*
* Size of the stack used to bootstrap the kernel.
*/
-#define BOOT_STACK_SIZE 4096
+#define BOOT_STACK_SIZE PAGE_SIZE
/*
* Address where the MP trampoline code is copied and run at.
@@ -49,7 +50,9 @@
#ifndef __ASSEMBLY__
-#include <lib/macros.h>
+#include <lib/stdint.h>
+#include <machine/multiboot.h>
+#include <machine/pmap.h>
/*
* Virtual to physical address translation macro.
@@ -71,14 +74,69 @@ extern char _boot;
extern char _eboot;
/*
+ * Stack used to bootstrap the kernel.
+ */
+extern char boot_stack[BOOT_STACK_SIZE];
+
+/*
+ * Common stack used by APs to bootstrap.
+ */
+extern char boot_ap_stack[BOOT_STACK_SIZE];
+
+/*
+ * This variable contains the CPU ID of an AP during its early boot.
+ */
+extern unsigned long boot_ap_id;
+
+/*
+ * After its early boot, an AP enables paging and jumps to virtual
+ * addresses. At this point, it switches to a per-AP preallocated
+ * stack. This variable contains the (virtual) address of that stack.
+ */
+extern unsigned long boot_ap_stack_addr;
+
+/*
* Size of the trampoline code used for APs.
*/
-extern unsigned long boot_ap_size;
+extern unsigned long boot_mp_trampoline_size;
/*
* Address of the MP trampoline code.
*/
-void boot_ap_start(void);
+void boot_mp_trampoline(void);
+
+/*
+ * Print the given message and halt the system immediately.
+ *
+ * This function allows early initialization code to print something helpful
+ * before printk is available.
+ */
+void __noreturn boot_panic(const char *s);
+
+/*
+ * This function is called by the bootstrap code before paging is enabled.
+ * It establishes a direct mapping of the kernel at virtual addresses and
+ * returns the physical address of the page directory. It is up to the
+ * caller to actually enable paging.
+ */
+pmap_pte_t * boot_setup_paging(uint32_t eax, const struct multiboot_info *mbi);
+
+/*
+ * This function is called by the AP bootstrap code before paging is enabled.
+ * It merely returns the physical address of the already existing kernel page
+ * directory.
+ */
+pmap_pte_t * boot_ap_setup_paging(void);
+
+/*
+ * Main entry point, called directly after basic paging is initialized.
+ */
+void boot_main(void);
+
+/*
+ * Entry point for APs.
+ */
+void boot_ap(void);
#endif /* __ASSEMBLY__ */