<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 22, 2015 at 3:38 PM, Jeff Haran <span dir="ltr">&lt;<a href="mailto:Jeff.Haran@citrix.com" target="_blank">Jeff.Haran@citrix.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:kernelnewbies-bounces@kernelnewbies.org" target="_blank">kernelnewbies-bounces@kernelnewbies.org</a> [mailto:<a href="mailto:kernelnewbies-bounces@kernelnewbies.org" target="_blank">kernelnewbies-bounces@kernelnewbies.org</a>]
<b>On Behalf Of </b>Kenneth Adam Miller<br>
<b>Sent:</b> Thursday, October 22, 2015 12:14 PM<br>
<b>To:</b> Kernelnewbies<br>
<b>Subject:</b> Query Hard Memory Addresses<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div><span class="">
<p class="MsoNormal">So, previously it was discussed that /dev/mem could be used to mmap a specific hardware memory into a process. Now I need to unit test some userland code that does exactly that, but I need to make sure that the unit test selects a small
 page that is always free in kernel land. How can I query mem to just grab the location of a free page?<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</span><div><span class="">
<p class="MsoNormal">(my development setup is different from my other deployment; in deployment these values are hard coded, in development they occur on a qemu emulator)<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I suppose it might work to write a kernel module that allocates a page in its init routine and then provides the address to user space via a /proc entry.<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> </span></p></font></span></div></div></div></div></div></blockquote><div><br></div><div>Well see now we&#39;re back to where I was before finding out about /dev/mem. </div><div><br></div><div>In any case, I think I can isolate my userland tests with some shared memory regions at the process level, and then in the production environment serve up a buffer grabbed by mmap.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div><span class="HOEnZb"><font color="#888888"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Jeff Haran<u></u><u></u></span></p>
</font></span></div>
</div>
</div>
</div>
</div>

</blockquote></div><br></div></div>