Implement device map inheritance
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in 42s
Builds / ExectOS (amd64, debug) (push) Successful in 43s
Builds / ExectOS (i686, debug) (push) Successful in 42s
Builds / ExectOS (i686, release) (push) Successful in 40s

This commit is contained in:
2026-08-06 22:10:47 +02:00
parent ba6b22f160
commit 317cf5ef24
3 changed files with 51 additions and 0 deletions

View File

@@ -19,11 +19,14 @@ namespace OB
{ {
private: private:
STATIC KPUSH_LOCK DeviceMapLock; STATIC KPUSH_LOCK DeviceMapLock;
STATIC PDEVICE_MAP SystemDeviceMap;
STATIC BOOLEAN UniqueDeviceMaps; STATIC BOOLEAN UniqueDeviceMaps;
public: public:
STATIC XTAPI POBJECT_DIRECTORY GetGlobalDevicesDirectory(IN POBJECT_DIRECTORY Directory); STATIC XTAPI POBJECT_DIRECTORY GetGlobalDevicesDirectory(IN POBJECT_DIRECTORY Directory);
STATIC XTAPI BOOLEAN GetUniqueDeviceMaps(VOID); STATIC XTAPI BOOLEAN GetUniqueDeviceMaps(VOID);
STATIC VOID InheritDeviceMap(IN PEPROCESS NewProcess,
IN PEPROCESS ParentProcess);
STATIC XTAPI XTSTATUS InitializeDeviceMap(VOID); STATIC XTAPI XTSTATUS InitializeDeviceMap(VOID);
}; };
} }

View File

@@ -12,6 +12,9 @@
/* Synchronizes shared read and exclusive write access to system device map structures */ /* Synchronizes shared read and exclusive write access to system device map structures */
KPUSH_LOCK OB::DeviceMap::DeviceMapLock; KPUSH_LOCK OB::DeviceMap::DeviceMapLock;
/* Pointer to the system device map */
PDEVICE_MAP OB::DeviceMap::SystemDeviceMap = NULLPTR;
/* Indicates whether the system employs unique device maps */ /* Indicates whether the system employs unique device maps */
BOOLEAN OB::DeviceMap::UniqueDeviceMaps; BOOLEAN OB::DeviceMap::UniqueDeviceMaps;

View File

@@ -58,6 +58,51 @@ OB::DeviceMap::GetUniqueDeviceMaps(VOID)
return UniqueDeviceMaps; return UniqueDeviceMaps;
} }
/**
* Inherits the device map from a parent process or assigns the system default.
*
* @param NewProcess
* Supplies the newly created process that will inherit the device map.
*
* @param ParentProcess
* Supplies the optional parent process to inherit the device map from.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
VOID
OB::DeviceMap::InheritDeviceMap(IN PEPROCESS NewProcess,
IN PEPROCESS ParentProcess)
{
PDEVICE_MAP TargetDeviceMap;
/* Acquire the device map lock */
KE::PushLockExclusiveGuard PushLock(&DeviceMapLock);
/* Determine the source of the device map */
if(ParentProcess)
{
/* Inherit the device map from the provided parent process */
TargetDeviceMap = (PDEVICE_MAP)ParentProcess->DeviceMap;
}
else
{
/* No parent process provided, use system device map */
TargetDeviceMap = SystemDeviceMap;
}
/* Check if a valid device map was resolved */
if(TargetDeviceMap)
{
/* Increment the reference count of the target device map */
TargetDeviceMap->ReferenceCount++;
/* Assign the device map to the process */
NewProcess->DeviceMap = TargetDeviceMap;
}
}
/** /**
* Initializes the Object Manager's device map subsystem. * Initializes the Object Manager's device map subsystem.
* *