The Pedigree Project 0.1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
KernelElf Class Reference
+ Inheritance diagram for KernelElf:
+ Collaboration diagram for KernelElf:

Classes

class  RuntimeLoad
 

Public Types

enum class  RuntimeUnloadResult {
  Unloaded , NotFound , Busy , Pinned ,
  DependedOn , Shutdown
}
 
enum class  RuntimeLoadResult {
  Ready , Loaded , InvalidImage , UnsupportedImage ,
  ImageTooLarge , NoMemory , Busy , Shutdown ,
  Duplicate , MissingDependency , EntryFailed , ProtectionFailed
}
 
typedef bool(* TerminalQuiesceHook) ()
 
- Public Types inherited from Elf
enum class  ExecutableValidationResult {
  Valid , Malformed , WrongArchitecture , UnsupportedType ,
  UnsupportedLayout , MultipleInterpreters
}
 

Public Member Functions

bool initialise (const BootstrapStruct_t &pBootstrap) INITIALISATION_ONLY
 
Module * loadModule (uint8_t *pModule, size_t len, bool silent=false)
 
Module * loadModule (struct ModuleInfo *info, bool silent=false)
 
void executeModules (bool silent=false, bool progress=true)
 
bool unloadModule (const char *name, bool silent=false, bool progress=true)
 
bool unloadModule (Module *module, bool silent=false, bool progress=true)
 
RuntimeUnloadResult unloadModuleRuntime (const char *name)
 
bool prepareRuntimeModules ()
 
RuntimeLoadResult beginRuntimeModuleLoad (size_t length, RuntimeLoad &load)
 
RuntimeLoadResult loadModuleRuntime (RuntimeLoad &load)
 
MUST_USE_RESULT bool unloadModules ()
 
bool isShuttingDown () const
 
bool registerTerminalQuiesce (ModuleEntry ownerEntry, TerminalQuiesceHook hook)
 
bool registerUnloadAdmission (ModuleEntry ownerEntry, Module::UnloadAdmissionHook hook)
 
bool unregisterTerminalQuiesce (ModuleEntry ownerEntry, TerminalQuiesceHook hook)
 
bool moduleIsLoaded (char *name)
 
char * getDependingModule (char *name)
 
uintptr_t globalLookupSymbol (const char *pName)
 
const char * globalLookupSymbol (uintptr_t addr, uintptr_t *startAddr=0)
 
size_t getModuleCount ()
 
const Module * getModule (size_t index)
 
MemoryAllocator & getModuleAllocator ()
 
bool hasPendingModules () const
 
void updateModuleStatus (Module *module, bool status, bool runFailureLifecycle=true)
 
void waitForModulesToLoad ()
 
void invokeInitModule ()
 Invokes the module named 'init'. When a module named init is discovered, rather than executing it in the usual module order, it is kept aside until this function is called.
 
- Public Member Functions inherited from Elf
 Elf ()
 
virtual ~Elf ()
 
 Elf (const Elf &)
 
bool validate (uint8_t *pBuffer, size_t length)
 
bool create (uint8_t *pBuffer, size_t length)
 
bool createNeededOnly (uint8_t *pBuffer, size_t length)
 
bool loadModule (uint8_t *pBuffer, size_t length, uintptr_t &loadBase, size_t &loadSize, SymbolTable *pSymbolTableCopy=0)
 
bool finaliseModule (uint8_t *pBuffer, size_t length)
 
bool allocate (uint8_t *pBuffer, size_t length, uintptr_t &loadBase, SymbolTable *pSymtab=0, bool bAllocate=true, size_t *pSize=0)
 
bool load (uint8_t *pBuffer, size_t length, uintptr_t loadBase, SymbolTable *pSymtab=0, uintptr_t nStart=0, uintptr_t nEnd=~0, bool relocate=true, uintptr_t destinationBase=0)
 
List< char * > & neededLibraries ()
 
String & getInterpreter ()
 
uintptr_t getLastAddress ()
 
uintptr_t getInitFunc ()
 
uintptr_t getFiniFunc ()
 
template<class T = ElfSymbol_t>
const char * lookupSymbol (uintptr_t addr, uintptr_t *startAddr, T *symbolTable)
 
const char * lookupSymbol (uintptr_t addr, uintptr_t *startAddr)
 
uintptr_t lookupSymbol (const char *pName)
 
