Question

I have very simple question. I'm not able to find the answer on my own as I don't have any environment to test it.

If I access 4 bytes on the edge of page, what will happen?

mov eax, dword [0x100000+4095]

What will be the upper three bytes when I have access to page on 0x101000 and when I don't?

Please help.

Était-ce utile?

La solution

What happnes depends mostly on your operating system. If you have normal memory access, then nothing will happen. the value is simply read whatever is there at the time. If access to the page is not allowed, then your program will generate a page fault, which the OS has to deal with.

If the page is on disc, because it was swapped out, then the OS will load the page, and resume your program where it left off. Your programm will not notice this. If the page is invalid then the OS will raise an exception and depending on the OS you may be able to catch it, or your program will crash.

If the access is done on the kernel level and can not be resolved, your OS will most likely crash with a kernel panic, or if it is well written, it may just disable the driver, that caused it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top