Difference between Kernel Virtual Address and Kernel Logical Address?

后端 未结 4 968
孤城傲影
孤城傲影 2021-01-31 04:07

I am not able to exactly difference between kernel logical address and virtual address. In Linux device driver book it says that all logical address are kernel virtual address,

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-31 04:44

    Basically there are 3 kinds of addressing, namely

    1. Logical Addressing : Address is formed by base and offset. This is nothing but segmented addressing, where the address (or offset) in the program is always used with the base value in the segment descriptor
    2. Linear Addressing : Also called virtual address. Here adresses are contigous, but the physical address are not. Paging is used to implement this.
    3. Physical addressing : The actual address on the Main Memory!

    Now, in linux, Kernel memory (in address space) is beyond 3 GB ( 3GB to 4GB), i.e. 0xc000000..The addresses used by Kernel are not Physical addresses. To map the virtual address it uses PAGE_OFFSET. Care must be taken that no page translation is involved. i.e. these addresses are contiguous in nature. However there is a limit to this, i.e. 896 MB on x86. Beyond which paging is used for translation. When you use vmalloc, these addresses are returned to access the allocated memory.

    In short, when someone refers to Virtual Memory in context of User Space, then it is through Paging. If Kernel Virtual Memory is mentioned then it is either PAGE_OFFSETed or vmalloced address.

    (Reference - Understanding Linux Kernel - 2.6 based )

    Shash

提交回复
热议问题