物理寻址和虚拟寻址概念的区别
这是重新提交,因为我没有收到 superuser.com 的任何回复。抱歉造成误解。
我需要了解嵌入式系统中物理寻址和虚拟寻址概念的区别。
为什么在嵌入式系统中采用虚拟寻址概念?
在嵌入式系统中,虚拟寻址相对于具有物理寻址概念的系统有什么优势?
嵌入式系统中虚拟寻址到物理寻址的映射是如何完成的?
请用一些简单架构中的一些简单示例来解释上述概念。
This is a re-submission, because I am not getting any response from superuser.com. Sorry for the misunderstanding.
I need to know the difference between physical addressing and virtual addressing concept in embedded systems.
Why virtual addressing concept is implemented in embedded systems?
What is the advantage of the virtual addressing over a system with physical addressing concept in embedded systems?
How the mapping between virtual addressing to physical addressing is done in embedded systems?
Please, explain the above concept with some simple examples in some simple architecture.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
物理寻址意味着您的程序实际上知道 RAM 的真实布局。当您访问地址 0x8746b3 处的变量时,这就是它真正存储在物理 RAM 芯片中的位置。
通过虚拟寻址,所有应用程序内存访问都会进入页表,然后页表从虚拟地址映射到物理地址。因此,每个应用程序都有自己的“私有”地址空间,并且任何程序都无法读取或写入另一个程序的内存。这称为细分。
虚拟寻址有很多好处。它可以防止程序因不良的指针操作等而相互崩溃。因为每个程序都有自己独特的虚拟内存集,所以没有程序可以读取另一个程序的数据 - 这既是安全又是安全的优点。虚拟内存还支持分页,程序的物理 RAM 在不使用时可以存储在磁盘(或者现在是速度较慢的闪存)上,然后在应用程序尝试访问该页面时回调。此外,由于只有一个程序可能驻留在特定的物理页上,因此在物理分页系统中,要么a)所有程序必须编译为加载到不同的内存地址,要么b)每个程序必须使用Position - 独立代码,或 c) 某些程序集不能同时运行。
物理-虚拟映射可以用软件(具有内存陷阱的硬件支持)或纯硬件来完成。有时甚至页表本身也位于一组特殊的硬件内存上。我根本不知道哪个嵌入式系统做什么,但每个桌面都有一个硬件 TLB(转换后备缓冲区,基本上是虚拟物理映射的缓存),有些现在拥有高级内存映射单元,可以帮助虚拟机之类的。
虚拟内存的唯一缺点是硬件实现的复杂性增加和性能降低。
Physical addressing means that your program actually knows the real layout of RAM. When you access a variable at address 0x8746b3, that's where it's really stored in the physical RAM chips.
With virtual addressing, all application memory accesses go to a page table, which then maps from the virtual to the physical address. So every application has its own "private" address space, and no program can read or write to another program's memory. This is called segmentation.
Virtual addressing has many benefits. It protects programs from crashing each other through poor pointer manipulation, etc. Because each program has its own distinct virtual memory set, no program can read another's data - this is both a safety and a security plus. Virtual memory also enables paging, where a program's physical RAM may be stored on a disk (or, now, slower flash) when not in use, then called back when an application attempts to access the page. Also, since only one program may be resident at a particular physical page, in a physical paging system, either a) all programs must be compiled to load at different memory addresses or b) every program must use Position-Independent Code, or c) some sets of programs cannot run simultaneously.
The physical-virtual mapping may be done in software (with hardware support for memory traps) or in pure hardware. Sometimes even the page tables themselves are on a special set of hardware memory. I don't know off the top of my head which embedded system does what, but every desktop has a hardware TLB (Translation Lookaside Buffer, basically a cache for the virtual-physical mappings) and some now have advanced Memory Mapping Units that help with virtual machines and the like.
The only downsides of virtual memory are added complexity in the hardware implementation and slower performance.
VAX(由数字设备公司扩展的虚拟地址,后来成为康柏,后来成为惠普)是虚拟嵌入式硬件系统的一个很好的例子。它是一台 32 位迷你计算机,有一个称为 VMS 或虚拟内存系统的操作系统。 Dave Cutler 是该系统的主要架构师之一,他在很久之后为 Windows NT 编写了内核。他非常适合阅读这本书和其他内容。 Vax 有特殊的硬件来控制虚拟空间和控制操作码访问,以通过硬件实现安全……非常安全。该系统曾经是或现在是现代 PC 内核级的鼻祖。我在 WNT 3.51 上看到的第一个 BSOD 是因为它来自 VMS 中用于在不稳定时停止系统的故障转储。顺便看看 VMS 和 WNT 这个名称,您会发现 VMS 中的字母中的下一个字母构成了术语 WNT。这并非意外。也许是对 DEC 放走他的攻击。
The VAX (Virtual Address eXtented by Digital Equipment Corp which became Compaq, which became HP) is a very good example of an virtual embeded hardware system. It was a 32 bit mini computer that had an OS called VMS or Virtual Memory Systems. Dave Cutler was one of the principle architets of the systems and he much later wrote the Kernal for Windows NT. He is a very good read for this and other stuff. The Vax had special hardware for control of the virtual space and control of opcode access for security through hardware... very secure. This system was or is the grandfather of the modfern day PC at the Kernal Level. The first BSOD I saw on WNT 3.51 I was able to read because it came from the crash dump used in VMS to stop the system when unstable. By te way Look at the name VMS and WNT and you will find the next letters in the alhabet from VMS makes the term WNT. This was not an accident. maybe a jab at DEC for letting him go.