[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Virtual and Linear addresses



pandari kashyap wrote:

1. Why can't Kernel access physical addresses?

Because the CPU runs in protected mode.


Then what kind of address is 0xffff0000 if we assume that the system has 2GB of RAM. Is it Linear or physical?. In case it is linear what if we want to store 'a' in physical address 0xffff0000??

That is a virtual address, which happens to correspond to linear because segments are rarely used in Linux.

2. What is the difference and philosophy between kmalloc and vmalloc?

kmalloc gives you physically contiguous memory, which makes it possible to use the memory as one chunk for device DMA or for other special needs.

However, such physically contiguous chunks are much harder to
find and may not always be available.

Vmalloc gives you a memory allocation that is only virtually
contiguous, and may be virtually discontiguous.  This allows
for larger allocations.


-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/