aboutsummaryrefslogtreecommitdiff
path: root/src/boot/trampoline.cc
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-04-28 10:46:36 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-04-28 10:46:36 +0200
commit152f14654bfb438d074833e3c8d5392d300f5095 (patch)
tree633e4dad7153a1d01f7f24b8fd0386c6fe7848ca /src/boot/trampoline.cc
parentf13b26eeb4f9afba3a1aed2516655b34139979aa (diff)
Debug trampoline and paging
Diffstat (limited to 'src/boot/trampoline.cc')
-rw-r--r--src/boot/trampoline.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/boot/trampoline.cc b/src/boot/trampoline.cc
index b03bd43..a75b472 100644
--- a/src/boot/trampoline.cc
+++ b/src/boot/trampoline.cc
@@ -10,6 +10,10 @@
/// @brief Define where first PAE paging paging will be
u64 trampoline_next_page;
+/// @brief Ensure
+#define MAX_MB_INFOS 4096
+u8 mb_infos[MAX_MB_INFOS];
+
u64 trampoline_paging_allocate_table(){
for(u64 i=0;i<512;i++)
((u64*)trampoline_next_page)[i]=0;
@@ -63,7 +67,12 @@ void trampoline_paging_allocate_addr(u64* pml4_table, u64 virt, u64 phy, u16 opt
/**
* Setup High-Half Kernel Paging
*/
-extern "C" void trampoline(){
+extern "C" u8* trampoline(u8* mb_infos_addr){
+ // Save mb infos before anything else
+ for(int i=0;i<MAX_MB_INFOS;i++){
+ mb_infos[i]=mb_infos_addr[i];
+ }
+
u64 kernel_vma,stack_pma;
asm("movq $__kernel_vma, %0":"=r"(kernel_vma));
asm("movq $__userspace_pma, %0":"=r"(trampoline_next_page));
@@ -91,4 +100,6 @@ extern "C" void trampoline(){
"movq %0, %%rax \n\t"
"movq %%rax, %%cr3 \n\t"
:: "r" (pml4));
+
+ return mb_infos;
} \ No newline at end of file