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 InvalidatePage(addr_t addr);
void Flush(); void Flush();
addr_t Fork(); addr_t Fork();
addr_t GetAddressSpace();
addr_t SwitchAddressSpace(addr_t addrspace); addr_t SwitchAddressSpace(addr_t addrspace);
void DestroyAddressSpace(); void DestroyAddressSpace();
bool Map(addr_t physical, addr_t mapto, int prot); 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. This file is part of Sortix.
@ -14,13 +14,13 @@
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along with
with Sortix. If not, see <http://www.gnu.org/licenses/>. Sortix. If not, see <http://www.gnu.org/licenses/>.
memorymanagement.cpp memorymanagement.cpp
Handles memory for the x64 architecture. Handles memory for the x64 architecture.
******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h> #include <libmaxsi/memory.h>

View File

@ -51,7 +51,7 @@ namespace Sortix
namespace Memory namespace Memory
{ {
addr_t currentdir; addr_t currentdir = 0;
void InitCPU(); void InitCPU();
void AllocateKernelPMLs(); void AllocateKernelPMLs();
@ -411,6 +411,11 @@ namespace Sortix
asm volatile("mov %0, %%cr3":: "r"(currentdir)); asm volatile("mov %0, %%cr3":: "r"(currentdir));
} }
addr_t GetAddressSpace()
{
return currentdir;
}
addr_t SwitchAddressSpace(addr_t addrspace) addr_t SwitchAddressSpace(addr_t addrspace)
{ {
// Have fun debugging this. // 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. This file is part of Sortix.
@ -14,13 +14,13 @@
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along with
with Sortix. If not, see <http://www.gnu.org/licenses/>. Sortix. If not, see <http://www.gnu.org/licenses/>.
memorymanagement.cpp memorymanagement.cpp
Handles memory for the x86 architecture. Handles memory for the x86 architecture.
******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h> #include <libmaxsi/memory.h>