uintptr_t lookupDynamicSymbolAddress (const char *str, uintptr_t loadBase)
 
uintptr_t applySpecificRelocation (uintptr_t off, SymbolTable *pSymtab, uintptr_t loadBase, SymbolTable::Policy policy=SymbolTable::LocalFirst)
 
uintptr_t getGlobalOffsetTable ()
 
size_t getPltSize ()
 
void populateSymbolTable (SymbolTable *pSymtab, uintptr_t loadBase)
 
void preallocateSymbols (SymbolTable *pSymtabOverride=nullptr, SymbolTable *pAdditionalSymtab=nullptr)
 
SymbolTable * getSymbolTable ()
 
uintptr_t getEntryPoint ()
 
uintptr_t debugFrameTable ()
 
uintptr_t debugFrameTableLength ()
 
void setName (const String &s)
 
const String & getName () const
 

Static Public Member Functions

static KernelElf & instance ()
 
- Static Public Member Functions inherited from Elf
static ExecutableValidationResult validateExecutableHeader (const uint8_t *pBuffer, size_t length, size_t fileSize, ExecutableMetadata &metadata)
 
static ExecutableValidationResult validateExecutableProgramHeaders (const uint8_t *pBuffer, size_t length, size_t fileSize, ExecutableMetadata &metadata)
 
static ExecutableValidationResult validateExecutableInterpreter (const uint8_t *pBuffer, size_t length, const ExecutableMetadata &metadata)
 
static bool extractEntryPoint (uint8_t *pBuffer, size_t length, uintptr_t &entry)
 
static bool extractInformation (uint8_t *pBuffer, size_t length, size_t &phdrCount, size_t &phdrEntrySize, uintptr_t &phdrAddress)
 

Private Types

enum  ModuleUnloadClaim {
  UnloadClaimed , UnloadComplete , UnloadBusy , UnloadPinned ,
  UnloadRuntimePinned , UnloadDependedOn , UnloadUnknown , UnloadShutdown
}
 
enum  TerminalQuiesceState { QuiesceOpen , QuiesceInvoking , QuiesceComplete , QuiesceFailed }
 
enum  ModuleShutdownState { ShutdownOpen , ShutdownRunning , ShutdownComplete , ShutdownFailed }
 
typedef ElfSectionHeader_t KernelElfSectionHeader_t
 
typedef ElfSymbol_t KernelElfSymbol_t
 

Private Member Functions

 KernelElf () INITIALISATION_ONLY
 
 KernelElf (const KernelElf &)
 
virtual ~KernelElf ()
 
KernelElf & operator= (const KernelElf &)
 
bool moduleDependenciesSatisfiedLocked (Module *module) const
 
bool claimModuleExecutionLocked (Module *module)
 
bool executeModule (Module *module)
 
void abandonRuntimeModuleLoad (RuntimeLoad &load)
 
bool retireRuntimeModule (Module *module, bool runLifecycle)
 
uintptr_t runtimeExportLocked (const char *name, Module *owner=nullptr) const
 
const char * runtimeLookupSymbolLocked (uintptr_t addr, uintptr_t *startAddr) const
 
uintptr_t resolveRuntimeImport (const char *name, Module *consumer)
 
bool beginModuleLoad ()
 
void finishModuleLoad ()
 
bool moduleRegisteredLocked (Module *module) const
 
ModuleUnloadClaim claimModuleUnloadLocked (Module *module, bool allowShutdown, bool requireMembership, bool enforceDependencies, bool &wasFailed, bool &runLifecycle)
 
bool completeUnloadAttempt (Module *module, ModuleUnloadClaim claim, bool wasFailed, bool runLifecycle, bool silent, bool progress, bool terminal=false)
 
void finishClaimedUnload (Module *module, bool wasFailed)
 
void lockModules ()
 
void unlockModules ()
 

Static Private Member Functions

static Module * findModuleByName (const Vector< Module * > &modules, const String &name)
 
static bool moduleDependsOn (Module *consumer, Module *provider)
 
static bool hasLiveDependent (const Vector< Module * > &modules, Module *provider)
 
static Module * findUnloadCandidate (const Vector< Module * > &modules, bool &waiting)
 
template<class T >
static T * rebase (Module *module, T *ptr)
 

Private Attributes

MemoryRegion m_AdditionalSectionContents
 
