Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

function pointer :physical or virtual address

Tags:

c

When we get the address of a function (or any object, for that matter), is it the virtual address or physical address of that object??

like image 292
mawia Avatar asked Aug 24 '09 18:08

mawia


Video Answer


1 Answers

Are you asking about pointers in general?

On most operating systems, they are logical addresses.

The operating system is responsible for translating them into physical addresses through the virtual memory and paging mechanism. This is transparent to the program. That's why a misguided program "hits the boundaries" and GPFs.

On some old systems (e.g., DOS), they would be physical, allowing you to overwrite stuff in other parts of memory.

like image 184
Uri Avatar answered Sep 21 '22 20:09

Uri