diff --git a/sortix/include/sortix/kernel/memorymanagement.h b/sortix/include/sortix/kernel/memorymanagement.h index 0e02a1c0..a5f801e3 100644 --- a/sortix/include/sortix/kernel/memorymanagement.h +++ b/sortix/include/sortix/kernel/memorymanagement.h @@ -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); diff --git a/sortix/x64/memorymanagement.cpp b/sortix/x64/memorymanagement.cpp index 61d53f9f..cf95d501 100644 --- a/sortix/x64/memorymanagement.cpp +++ b/sortix/x64/memorymanagement.cpp @@ -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 . + You should have received a copy of the GNU General Public License along with + Sortix. If not, see . memorymanagement.cpp Handles memory for the x64 architecture. -******************************************************************************/ +*******************************************************************************/ #include #include diff --git a/sortix/x86-family/memorymanagement.cpp b/sortix/x86-family/memorymanagement.cpp index e8a6ef1e..f85e552f 100644 --- a/sortix/x86-family/memorymanagement.cpp +++ b/sortix/x86-family/memorymanagement.cpp @@ -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. diff --git a/sortix/x86/memorymanagement.cpp b/sortix/x86/memorymanagement.cpp index 55aecf09..f531a605 100644 --- a/sortix/x86/memorymanagement.cpp +++ b/sortix/x86/memorymanagement.cpp @@ -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 . + You should have received a copy of the GNU General Public License along with + Sortix. If not, see . memorymanagement.cpp Handles memory for the x86 architecture. -******************************************************************************/ +*******************************************************************************/ #include #include