Prepare some space for early transfer

This commit is contained in:
Baptiste Wicht 2016-07-31 13:14:13 +02:00
parent 4c87d6386a
commit e2272caf4e
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,21 @@
//=======================================================================
// Copyright Baptiste Wicht 2013-2016.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
/*
* This header contains addresses where the init stage of the kernel writes information for the later stage
*/
#ifndef EARLY_MEMORY_H
#define EARLY_MEMORY_H
// The number of MiB used by the kernel
constexpr const uint32_t kernel_mib = 0x90000; //4 bytes (32 bits)
// The address of the kernel
constexpr const uint32_t kernel_address = 0x100000; //1Mib aligned size (kernel_mib)
#endif

View File

@ -11,6 +11,7 @@
#include "kernel.hpp"
#include "paging.hpp"
#include "early_logging.hpp"
#include "early_memory.hpp"
namespace {
@ -136,6 +137,9 @@ void pm_main(){
//Setup paging
setup_paging();
// TODO This will need to be computed from the init loader
*reinterpret_cast<uint32_t*>(kernel_mib) = 1;
//Enable long mode by setting the EFER.LME flag
enable_long_mode();