MCPcopy Create free account
hub / github.com/HoShiMin/Kernel-Bridge / ExtractSegmentBaseAddress

Function ExtractSegmentBaseAddress

Kernel-Bridge/API/Hypervisor.cpp:1541–1560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1539 }
1540
1541 static unsigned long long ExtractSegmentBaseAddress(const SEGMENT_DESCRIPTOR_LONG* SegmentDescriptor)
1542 {
1543 if (SegmentDescriptor->Generic.System == 0)
1544 {
1545 // System segment (16 bytes):
1546 auto* Descriptor = reinterpret_cast<const SYSTEM_SEGMENT_DESCRIPTOR_LONG*>(SegmentDescriptor);
1547 return (static_cast<unsigned long long>(Descriptor->Bitmap.BaseAddressHighest) << 32)
1548 | (static_cast<unsigned long long>(Descriptor->Bitmap.BaseAddressHigh) << 24)
1549 | (static_cast<unsigned long long>(Descriptor->Bitmap.BaseAddressMiddle) << 16)
1550 | (static_cast<unsigned long long>(Descriptor->Bitmap.BaseAddressLow));
1551 }
1552 else
1553 {
1554 // User segment (8 bytes):
1555 auto* Descriptor = reinterpret_cast<const USER_SEGMENT_DESCRIPTOR_LONG*>(SegmentDescriptor);
1556 return (static_cast<unsigned long long>(Descriptor->Generic.BaseAddressHigh) << 24)
1557 | (static_cast<unsigned long long>(Descriptor->Generic.BaseAddressMiddle) << 16)
1558 | (static_cast<unsigned long long>(Descriptor->Generic.BaseAddressLow));
1559 }
1560 }
1561
1562 struct SEGMENT_INFO
1563 {

Callers 2

ParseSegmentInfoFunction · 0.85
VirtualizeProcessorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected