summaryrefslogtreecommitdiff
path: root/src/arch/amd64/shim.c
blob: 5639aabb200542950b38a2219077b1a443848c6b (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
#include <serial.h>
#include <cpuid.h>
#include <lib.h>
#include <shim.h>
#include <memory.h>

#include "paging.h"
#include "mboot.h"
#include "idt.h"
static struct boot_info boot_info;

void* amd64_shim(void *mboot_data_ptr) {
	serial_init();
	paging_init();
	idt_init();

	kmap_page(mboot_data_ptr, mboot_data_ptr, F_WRITEABLE);
	
	struct mboot_info mboot_info;
	mboot_info = mboot_load_info(mboot_data_ptr);

	struct mboot_tag *map_tag;
	map_tag = mboot_get_tag(&mboot_info, MBOOT_MEMORYMAP);

	boot_info.map = map_tag->data.memory_map;
	
	return &boot_info;
}