[打滾] Windos_7_定址記憶體(DRam)最大值問題已刪文

看板FCU_EE97B作者 (是BB 不是你阿罵)時間13年前 (2011/02/11 02:30), 編輯推噓2(201)
留言3則, 2人參與, 最新討論串1/1
這個...因為有人問到Windos7的32bit是否有能力定址DRam超過4G 於是上網查了一下~ 找到以下資料出來跟大家分享一下 ------------------------------------------------------ 簡解: 我知道有人不想看...所以我直接說結論比較快 記憶體定址最大值問題和Win7的 32Bit 和 64Bit 沒關係!!! ------------------------------------------------------ 詳解: Windows家族的作業系統核心最主要是根據一個License Value(就是微軟授權你能用多少 記憶體)、來決定使用者手中的版本可以管理多少實體記憶體/實體位址,例如32-bit Windows 7 Starter Edition的2GB、32-bit Windows 2000 Advanced Server的8GB、 32-bit Windows Server 2003 R2 Enterprise的64GB、Windows 7 x64 Home Basic的8GB 、x64 Home Premium的16GB....等。 關於License Value以及ReadyFor4GB實作所基於的原理,可以參考這個國外強者的網站 GeoffChappell.com,這是最原始的一切資訊出處,因為這位仁兄耐心下去trace Windows 的核心程式碼,才找出解除封印的方式,也才有大陸端的ReadyFor4GB程式及台灣的 4GBPatch等自動化工具的誕生。 http://ppt.cc/h8X6 ︿︿︿︿︿︿︿︿︿原文出處 不管是手動用十六進位編輯器去改,或是運用ReadyFor4GB/4GBPatch這類的自動修改工具 ,針對核心檔案 C:\Windows\System32\ntkrnlpa.exe的修改如下(有兩處,改法一樣) 找到 7C (xx) <span>8B 45 FC 85 C0 74 (yy)</span> 改成 7C (xx) <span>B8 00 00 02 00 90 90</span> 紅色那段寫成x86組合語言意義是: <span> mov eax,dword ptr [ebp-4] test eax,eax je default </span> 原本未修改前執行到此,eax暫存器會被放入ZwQueryLicenseValue所得到的值,也就是每 一版Windows作業系統所被微軟授權使用的可管理記憶體大小,如果得到該值為0,也就是 一般消費性x86版Windows作業系統的情況,就會啟動封印程序,將所能管理的實體位址限 定在4GB..... 藍色那段寫成x86組語意義是: <span> mov eax,00020000h nop nop </span> 修改後則變成直接把一個立即值指定給eax暫存器,因此就不去管實際 ZwQueryLicenseValue讀到的被授權值是多少了。00020000h就是十進位的131072,單位應 該是MB,除以1024,就會算出128,單位則變成GB,也就是讓核心可以管理到上限128GB的 實體記憶體。 128GB的緣由: ================================================================ The maximum physical address is calculated as the least of three values: a license limit; a run-time limit; and a hard-coded limit. For the ordinary kernel, the license value for the maximum physical address is the same as for the total amount of memory, but the PAE kernel has a separate license value, namely Kernel-MaxPhysicalPage. Again, the data for this value is a number of MB. Again, all 32-bit editions of Windows Vista are installed with this value set to 0x1000, representing 4GB. <span>The run-time limit arises from needing to be sure that an array of MMPFN structures can be set up to represent all the pages of physical memory, one structure per 4KB page, from zero up to the maximum physical address. </span>The kernel’s capacity for such an array depends on how much of the linear address space is already in use. If the size of the largest block of free linear address space divided by the size of an MMPFN structure (<span>0x18 or 0x1C bytes for the ordinary and PAE kernels, respectively</span>) is greater than the maximum physical page determined from the license value, then the licensed maximum certainly cannot be supported and the maximum has to be reduced accordingly. The preceding calculation also produces an architectural limit on the use of physical memory by 32-bit Windows with a PAE kernel. The largest block of linear address space that is available even this early cannot be as large as 1GB and could be much smaller. <span>Even if it is very nearly 1GB, that’s only enough to fit an MMPFN array for a maximum physical address of 128GB (given that the maximum should be a power of two). This limit is hard-coded in the PAE kernel, as is 4GB for the non-PAE kernel. </span> ================================================================ Windows採用4KB分頁,而作業系統會為每個4KB分頁維護一個MMPFN的資料結構,每個 MMPFN結構大小為28bytes,理論上作業系統若分配最多1GB的記憶體來放所需的MMPFN資料 結構時,可以有1GB/28bytes = 38347922個MMPFN項目,那理論上作業系統所能夠管理的 實體記憶體上限將為: 38347922*4KB ~= 146GB 實務上作業系統所能管理的最大實體記憶體上限值,大都設定在2的冪次方,以便於運算 ,而最接近146GB的2冪次方為128GB,此時MMPFN資料結構需耗用0.875GB的記憶體。如果 是像一般使用者較可能安裝的8GB記憶體,則作業系統需耗用56MB來管理MMPFN的資料結構 。 因此128GB是從作業系統本身管理實體記憶體頁面所需的資料結構數量的系統軟體角度算 出來的,但是實務上還是要受限於硬體PAE本身設計所支援的上限,也就是64GB。 修改過後的核心,與原先核心並存,再運用Vista/Win 7內建的BCDEDIT新增一個開機選單 項目,開機時可以自由選擇用解除封印後的核心運作、或原先被微軟封印的原廠核心運作 ,不用擔心會破壞原有的環境。如果想刪除,用MSCONFIG或BCDEDIT刪除那個開機選單項 目即可,解除封印後的核心檔案刪不刪都沒差,因為一旦沒了開機選單項目,這個核心也 無從被載入執行。 轉載自 Mobile01論壇的 " 關於記憶體軟體ReadyFor4GB" 網址如下 http://5i01.com/topicdetail.php?f=489&t=1526699&p=1 -- 得罪方丈還想跑!? ╞╡ 沒這麼容易~~!!!! ●╱ ╮╲● , , _● ╭ 《●》 ╮ ●_ , , ●╱╭ ╲● ˇ﹨ ● ╳ 〈●/ \█‵ ● █ ● ′█/ \●〉 ╳ ● ∕ˇ ╱< ︺\ ﹤╲ / / /︺ / \ ︺\ \ / ╱ ﹥/︺ >╲ 「╲ 「╲ ╱┐ 「╲ ╱┐ ╱┐ 喝 !! 電 機 系 十 八 銅 人 !!! ψEE54BB 改 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.118.240.74 ※ 編輯: EE54BB 來自: 122.118.240.74 (02/11 02:34)

03/28 08:38, , 1F
給你一個讚 話說 你要退伍沒
03/28 08:38, 1F

04/09 01:23, , 2F
賣靠北!! 阿古哩~
04/09 01:23, 2F

06/30 08:35, , 3F
衰尾連~~~~~~~
06/30 08:35, 3F
文章代碼(AID): #1DL2xJ_y (FCU_EE97B)