Reputation: 9349
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??
Upvotes: 19
Views: 4949
Reputation: 76660
Depends on the OS and at what level your code is running.
For a normal user-land program on a modern OS, you will get the virtual address.
Upvotes: 11
Reputation: 89749
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.
Upvotes: 17