How do I reallocate and run Multiboot 2 ELF modules
Posted: Thu Nov 02, 2017 1:12 am
Hello. I'm developing an x86 microkernel with minimalistic API (similar to L4). I decided to use Multiboot 2 modules to load user-space programs in memory because kernel knows nothing about filesystem paths. Those modules will be filesystem itself, process manager, memory manager (my kernel does not even use MMU and activate paging), etc. At startup my kernel have information from multiboot where the modules are placed in memory (physical addresses, I though). I can read ELF headers and jump to entry point after switching to user mode. However, I'm sure that I have to reallocate modules and add GDT entries for their code and data segments. What order shoud I do the things in for success? In particular:
1. Do I have to activate paging in early boot stage? Maybe this can be done from user-space memory manager via kernel API?
2. Do I have to implement multitasking in kernel? Maybe I can run process manager the first and transfer this responsibility to it?
3. Do I have to implement a timer in kernel? (I though yes because even Minix 3 didn't move this to user space).
Maybe, the main question:
4. How should the kernel be aware about memory map and module addresses? You can look at the screenshot to learn what information I have got from Multiboot bootloader. Do I have to reallocate something (maybe even the kernel) or create GDT entries for module physical addresses?
1. Do I have to activate paging in early boot stage? Maybe this can be done from user-space memory manager via kernel API?
2. Do I have to implement multitasking in kernel? Maybe I can run process manager the first and transfer this responsibility to it?
3. Do I have to implement a timer in kernel? (I though yes because even Minix 3 didn't move this to user space).
Maybe, the main question:
4. How should the kernel be aware about memory map and module addresses? You can look at the screenshot to learn what information I have got from Multiboot bootloader. Do I have to reallocate something (maybe even the kernel) or create GDT entries for module physical addresses?