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; }