title: How procfs outputs /proc/iomem?
body: <p>I have looked into similar questions on this site (listed at the end) but still feel like missing a couple points, hopefully someone can help here:</p>
  
  <ol>
  <li><p>Is there a hook into the <code>proc</code> file system that connects the <code>/proc/iomem</code> <code>inode</code> to a function that dumps the information? I wasn't able to find where in proc fs this function lives. I did a <code>grep</code> under the linux source tree <code>fs/proc</code> for <code>iomem</code>, got nothing. So maybe it is a more of a <code>procfs</code> question... The answer to this question might help me to dig up the answer to the next question..</p></li>
  <li><p>The <code>/proc/iomem</code> has more entries than the BIOS E820 information I extracted from either <code>dmesg</code> or <code>/sys/firmware/memmap</code> (these two are actually consistent with each other). For example, <code>/sys/firmware/memmap</code> does not seem to have pci memory mapped regions. Drivers' init code calls the <code>request_mem_region()</code> and add more info to the map, so somewhere there should be a global variable (root of all resources ?) that remembers this graph?</p></li>
  </ol>
  
  <p>The questions on stackoverflow I have looked into:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/a/43794633/608639">How is /proc/io* populated?</a></li>
  <li><a href="https://stackoverflow.com/q/39217907/608639">Expose information to /proc/iomem</a></li>
  <li><a href="https://stackoverflow.com/a/18583109/608639">Content of /proc/iomem</a></li>
  </ul>