<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>mmap() is used for the following. <br><br></div>1. Maps device physical address (device memory or device registers ) to user virtual address, Of course, the completion of this will happen with the help of the driver mmap which will actually map the user virtual address to physical address  with the help of remap_pfn_range().<br></div>2. Maps regular file contents to the user virtual address. Most likely used instead of read(), which is expensive in time in copying data from kernel buffers<br></div>    user buffers. Use mmap cautiously, do not append the file after mmaping. <br></div>3. Allocate address region or virtual memory region for the user application. Can be used instead of malloc(), if you know what you are doing. <br>         Almost all of the libc file operations uses mmap. To verify, write an application which uses fprintf or fwrite and check out using strace.<br><br></div>ioremap()<br></div>1. maps device physical address(device memory or device registers) to kernel virtual address<br></div><br></div><br></div>Regards,<br></div>Prabhu<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 6, 2016 at 8:13 PM, Er Krishna <span dir="ltr">&lt;<a href="mailto:erkrishna@gmail.com" target="_blank">erkrishna@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr"></p>
<p dir="ltr">&gt; Hi all<br>
&gt;<br>
&gt; I am asking this question for understanding purpose:<br>
&gt;<br>
&gt; Please help me here:<br>
&gt;<br>
&gt; What are the core difference between mmap and ioreamp ?<br>
&gt;<br>
&gt; In which scenario one can be used for other and when it can not be ?<br>
&gt;<br>
&gt; Thanks<br>
&gt; Krishna<br></p>
<br>______________________________<wbr>_________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.<wbr>org</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.<wbr>org/mailman/listinfo/<wbr>kernelnewbies</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Regards,<br>Prabhunath G<br>Linux Trainer<br>Bangalore<br></div>
</div>