Thanks Mark,
This is probably I will have to use. I will also look at the links MM gave.
I was looking for few possiblities —
-
Any registry entries in the system hive ? No luck !
-
Any global kernel exports ( it is an ugly thought ).
-
Any Bios probe at early stage ( even uglier than (2), soon we would all be in (U)EFI …)
-
Documented DDI to use
-
Undocumented DDI ( What a (wo)man got a do is what a … kind of approach )
-
Did not think about probing tables as suggested by MM
-
Testing memory in a loop ( not a well thought out plan though )
-pro
----- Original Message -----
From: Mark Roddy
To: Windows System Software Devs Interest List
Sent: Friday, September 28, 2007 5:55 AM
Subject: RE: [ntdev] How to find Physical Memory size from a boot time driver ?
Nt(Zw) QuerySystemInformation is documented online at MSDN (and not in the ‘official’ ddk docs?) but the definition of SYSTEM_BASIC_INFORMATION is obfuscated.
typedef struct _SYSTEM_BASIC_INFORMATION {
BYTE Reserved1[24];
PVOID Reserved2[4];
CCHAR NumberOfProcessors;
} SYSTEM_BASIC_INFORMATION;
http://msdn2.microsoft.com/en-us/library/ms724509.aspx
Google reveals that the page size is the third ULONG in the Reserved1 block of stuff and the number of physical pages is the fourth. Obviously you cannot count on those fields as they aren’t documented but you can certainly check that page size makes sense before using number of physical pages.
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Prokash Sinha
Sent: Friday, September 28, 2007 12:24 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to find Physical Memory size from a boot time driver ?
Temporal Need:: On a PEA or 64bit system I would want to know what is the total amount of physical memory OS thinks it has.
ZwQuerySystemInformation is one option using SystemBasicInformation, but I don’t think it is a document DDI !
If I see system has (let say) more than 32GB , I would like to make the DMA interface tobe 32bit ( not worried about double buffering or transperant bounce buffering performance hit at this time as well as any possbile data corruption due to DAC related issues). Also the virtual memory assoicated with these physical host addresses are not in my control ( in other words it is not my allocation so I can not specify what is absolute highest physical address I would like to have for these allocation).
I can not use the win32 WAE interface, since it is boot time.
Thx
-pro
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer