title: How remap_pfn_range remaps kernel memory to user space?
body: <p><code>remap_pfn_range</code> function (used in <code>mmap</code> call in driver) can be used to map kernel memory to user space. How is it done? Can anyone explain precise steps? Kernel Mode is a privileged mode (PM) while user space is non privileged (NPM). In PM CPU can access all memory while in NPM some memory is restricted - cannot be accessed by CPU. When <code>remap_pfn_range</code> is called, how is that range of memory which was restricted only to PM is now accessible to user space?</p>
  
  <p>Looking at <code>remap_pfn_range</code> code there is <code>pgprot_t struct</code>. This is protection mapping related struct. What is protection mapping? Is it the answer to above question?</p>