Hi all, my first post!
I have 12M memory and no paging enabled (so linear address = phy add ?) and only 2 gdt entries (no user space) then
shouldn't asm volatile ("mov 0x1ef0000,%eax") produce some error ?
but as it seems it works fine. What is the thing that I am missing ?
Some Memory Related Quries
Re: Some Memory Related Quries
No, there is no data abort exception on x86, so no error will be detected.
Re: Some Memory Related Quries
so I can go on accessing all the mem upto 4gb and nothing will happen ? kinda odd..
Re: Some Memory Related Quries
The unfortunate thing is that some devices might use higher physical memory addresses for buffers (e.g. Bochs' 0xE0000000 LFB address), which you would be restricting yourself from using as well (I think), but I may be wrong.berkus wrote:Do you have segment limit on your GDT entries? If you limit them to 12Mb you should get a protection fault when accessing outside that segment.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Re: Some Memory Related Quries
It is actually paging that provides memory protection and isolation in most modern OS designs. The reason that you can access all memory is that paging is disabled and presumably your segment limits are large. Enable paging and you'll get plenty of faults.so I can go on accessing all the mem upto 4gb and nothing will happen ? kinda odd..
If a trainstation is where trains stop, what is a workstation ?
Re: Some Memory Related Quries
yup.. it seems if paging is disabled then if I access any memory which is not present (above 12MB in this case) the data returned is FFFF ...
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Some Memory Related Quries
That has nothing to do with paging being disabled...
Re: Some Memory Related Quries
As far as the processor is concerned, it has 4GB of memory that it can access, it doesn't know that the memory space is actually full of system RAM, BIOS ROM, device buffers, device ROM, and a fairly large number of holes where no memory exists.
What segmentation and / or paging (virtual memory) do is make the processor restrict what from this 4GB space the code is allowed to access. Setting a segment size of 8MB and trying to access memory above that cause an Int 0x13 General Protection Fault. Enabling paging and accessing memory that isn't mapped with cause a Page Fault.
If, from these methods, the processor has decided that it is allowed to access that memory address, it sends a request to other parts of the system (the North Bridge, PCI bus, whatever is mapped to that address) and waits for a response. It is for electrical reasons (the way the processor interprets the signals on the wires) that you get 0xFF returned if you try to read memory that doesn't exist.
Just to complicate matters, it is possible that if you try to read non-existent memory, that the memory controller will step in and return sometihng other than 0xFF, possibly 0x00, possibly even the last value that written to the data bus. It is also feasible that due to memory caching, you could write a value into a memory hole and then read it back correctly.
If you are interested in finding out which blocks of memory your system has available, there are a number of BIOS calls that can be made, more information can be found on http://wiki.osdev.org/Detecting_Memory_%28x86%29.
Hope this helps
What segmentation and / or paging (virtual memory) do is make the processor restrict what from this 4GB space the code is allowed to access. Setting a segment size of 8MB and trying to access memory above that cause an Int 0x13 General Protection Fault. Enabling paging and accessing memory that isn't mapped with cause a Page Fault.
If, from these methods, the processor has decided that it is allowed to access that memory address, it sends a request to other parts of the system (the North Bridge, PCI bus, whatever is mapped to that address) and waits for a response. It is for electrical reasons (the way the processor interprets the signals on the wires) that you get 0xFF returned if you try to read memory that doesn't exist.
Just to complicate matters, it is possible that if you try to read non-existent memory, that the memory controller will step in and return sometihng other than 0xFF, possibly 0x00, possibly even the last value that written to the data bus. It is also feasible that due to memory caching, you could write a value into a memory hole and then read it back correctly.
If you are interested in finding out which blocks of memory your system has available, there are a number of BIOS calls that can be made, more information can be found on http://wiki.osdev.org/Detecting_Memory_%28x86%29.
Hope this helps