Page 1 of 1
df's direct probe RAM function: wbinvd?
Posted: Mon Dec 22, 2003 12:43 pm
by stonedzealot
I was looking at the methods for counting memory on the OS Faq here and reading the function DF wrote for direct probing the RAM for size. I followed it throughout most of the goings on, but I don't see why it's necessary to dump the CPU and external caches to count RAM...what's happening?
Re:df's direct probe RAM function: wbinvd?
Posted: Mon Dec 22, 2003 2:39 pm
by df
you shouldnt use that function
probing ram is bad.
as for the wbinvd, you dont want the caches ghosting any addresses that dont physically exist.
Re:df's direct probe RAM function: wbinvd?
Posted: Tue Dec 23, 2003 7:21 am
by Pype.Clicker
wangpeng wrote:
I don't see why it's necessary to dump the CPU and external caches to count RAM...what's happening?
the cache does not know about valid/invalid addresses.
Code: Select all
CPU: write "0x55AA55AA" to 0x12345600
Cache: read line from memory,
-- as no memory chip will respond, a "0xFFFFFFFF" word will be read from the data bus.
Cache: combine with cpu-written word:
[0x12345600]->[55AA55AA-FFFFFFFF-FFFFFFFF-FFFFFFFF]
Cache: write back
-- no memory chip will get that line, as 0x12345600 is out of the physical available memory
Now, if the CPU try to read 0x12345600 again, it will get [55AA55AA] out of the cache line and believe there's memory under that address.
By invalidating the cache, it will lead to
Code: Select all
CPU : read 0x12345600
Cache : no entry for 0x12345600, ask memory
-- no memory chip respond : a "ffff" line is read out of the data bus
Cache : [0x12345600] --> [FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF]
Reply to CPU with 0xFFFFFFFF.
now, the cpu can see 0xFFFFFFFF != 0x55aa55aa and deduces there's no memory there ...
Re:df's direct probe RAM function: wbinvd?
Posted: Tue Dec 23, 2003 5:20 pm
by stonedzealot
Ah, okay. That makes a lot of sense. As for not memory probing...I guess I'll just have to use the BIOS info
. At least now I know another opcode