From e78443d92a6006d08ef2d3aebb0698e308dfca6b Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 7 Aug 2011 22:40:34 +0200 Subject: [PATCH] Processes now keep track of where their code section ends. This is very hacky, but allows us to allocate address space. --- sortix/kernel.cpp | 4 +++- sortix/scheduler.cpp | 1 + sortix/scheduler.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sortix/kernel.cpp b/sortix/kernel.cpp index 204ddd66..006a2ef7 100644 --- a/sortix/kernel.cpp +++ b/sortix/kernel.cpp @@ -253,7 +253,7 @@ namespace Sortix if ( initrd != NULL ) { - addr_t loadat = 0x400000UL; + addr_t loadat = process->_endcodesection; for ( size_t i = 0; i < initrdsize; i += 4096 ) { @@ -264,6 +264,8 @@ namespace Sortix Memory::Copy((void*) loadat, initrd, initrdsize); initstart = (Thread::Entry) loadat; + + process->_endcodesection += initrdsize; } if ( Scheduler::CreateThread(process, initstart) == NULL ) diff --git a/sortix/scheduler.cpp b/sortix/scheduler.cpp index c42ae739..99b2aedb 100644 --- a/sortix/scheduler.cpp +++ b/sortix/scheduler.cpp @@ -41,6 +41,7 @@ namespace Sortix Process::Process(addr_t addrspace) { _addrspace = addrspace; + _endcodesection = 0x400000UL; } Process::~Process() diff --git a/sortix/scheduler.h b/sortix/scheduler.h index a4bf18cb..c6e670e6 100644 --- a/sortix/scheduler.h +++ b/sortix/scheduler.h @@ -42,6 +42,9 @@ namespace Sortix addr_t _addrspace; DescriptorTable descriptors; + public: + addr_t _endcodesection; // HACK + public: addr_t GetAddressSpace() { return _addrspace; }