简体   繁体   English

函数指针:物理或虚拟地址

[英]function pointer :physical or virtual address

当我们得到一个函数的地址或任何对象时,它是该对象的虚拟地址或物理地址?

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. 这就是误入歧途的程序“触及边界”和GPF的原因。

On some old systems (eg, DOS), they would be physical, allowing you to overwrite stuff in other parts of memory. 在一些旧系统(例如DOS)上,它们是物理的,允许你覆盖内存其他部分的内容。

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. 对于现代操作系统上的普通用户登陆程序,您将获得虚拟地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM