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

#include "mboot.h"

static struct boot_info boot_info;

// entry point for amd64
void* amd64_shim(void *mboot_data_ptr) {
	//struct pml4e *pml4 = (struct pml4e *)0x1000;
	//struct pdpte *pdpt = (struct pdpte *)0x2000;
	//struct pde   *pd   = (struct pde   *)0x3000;
	//struct pte   *pt   = (struct pte   *)0x4000;
	//pd[1].flags = F_PRESENT | F_WRITEABLE;
	//pd[1].address = ((uint64_t)pt) >> 12;
	//map_page(pml4, (void *)0x80000000, (void *)0xB8002, F_WRITEABLE);
	//__asm("invlpg 0x200000");
	//void *ret;
	//find_phys_addr(pml4, (void *)0x80000000, &ret);
	//return ret;
	
	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;
}