In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The following is for personal understanding only. If there are any deficiencies, please correct them.
Link address, physical address, virtual address these three addresses have their own differences, this is also what I figured out in the process of development and learning, online search is very professional, not very easy to understand, it feels a little difficult to understand. Therefore, I would like to talk about the functions of these three from the perspective of personal understanding.
Physical address
Relatively simple, that is, the real address assigned in the memory (SRAM,SDRAM). The physical address of 2440 of the pre-SRAM 4KB is: 0x00000000~0x00400000. The starting physical address of the SDRAM is 0x30000000.
There is a basic knowledge of assembly, the process of running the program is controlled by the PC pointer, which address the PC pointer points to, the program will go to this address to execute.
Usually, there is no virtual address, the address accessed by the PC is the physical address, and the PC points directly to the physical address, executing relevant code instructions, control registers and other actions in the memory.
Virtual address
Sometimes, if the amount of the program is too large, the memory can not satisfy the running of the program, and some physical addresses in the memory can be shared by some different program instructions. therefore, in order to improve the utilization of memory, the idea of virtual memory address is adopted, the capacity of the virtual address is larger than that of the actual physical address, and the program runs on the virtual address during execution, that is, the PC pointer points to the virtual address. But the virtual address operation cannot control the physical address that actually exists, so those registers cannot be controlled. Therefore, an address mapper (translator) is needed to map the virtual address to the corresponding physical address (where multiple virtual addresses can correspond to the same physical address), so as to control the physical address. This address mapper is called a memory management unit (MMU). Not all chips have such a unit, but 2440 has this unit function internally, so the idea of virtual address can be used to run the program. A 32-bit 2440 can establish a virtual memory space of 0 ~ 2 ^ 32 = 0~4GB
Link address
The feeling is not very easy to understand, I feel that it is also a kind of virtual address, but it is not exactly. After defining the link address in the makefile file, such as:
Arm-linux-ld-Ttext 0x3000000-g-o led_on_elf crt0.o led_lighton.o
Then execute make to compile and link, and then link to generate the final executable file led_on_elf. The first instruction code of this file will give it a link header address, which is 0x3000000. After the second instruction, go up in turn. At this time, the program has not been recorded into the chip, but each instruction has a corresponding link address label. After the program is burned to the chip, the program is still executed according to the physical or virtual address pointed to by PC (the first address of the PC is the first address of the program burned to the chip). At this point, the link address is only a label for each instruction and has no effect, only when the PC is assigned directly in the instruction, such as ldr pc,=main. Then the program will find the address label corresponding to the main function, assign the address label, that is, the link address, to PC, and then the address running by PC will be executed with the link address, which is equal to the PC running address, and the link address will be synchronized with the physical (virtual) address. (or: ldr pc,=0x30000010,PC will jump to the place where the link address is 0x30000010 to run, and 0x30000010 becomes the physical (virtual) address.)
Therefore, I think it is more vivid to call this link address the address label of the code. Only when the assignment to PC is performed can the effect of location change be achieved, and the link address will be read out and have an effect. Otherwise, when the program is powered on, PC still runs by default according to the first address of the code in the chip.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.