Detecting Memory

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Therx

Detecting Memory

Post by Therx »

I'm trying to implement the Intel 36bit extensions but how do I detect up to 64gb. The only way I can think of (unless a capable BIOS function exists) is to setup up paging and map a page to a higher and higher address. But this will take all day to get up to 64GB. Unless I can assume that memory sizes will be on of:-
4mb
8mb
16mb
32mb
64mb
...
512mb
1gb
2gb
4gb

But I know that my old 486 has 12mb (4 + 8) and it would be possible to have 1.5 GB etc..

Pete
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Detecting Memory

Post by Perica »

..
Last edited by Perica on Tue Dec 05, 2006 9:26 pm, edited 1 time in total.
Curufir

Re:Detecting Memory

Post by Curufir »

486 is unlikely to have e820.

What will definitely be there is int 15h, 88h (Plenty of info about int 15 on the web) which will give the size of extended memory. Alternatively read the CMOS data directly.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Detecting Memory

Post by Perica »

..
Last edited by Perica on Tue Dec 05, 2006 9:26 pm, edited 1 time in total.
Therx

Re:Detecting Memory

Post by Therx »

No my OS isn't aimed at 486's I was just using that as an example of why I might not be able to rely on the 2^n memory sizes

Pete
Therx

Re:Detecting Memory

Post by Therx »

Will the information passed by GRUB be accurate. I know that the memory size variable formultiboot is only 32bit but what about the memory map. Could that go up to 36bit. Does anyone else use PAE/PSE in their OS. I'm starting to think that its not worth it because I'll probally have to write my own bootsector and also I don't think their are any motherboards with support it.

Pete
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Detecting Memory

Post by Perica »

..
Last edited by Perica on Tue Dec 05, 2006 9:27 pm, edited 1 time in total.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Detecting Memory

Post by Candy »

Pete wrote: Does anyone else use PAE/PSE in their OS. I'm starting to think that its not worth it because I'll probally have to write my own bootsector and also I don't think their are any motherboards with support it.
Well, all processors from PPro+ support 36-bits and up, and from A64 they support 40-bits or more (even in 32-bit mode). Using it only allows for using the NX bit (and only on Itaniums and AMD64s) and that only in special modes. In other words, if you don't aim for the top, it's not worth it. As an aside, Bochs does NOT support PAE as it should. It crashes when setting the registers with the correct values, even when compiling WITH support for AMD64 (which requires PAE). However, I tested my code on multiple physical computers (all AMDs), where the PAE code worked flawlessly. I therefore support it but not on bochs.

Look at my 0.0.2 code for some code that works, it's been prepared to support 64-bit PAE-ish translation so you can probably skip 1/4 of each function.
Post Reply