From f6889f8a152bf1d50da6351a6e1f4cc3d401cf1f Mon Sep 17 00:00:00 2001 From: _xeroxz Date: Thu, 3 Dec 2020 22:59:11 -0800 Subject: [PATCH] fixed physical memory ranges --- VDM/VDM.vcxproj | 3 +++ VDM/VDM.vcxproj.filters | 5 +++++ VDM/icon.rc | 3 +++ VDM/small.ico | Bin 0 -> 25489 bytes VDM/util/util.hpp | 41 ++++++++++++++++++++++++++++++++++------ 5 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 VDM/icon.rc create mode 100644 VDM/small.ico diff --git a/VDM/VDM.vcxproj b/VDM/VDM.vcxproj index d516af0..0dc547e 100644 --- a/VDM/VDM.vcxproj +++ b/VDM/VDM.vcxproj @@ -169,6 +169,9 @@ + + + diff --git a/VDM/VDM.vcxproj.filters b/VDM/VDM.vcxproj.filters index 6a8f0ed..3cf6052 100644 --- a/VDM/VDM.vcxproj.filters +++ b/VDM/VDM.vcxproj.filters @@ -44,4 +44,9 @@ Header Files + + + Header Files + + \ No newline at end of file diff --git a/VDM/icon.rc b/VDM/icon.rc new file mode 100644 index 0000000..5856874 --- /dev/null +++ b/VDM/icon.rc @@ -0,0 +1,3 @@ +// Icon Resource Definition +#define MAIN_ICON 102 +MAIN_ICON ICON "small.ico" \ No newline at end of file diff --git a/VDM/small.ico b/VDM/small.ico new file mode 100644 index 0000000000000000000000000000000000000000..a2f23622c8007fd4d242939c8102f24f6019f31a GIT binary patch literal 25489 zcmeHv30zL=_Wv7cKm!>P8b~rVk|`QA7%D=eRFX0@ppiz3N)v@j6OtsAqNr6=iGaK_ug}_=ks~m``!DQpY^QayVj0Ep`lEpu(DF%%1t>+ zOQEPzC=_<~pMJYCQYe}5jGOzX-}j)L95aO?B=oo6%P5pyPN)D0>yN_ybr}kUAAUno zc=FS8xKJq2PA=5N{NIx5>+6FaKYskP93LMal#`Pal#!7Ug!kWjpOBCc)X>ln6dM~$ zn3|drMn*=&i4!NtE8bgLS`w#EpC*nUKTbZ!cayWRu`z*lF~`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I! zR^2eBS<894!6)(IUG2{WNq5GoXSyUBjwa@9PR;bvuT-b-(1IF!b!T}0#_+wzPRX*F z^+N#KytD+dPcE68oAzeew3IPCv}q4~FKTQus+iw3c=ly=^^Ls1h56Q2XL`L%J6W21 zdTOex>mJLsWP~=pcqCRc4}hng;Vra;)&%Bt4St!I-(|iDt(%3-LUnt>D%LJ& z7OK+BJt~=?X>4h`V=4eJU>LW1X&g9kLd7=MDq{c2=u4)q0Kvv3m+_rkF4d61c~eUu zY1Oe;S1B-Hpj8);s?rQJJA6)#4jH>ws;#)T^MOV@-9j-Vp#m6B+ndrrgLe1_GW|7K z6LW(%S%~z00td*vw}ok^+UdYuj7BGx6NP;lixH)(92q^vPOgZL)CqF8&WN1fGO&!7r0qd zO;xq6bba&MYDFJj_ie`(z90J16}$d^;4=6+&${E98Y`S#57YZ5eu6p$fCG8}H+0qU zQwDQAJ%9N8`6=n2UhMkt`SbdMw;dfC9_7!T<+=-I9u-;i>cw+IN>OofwpsZW!yx^A zz@(NhFVq_=_Fdi&m@+%tMbPKpRYt5SFf=e|i;M^nVdkm^>u}_4=$ZnqP38=sL5cRh zM6Xk6sqrK66V(rd3l`3#3lcx`NI9r#NA?XKr_apvZ*tdpCns+>_3p(o-#&xE_f>qk z=SEKUxd4V zZAJ)(6kC_s#5M?mrsDRh;LTQY02%vI7Jx&<_uc0kOBh#8n4xrh|Nb~1W&X#ZAvs{U ziu1<7tsnIB!YVd%}0m9| bool +#pragma pack (push, 1) + struct PhysicalMemoryPage//CM_PARTIAL_RESOURCE_DESCRIPTOR + { + uint8_t type; + uint8_t shareDisposition; + uint16_t flags; + uint64_t pBegin; + uint32_t sizeButNotExactly; + uint32_t pad; + + static constexpr uint16_t cm_resource_memory_large_40{ 0x200 }; + static constexpr uint16_t cm_resource_memory_large_48{ 0x400 }; + static constexpr uint16_t cm_resource_memory_large_64{ 0x800 }; + + uint64_t size()const noexcept + { + if (flags & cm_resource_memory_large_40) + return uint64_t{ sizeButNotExactly } << 8; + else if (flags & cm_resource_memory_large_48) + return uint64_t{ sizeButNotExactly } << 16; + else if (flags & cm_resource_memory_large_64) + return uint64_t{ sizeButNotExactly } << 32; + else + return uint64_t{ sizeButNotExactly }; + } + }; + static_assert(sizeof(PhysicalMemoryPage) == 20); +#pragma pack (pop) + + inline const auto init_ranges = ([&]() -> bool { HKEY h_key; DWORD type, size; LPBYTE data; - RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\\RESOURCEMAP\\System Resources\\Physical Memory", 0, KEY_READ, &h_key); RegQueryValueEx(h_key, ".Translated", NULL, &type, NULL, &size); //get size data = new BYTE[size]; RegQueryValueEx(h_key, ".Translated", NULL, &type, data, &size); DWORD count = *(DWORD*)(data + 16); auto pmi = data + 24; - for (int dwIndex = 0; dwIndex < count; dwIndex++) { +#if 0 pmem_ranges.emplace(*(uint64_t*)(pmi + 0), *(uint64_t*)(pmi + 8)); +#else + const PhysicalMemoryPage& page{ *(PhysicalMemoryPage*)(pmi - 4) }; + pmem_ranges.emplace(page.pBegin, page.size()); +#endif pmi += 20; } - delete[] data; RegCloseKey(h_key); return true;