This question is more hardware specific, but I think that there are maybe some other who doesn?t know it.
I?ve written my paging init code. The problem now is that it only fills the page table for every 4mb. That means if my OS runs on a PC where are 5MB, it can only access 4MB or on a PC where are 34MB, it can only access 32MB!
So I want to know, if I can be sure that on every PC the RAM size can be divided by 4.
Memory size
Re:Memory size
You should load one more page table for the end of the memory, which doesn't necessarily have to fill the table. You could just use the entries for memory that exists, and leave the others as unmapped.
Re:Memory size
You can assume that since AFAIK there are no 72-pin SIMM, SDR DIMM, DDR DIMM or RIMMs that have any amount of memory not divisable by 4mb, and that computers that use 30-pin memory are at most 486s, that you VERY PROBABLY won't find a computer that has that. And even then, people operating those computers are usually computer geeks (no normal user nowadays runs a 486) and they kind of like powers of 2, so you'd expect 4mb or 8mb.Axiom wrote: You should load one more page table for the end of the memory, which doesn't necessarily have to fill the table. You could just use the entries for memory that exists, and leave the others as unmapped.
Note, if it is not divisable by 4mb it is very probable that the total is <4mb.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Memory size
@candy: no need to say that, by following the assumptions you propose, we'll end up with a system that is certainly not robust.
As axiom said, there's no need at all for page tables to be complete. You can have a page table that maps frames ranging from X to X+1Mb and leave the highest 768 entries of the table as "non-present" pages.
Btw, why would you wish to have all your physical memory mapped ? this is not a necessity in a paged system, which are more likely to map any virtual address to whatever physical frame the system provided when the virtual address was first requested.
As axiom said, there's no need at all for page tables to be complete. You can have a page table that maps frames ranging from X to X+1Mb and leave the highest 768 entries of the table as "non-present" pages.
Btw, why would you wish to have all your physical memory mapped ? this is not a necessity in a paged system, which are more likely to map any virtual address to whatever physical frame the system provided when the virtual address was first requested.
Re:Memory size
Pype, since it would only allow LESS memory to be used in these cases, and not much less in any case, it would be worth not adding extra code since it would reduce the complexity of the entire code, thereby increasing the robustness of the system as a whole.Pype.Clicker wrote: @candy: no need to say that, by following the assumptions you propose, we'll end up with a system that is certainly not robust.
As for my own I'm going to add a memory checker that checks every page before first use (excluding the first 4mb) and makes sure that it works. This way, no indecent byte can go through, even if all other bytes in the page are OK.
Why would you think it would become less robust?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Memory size
maybe 'robustness' wasn't really appropriate. What i meant is that this kind of assumption is likely to make the system behave weirdly on small machines. The memory amount report wouldn't be much reliable (of course, you're sure you have what has been reported, but you're not sure you don't have more)
Candy wrote: people operating those computers are usually computer geeks (no normal user nowadays runs a 486) and they kind of like powers of 2, so you'd expect 4mb or 8mb.
Note, if it is not divisable by 4mb it is very probable that the total is <4mb.