Added a function to get the current address space pointer.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-04-09 14:15:40 +02:00
parent d59c0cb3ed
commit ebc0b064c3
4 changed files with 17 additions and 11 deletions

View File

@ -56,6 +56,7 @@ namespace Sortix
void InvalidatePage(addr_t addr);
void Flush();
addr_t Fork();
addr_t GetAddressSpace();
addr_t SwitchAddressSpace(addr_t addrspace);
void DestroyAddressSpace();
bool Map(addr_t physical, addr_t mapto, int prot);

View File

@ -1,6 +1,6 @@
/******************************************************************************
/*******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011, 2012.
This file is part of Sortix.
@ -14,13 +14,13 @@
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along
with Sortix. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License along with
Sortix. If not, see <http://www.gnu.org/licenses/>.
memorymanagement.cpp
Handles memory for the x64 architecture.
******************************************************************************/
*******************************************************************************/
#include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>

View File

@ -51,7 +51,7 @@ namespace Sortix
namespace Memory
{
addr_t currentdir;
addr_t currentdir = 0;
void InitCPU();
void AllocateKernelPMLs();
@ -411,6 +411,11 @@ namespace Sortix
asm volatile("mov %0, %%cr3":: "r"(currentdir));
}
addr_t GetAddressSpace()
{
return currentdir;
}
addr_t SwitchAddressSpace(addr_t addrspace)
{
// Have fun debugging this.

View File

@ -1,6 +1,6 @@
/******************************************************************************
/*******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011, 2012.
This file is part of Sortix.
@ -14,13 +14,13 @@
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along
with Sortix. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU General Public License along with
Sortix. If not, see <http://www.gnu.org/licenses/>.
memorymanagement.cpp
Handles memory for the x86 architecture.
******************************************************************************/
*******************************************************************************/
#include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>