gpt4 book ai didi

memory - CPU物理地址空间如何映射到物理DRAM?

转载 作者:行者123 更新时间:2023-12-02 06:22:32 27 4
gpt4 key购买 nike

在系统内存映射(也称为 cpu 内存映射)中,地址范围分配给 RAM 内存范围、PCI 设备的 MMIO 等。

我们举个例子,RAM 的地址范围从地址 0 开始到 512MB,其中包括 DOS 兼容内存空间,从 0 开始到 1MB。

现在,当我们说这 512MB 的区域将被映射到内存时,这是否意味着 CPU 地址空间中的地址 0 将被映射到物理 RAM 中的地址 0,并且同样会映射到 512MB?如果不是那么映射是如何完成的?

CPU 地址空间中分配的内存地址范围是否与系统中安装的 RAM 的大小完全相同?如果不是这种情况那么在这种情况下映射将如何进行?

DOS兼容区域的内存映射是如何完成的?如果使用 DOS 以外的操作系统,该区域是否会在内存中未被使用?

内存映射是否意味着当CPU生成0到512MB的地址时只会被重定向到RAM中? CPU 生成的任何其他地址永远不会被 MMU 定向到 RAM 中?在这种情况下,所有应用程序的地址范围都在 0 到 512MB 之间,以便访问内存?

我正在考虑使用 x86 系统。

最佳答案

在讨论这个问题之前,值得先看一下 DRAM architecture .

Now when we say that this 512MB of region will be mapped into the memory, does this mean that the address 0 in the CPU address space will be mapped to address 0 in the Physical RAM and the same goes up to 512MB? If not then how the mapping is done?

DRAM 中并不存在“地址 0”的概念,而是存在一个由 channel DIMM组成的架构>、芯片,并且 DRAM Controller 生成激活部分的“命令” DRAM 并从单元中选择数据:enter image description here

所以第一个问题的答案是否定的。正如其他人提到的,确切的映射很复杂并且没有记录。如果您有兴趣,AMD确实提供了documentation (第2.10和3.5节),并且有reverse engineering的尝试英特尔的映射(第 4 节)。

Also does the memory address ranges allocated in CPU address space will be exactly equal to the size of the RAM installed in the system? If its not the case then how the mapping would take place in such case?

出于多种原因,答案也是否定的。您回答了其中之一:物理地址空间不仅仅代表RAM/内存,还有PCIe设备、ROM(BIOS所在的位置)等,因此有memory holes 。要检查物理地址在系统中对应的内容,请在 Linux 中查看 /proc/iomem,因为它具有映射。

Also how will memory mapping of DOS compatibility region be done? Does this region will be unused into the memory if using an OS other than DOS?

是的,我相信这些是未使用的内存漏洞。

Also does the memory mapping means that when the CPU generates the address from 0 to 512 MB only will be redirected into the RAM ? Any other address generated by CPU will never be directed into the RAM by MMU ? In such case all the application would have the address between ranges from 0 to 512MB inorder to access the Memory ?

MMU 具有完全不同的用途。看一下虚拟地址到物理地址的转换。

关于memory - CPU物理地址空间如何映射到物理DRAM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52253905/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com