MemoryRegion * m_AdditionalSectionHeaders
 
Vector< Module * > m_Modules
 
MemoryAllocator m_ModuleAllocator
 
bool m_ModuleAllocatorInitialised
 
bool m_RuntimeModulesPrepared
 
ElfSectionHeader_t * m_pSectionHeaders
 
ElfSymbol_t * m_pSymbolTable
 
Spinlock m_ModuleAdjustmentLock
 
bool m_ModuleShutdown
 
ModuleShutdownState m_ModuleShutdownStatus
 
bool m_ModuleLoading
 
Module * m_UnloadingModule
 
size_t m_ModuleExecutions
 
size_t m_ModuleExecutionPasses
 
Module * m_TerminalQuiesceOwner
 
TerminalQuiesceHook m_TerminalQuiesceHook
 
TerminalQuiesceState m_TerminalQuiesceStatus
 
Module * m_InitModule
 

Static Private Attributes

static KernelElf m_Instance
 

Friends

void _cxx_main (BootstrapStruct_t &)
 

Additional Inherited Members

- Static Public Attributes inherited from Elf
static constexpr size_t MaximumProgramHeaderTableSize = 65536
 
static constexpr size_t MaximumInterpreterSize = 4096
 
- Protected Attributes inherited from Elf
struct Elf::ElfHeader_t PACKED
 
struct Elf::ElfProgramHeader_t PACKED
 
struct Elf::ElfSectionHeader_t PACKED
 
struct Elf::Elf32SectionHeader_t PACKED
 
struct Elf::ElfSymbol_t PACKED
 
struct Elf::Elf32Symbol_t PACKED
 
struct Elf::ElfDyn_t PACKED
 
struct Elf::ElfRel_t PACKED
 
struct Elf::ElfRela_t PACKED
 
ElfSymbol_t * m_pSymbolTable
 
size_t m_nSymbolTableSize
 
char * m_pStringTable
 
size_t m_nStringTableSize
 
char * m_pShstrtab
 
size_t m_nShstrtabSize
 
uintptr_t * m_pGotTable
 
ElfRel_t * m_pRelTable
 
ElfRela_t * m_pRelaTable
 
size_t m_nRelTableSize
 
size_t m_nRelaTableSize
 
ElfRel_t * m_pPltRelTable
 
ElfRela_t * m_pPltRelaTable
 
bool m_bUsesRela
 
uint32_t * m_pDebugTable
 
size_t m_nDebugTableSize
 
ElfSymbol_t * m_pDynamicSymbolTable
 
size_t m_nDynamicSymbolTableSize
 
char * m_pDynamicStringTable
 
size_t m_nDynamicStringTableSize
 
ElfSectionHeader_t * m_pSectionHeaders
 
size_t m_nSectionHeaders
 
ElfProgramHeader_t * m_pProgramHeaders
 
size_t m_nProgramHeaders
 
size_t m_nPltSize
 
uintptr_t m_nEntry
 
List< char * > m_NeededLibraries
 
SymbolTable m_SymbolTable
 
uintptr_t m_InitFunc
 
uintptr_t m_FiniFunc
 
String m_sInterpreter
 
String m_Name
 
uintptr_t m_LoadBase
 

Detailed Description

Definition at line 127 of file KernelElf.h.

Member Typedef Documentation

◆ KernelElfSectionHeader_t

Definition at line 405 of file KernelElf.h.

◆ KernelElfSymbol_t

Definition at line 406 of file KernelElf.h.

◆ TerminalQuiesceHook

typedef bool(* KernelElf::TerminalQuiesceHook) ()

Definition at line 131 of file KernelElf.h.

Member Enumeration Documentation

◆ ModuleShutdownState

enum KernelElf::ModuleShutdownState
private

Definition at line 333 of file KernelElf.h.

◆ ModuleUnloadClaim

enum KernelElf::ModuleUnloadClaim
private

Definition at line 315 of file KernelElf.h.

◆ RuntimeLoadResult

enum class KernelElf::RuntimeLoadResult
strong

Definition at line 165 of file KernelElf.h.

◆ RuntimeUnloadResult

enum class KernelElf::RuntimeUnloadResult
strong

Definition at line 160 of file KernelElf.h.

◆ TerminalQuiesceState

enum KernelElf::TerminalQuiesceState
private

Definition at line 326 of file KernelElf.h.

Constructor & Destructor Documentation

◆ KernelElf() [1/2]

KernelElf::KernelElf ( )
private

Default constructor does nothing

Definition at line 323 of file KernelElf.cc.

◆ KernelElf() [2/2]

KernelElf::KernelElf ( const KernelElf &  )
private

Copy-constructor

Note
NOT implemented (singleton class)

◆ ~KernelElf()

KernelElf::~KernelElf ( )
privatevirtual

Destructor does nothing

Definition at line 344 of file KernelElf.cc.

Member Function Documentation

◆ abandonRuntimeModuleLoad()

void KernelElf::abandonRuntimeModuleLoad ( RuntimeLoad &  load)
private

Definition at line 436 of file KernelElf-runtime.cc.

◆ beginModuleLoad()

bool KernelElf::beginModuleLoad ( )
private

Definition at line 356 of file KernelElf.cc.

◆ beginRuntimeModuleLoad()

KernelElf::RuntimeLoadResult KernelElf::beginRuntimeModuleLoad ( size_t  length,
RuntimeLoad &  load 
)

Definition at line 183 of file KernelElf-runtime.cc.

◆ claimModuleExecutionLocked()

bool KernelElf::claimModuleExecutionLocked ( Module *  module)
private

Definition at line 1431 of file KernelElf.cc.

◆ claimModuleUnloadLocked()

KernelElf::ModuleUnloadClaim KernelElf::claimModuleUnloadLocked ( Module *  module,
bool  allowShutdown,
bool  requireMembership,
bool  enforceDependencies,
bool &  wasFailed,
bool &  runLifecycle 
)
private

Definition at line 707 of file KernelElf.cc.

◆ completeUnloadAttempt()

bool KernelElf::completeUnloadAttempt ( Module *  module,
ModuleUnloadClaim  claim,
bool  wasFailed,
bool  runLifecycle,
bool  silent,
bool  progress,
bool  terminal = false 
)
private

Definition at line 764 of file KernelElf.cc.

◆ executeModule()

bool KernelElf::executeModule ( Module *  module)
private

Definition at line 1557 of file KernelElf.cc.

◆ executeModules()

void KernelElf::executeModules ( bool  silent = false,
bool  progress = true 
)

Executes all modules.

Definition at line 505 of file KernelElf.cc.

References Vector< T >::count(), Scheduler::instance(), lockModules(), m_Modules, unlockModules(), and Scheduler::yield().

◆ findModuleByName()

Module * KernelElf::findModuleByName ( const Vector< Module * > &  modules,
const String &  name 
)
staticprivate

Definition at line 648 of file KernelElf.cc.

◆ findUnloadCandidate()

Module * KernelElf::findUnloadCandidate ( const Vector< Module * > &  modules,
bool &  waiting 
)
staticprivate

Definition at line 687 of file KernelElf.cc.

◆ finishClaimedUnload()

void KernelElf::finishClaimedUnload ( Module *  module,
bool  wasFailed 
)
private

Definition at line 754 of file KernelElf.cc.

◆ finishModuleLoad()

void KernelElf::finishModuleLoad ( )
private

Definition at line 366 of file KernelElf.cc.

◆ getDependingModule()

char * KernelElf::getDependingModule ( char *  name)

Returns the name of the first module that have the specified module as dependency.

Definition at line 1402 of file KernelElf.cc.

References lockModules(), m_Modules, rebase(), and unlockModules().

◆ getModule()

const Module * KernelElf::getModule ( size_t  index)

Returns a module record by index, or nullptr when the index is invalid.

Definition at line 1741 of file KernelElf.cc.

References lockModules(), and unlockModules().

◆ getModuleAllocator()

MemoryAllocator & KernelElf::getModuleAllocator ( )
inline

Returns the address space allocator for modules.

Definition at line 274 of file KernelElf.h.

◆ getModuleCount()

size_t KernelElf::getModuleCount ( )

Returns the number of module records currently retained by the loader.

Definition at line 1734 of file KernelElf.cc.

References Vector< T >::count(), lockModules(), m_Modules, and unlockModules().

◆ globalLookupSymbol() [1/2]

uintptr_t KernelElf::globalLookupSymbol ( const char *  pName)

Looks up the address of the symbol with name 'pName' globally, that is throughout all modules and the kernel itself.

Definition at line 1695 of file KernelElf.cc.

References lockModules(), SymbolTable::lookup(), and unlockModules().

Referenced by DisassembleCommand::execute(), LookupCommand::execute(), SlamCommand::execute(), and TraceCommand::execute().

+ Here is the caller graph for this function:

◆ globalLookupSymbol() [2/2]

const char * KernelElf::globalLookupSymbol ( uintptr_t  addr,
uintptr_t *  startAddr = 0 
)

Definition at line 1706 of file KernelElf.cc.

◆ hasLiveDependent()

bool KernelElf::hasLiveDependent ( const Vector< Module * > &  modules,
Module *  provider 
)
staticprivate

Definition at line 675 of file KernelElf.cc.

◆ hasPendingModules()

bool KernelElf::hasPendingModules ( ) const

Do we have pending modules still?

Definition at line 1748 of file KernelElf.cc.

References m_Modules.

◆ initialise()

bool KernelElf::initialise ( const BootstrapStruct_t &  pBootstrap)

◆ instance()

static KernelElf & KernelElf::instance ( )
inlinestatic

Get the class instance

Returns
reference to the class instance

Definition at line 135 of file KernelElf.h.

Referenced by Elf::applyRelocation(), DisassembleCommand::execute(), LookupCommand::execute(), SlamCommand::execute(), TraceCommand::execute(), X64InterruptManager::interrupt(), Elf::loadModule(), panic(), Backtrace::performBacktrace(), and Backtrace::performDwarfBacktrace().

+ Here is the caller graph for this function:

◆ invokeInitModule()

void KernelElf::invokeInitModule ( )

Invokes the module named 'init'. When a module named init is discovered, rather than executing it in the usual module order, it is kept aside until this function is called.

This ensures the init module (which is generally used to invoke the userspace and become user-interactive) is always run last, and is not impacted by modules that load after it.

Definition at line 1650 of file KernelElf.cc.

References lockModules(), m_InitModule, m_Modules, moduleDependenciesSatisfiedLocked(), prepareRuntimeModules(), Vector< T >::pushBack(), and unlockModules().

◆ isShuttingDown()

bool KernelElf::isShuttingDown ( ) const
inline

Definition at line 208 of file KernelElf.h.

◆ loadModule() [1/2]

Module * KernelElf::loadModule ( struct ModuleInfo *  info,
bool  silent = false 
)

Load a static driver.

Todo:
rewrite to the new module dependency logic

Definition at line 576 of file KernelElf.cc.

References EMIT_IF, lockModules(), m_InitModule, m_Modules, Vector< T >::pushBack(), rebase(), and unlockModules().

◆ loadModule() [2/2]

Module * KernelElf::loadModule ( uint8_t *  pModule,
size_t  len,
bool  silent = false 
)

Treats the given pointer as an ELF partially linked object file and loads it, relocates it and links it.

Parameters
pModuleA pointer to an ELF module/driver.
lenThe length of pModule, in bytes.
silentIf true will not update the boot progress(default is false).
Returns
A pointer to a Elf class describing the loaded module.

Definition at line 372 of file KernelElf.cc.

References Dec, EMIT_IF, RangeList< T, Reversed >::free(), VirtualAddressSpace::getKernelAddressSpace(), VirtualAddressSpace::getKernelModulesEnd(), VirtualAddressSpace::getKernelModulesStart(), Hex, lockModules(), m_InitModule, m_ModuleAllocator, m_Modules, Vector< T >::pushBack(), rebase(), UNLIKELY, and unlockModules().

◆ loadModuleRuntime()

KernelElf::RuntimeLoadResult KernelElf::loadModuleRuntime ( RuntimeLoad &  load)

Definition at line 293 of file KernelElf-runtime.cc.

◆ lockModules()

void KernelElf::lockModules ( )
private

◆ moduleDependenciesSatisfiedLocked()

bool KernelElf::moduleDependenciesSatisfiedLocked ( Module *  module) const
private

Requires the module lock.

Definition at line 1442 of file KernelElf.cc.

References m_Modules, and rebase().

Referenced by invokeInitModule().

+ Here is the caller graph for this function:

◆ moduleDependsOn()

bool KernelElf::moduleDependsOn ( Module *  consumer,
Module *  provider 
)
staticprivate

Definition at line 657 of file KernelElf.cc.

◆ moduleIsLoaded()

bool KernelElf::moduleIsLoaded ( char *  name)

Returns true if a module with the specified name has been loaded.

Definition at line 1386 of file KernelElf.cc.

References lockModules(), and m_Modules.

◆ moduleRegisteredLocked()

bool KernelElf::moduleRegisteredLocked ( Module *  module) const
private

Definition at line 639 of file KernelElf.cc.

◆ operator=()

KernelElf & KernelElf::operator= ( const KernelElf &  )
private

Assignment operator

Note
NOT implemented (singleton class)

◆ prepareRuntimeModules()

bool KernelElf::prepareRuntimeModules ( )

◆ rebase()

template<class T >
static T * KernelElf::rebase ( Module *  module,
T *  ptr 
)
inlinestaticprivate

Rebase a pointer for the given loaded module.

Definition at line 363 of file KernelElf.h.

References EMIT_IF.

Referenced by getDependingModule(), loadModule(), loadModule(), and moduleDependenciesSatisfiedLocked().

+ Here is the caller graph for this function:

◆ registerTerminalQuiesce()

bool KernelElf::registerTerminalQuiesce ( ModuleEntry  ownerEntry,
TerminalQuiesceHook  hook 
)

Registers one terminal quiesce callback owned by the module whose entry point is ownerEntry. Registration is valid only while that module is executing or active and before terminal module shutdown begins.

Definition at line 1028 of file KernelElf.cc.

References lockModules(), m_Modules, and unlockModules().

◆ registerUnloadAdmission()

bool KernelElf::registerUnloadAdmission ( ModuleEntry  ownerEntry,
Module::UnloadAdmissionHook  hook 
)

Called outside the module lock after exclusive unload claim. Refusal must reopen any resource admission the hook closed. Ready must retain closed admission through exit. Busy aborts terminal shutdown; KeepMapped permits safe retention without invoking exit.

Definition at line 1007 of file KernelElf.cc.

References lockModules(), m_Modules, and unlockModules().

◆ resolveRuntimeImport()

uintptr_t KernelElf::resolveRuntimeImport ( const char *  name,
Module *  consumer 
)
private

Requires the exclusive runtime load claim; providers cannot retire.

Definition at line 273 of file KernelElf-runtime.cc.

References SymbolTable::lookupOwned(), and m_Modules.

◆ retireRuntimeModule()

bool KernelElf::retireRuntimeModule ( Module *  module,
bool  runLifecycle 
)
private

Definition at line 395 of file KernelElf-runtime.cc.

◆ runtimeExportLocked()

uintptr_t KernelElf::runtimeExportLocked ( const char *  name,
Module *  owner = nullptr 
) const
private

Definition at line 218 of file KernelElf-runtime.cc.

◆ runtimeLookupSymbolLocked()

const char * KernelElf::runtimeLookupSymbolLocked ( uintptr_t  addr,
uintptr_t *  startAddr 
) const
private

Requires the module lock.

Definition at line 240 of file KernelElf-runtime.cc.

◆ unloadModule() [1/2]

bool KernelElf::unloadModule ( const char *  name,
bool  silent = false,
bool  progress = true 
)

Unloads the specified module.

Definition at line 929 of file KernelElf.cc.

References lockModules(), and unlockModules().

◆ unloadModule() [2/2]

bool KernelElf::unloadModule ( Module *  module,
bool  silent = false,
bool  progress = true 
)

Definition at line 950 of file KernelElf.cc.

◆ unloadModuleRuntime()

KernelElf::RuntimeUnloadResult KernelElf::unloadModuleRuntime ( const char *  name)

Unloads an active module; completed unloads are absent from this lookup.

Definition at line 960 of file KernelElf.cc.

References lockModules(), m_Modules, and unlockModules().

◆ unloadModules()

bool KernelElf::unloadModules ( )

Unloads modules; false forbids the final platform shutdown handoff.

Definition at line 1086 of file KernelElf.cc.

References Vector< T >::clear(), Scheduler::instance(), lockModules(), m_InitModule, m_Modules, Vector< T >::pushBack(), Machine::setShutdownPhase(), unlockModules(), and Scheduler::yield().

◆ unlockModules()

void KernelElf::unlockModules ( )
private

◆ unregisterTerminalQuiesce()

bool KernelElf::unregisterTerminalQuiesce ( ModuleEntry  ownerEntry,
TerminalQuiesceHook  hook 
)

