20 #ifndef KERNEL_LINKER_KERNELELF_H 21 #define KERNEL_LINKER_KERNELELF_H 23 #include "pedigree/kernel/compiler.h" 24 #include "pedigree/kernel/linker/Elf.h" 25 #include "pedigree/kernel/processor/MemoryRegion.h" 26 #include "pedigree/kernel/processor/types.h" 27 #include "pedigree/kernel/utilities/MemoryAllocator.h" 28 #include "pedigree/kernel/utilities/SharedPointer.h" 29 #include "pedigree/kernel/utilities/Vector.h" 30 #include "pedigree/kernel/utilities/utility.h" 33 #include "pedigree/kernel/Spinlock.h" 34 #include "pedigree/kernel/process/Semaphore.h" 38 #include "modules/Module.h" 51 : elf(nullptr), name(0), entry(0), exit(0), depends(0), depends_opt(0),
52 buffer(0), buflen(0), status(Unknown)
66 const char **depends_opt;
82 bool isPending()
const 84 return status == Preloaded;
89 return status == Preloaded || status == Active;
92 bool isUnloaded()
const 94 return status == Unloaded || status == Failed;
99 return status == Failed;
102 bool isActive()
const 104 return status == Active;
107 bool isExecuting()
const 109 return status == Executing;
112 bool wasAttempted()
const 114 return status == Executing || isActive() || isFailed() || isUnloaded();
124 friend void system_reset();
144 Module *loadModule(uint8_t *pModule,
size_t len,
bool silent =
false);
145 #ifdef STATIC_DRIVERS 146 Module *loadModule(
struct ModuleInfo *info,
bool silent =
false);
150 void executeModules(
bool silent =
false,
bool progress =
true);
154 unloadModule(
const char *name,
bool silent =
false,
bool progress =
true);
156 unloadModule(
Module *module,
bool silent =
false,
bool progress =
true);
159 void unloadModules();
162 bool moduleIsLoaded(
char *name);
166 char *getDependingModule(
char *name);
170 uintptr_t globalLookupSymbol(
const char *pName);
171 const char *globalLookupSymbol(uintptr_t addr, uintptr_t *startAddr = 0);
176 return m_ModuleAllocator;
180 bool hasPendingModules()
const;
183 void updateModuleStatus(
Module *module,
bool status);
186 void waitForModulesToLoad();
200 bool moduleDependenciesSatisfied(
Module *module);
201 bool executeModule(
Module *module);
207 return adjust_pointer(ptr, module->loadBase);
214 void unlockModules();
216 #if defined(X86_COMMON) 230 #if defined(X86_COMMON) 234 typedef Elf32SectionHeader_t KernelElfSectionHeader_t;
Bootstrap structure passed to the kernel entry point.
Elf32SectionHeader_t * m_pSectionHeaders
Vector< Module * > m_Modules
static KernelElf m_Instance
#define INITIALISATION_ONLY
MemoryAllocator m_ModuleAllocator
static KernelElf & instance()
static T * rebase(Module *module, T *ptr)
MemoryAllocator & getModuleAllocator()
Special memory entity in the kernel's virtual address space.
Semaphore m_ModuleProgress