Removes a terminal callback only when both its owner and function match.

Definition at line 1068 of file KernelElf.cc.

References lockModules(), and unlockModules().

◆ updateModuleStatus()

void KernelElf::updateModuleStatus ( Module *  module,
bool  status,
bool  runFailureLifecycle = true 
)

Updates the status of the given module.

Definition at line 1563 of file KernelElf.cc.

References lockModules(), and unlockModules().

◆ waitForModulesToLoad()

void KernelElf::waitForModulesToLoad ( )

Waits for all modules to complete (whether successfully or not).

Definition at line 1598 of file KernelElf.cc.

References Vector< T >::count(), Scheduler::instance(), lockModules(), m_Modules, unlockModules(), and Scheduler::yield().

Friends And Related Symbol Documentation

◆ _cxx_main

void _cxx_main ( BootstrapStruct_t &  bsInf)
friend
Todo:
Seed random number generator.

Definition at line 288 of file system/kernel/core/main.cc.

Member Data Documentation

◆ m_AdditionalSectionContents

MemoryRegion KernelElf::m_AdditionalSectionContents
private

Additional section headers we have loaded for this ELF binary.

Definition at line 389 of file KernelElf.h.

Referenced by initialise().

◆ m_AdditionalSectionHeaders

MemoryRegion* KernelElf::m_AdditionalSectionHeaders
private

Definition at line 390 of file KernelElf.h.

◆ m_InitModule

Module* KernelElf::m_InitModule
private

Pending init module.

Definition at line 420 of file KernelElf.h.

Referenced by invokeInitModule(), loadModule(), loadModule(), and unloadModules().

◆ m_Instance

KernelElf KernelElf::m_Instance
staticprivate

Instance of the KernelElf class

Definition at line 393 of file KernelElf.h.

◆ m_ModuleAdjustmentLock

Spinlock KernelElf::m_ModuleAdjustmentLock
private

Definition at line 408 of file KernelElf.h.

◆ m_ModuleAllocator

MemoryAllocator KernelElf::m_ModuleAllocator
private

Memory allocator for modules - where they can be loaded.

Definition at line 398 of file KernelElf.h.

Referenced by loadModule(), and prepareRuntimeModules().

◆ m_ModuleAllocatorInitialised

bool KernelElf::m_ModuleAllocatorInitialised
private

Definition at line 399 of file KernelElf.h.

◆ m_ModuleExecutionPasses

size_t KernelElf::m_ModuleExecutionPasses
private

Definition at line 414 of file KernelElf.h.

◆ m_ModuleExecutions

size_t KernelElf::m_ModuleExecutions
private

Definition at line 413 of file KernelElf.h.

◆ m_ModuleLoading

bool KernelElf::m_ModuleLoading
private

Definition at line 411 of file KernelElf.h.

◆ m_Modules

Vector<Module*> KernelElf::m_Modules
private

◆ m_ModuleShutdown

bool KernelElf::m_ModuleShutdown
private

Definition at line 409 of file KernelElf.h.

◆ m_ModuleShutdownStatus

ModuleShutdownState KernelElf::m_ModuleShutdownStatus
private

Definition at line 410 of file KernelElf.h.

◆ m_pSectionHeaders

ElfSectionHeader_t* KernelElf::m_pSectionHeaders
private

Definition at line 402 of file KernelElf.h.

◆ m_pSymbolTable

ElfSymbol_t* KernelElf::m_pSymbolTable
private

Definition at line 403 of file KernelElf.h.

◆ m_RuntimeModulesPrepared

bool KernelElf::m_RuntimeModulesPrepared
private

Definition at line 400 of file KernelElf.h.

◆ m_TerminalQuiesceHook

TerminalQuiesceHook KernelElf::m_TerminalQuiesceHook
private

Definition at line 416 of file KernelElf.h.

◆ m_TerminalQuiesceOwner

Module* KernelElf::m_TerminalQuiesceOwner
private

Definition at line 415 of file KernelElf.h.

◆ m_TerminalQuiesceStatus

TerminalQuiesceState KernelElf::m_TerminalQuiesceStatus
private

Definition at line 417 of file KernelElf.h.

◆ m_UnloadingModule

Module* KernelElf::m_UnloadingModule
private

Definition at line 412 of file KernelElf.h.


The documentation for this class was generated from the following files: