<p>In <a href="https://github.com/ipxe/ipxe/pull/36#discussion_r33260084">src/arch/i386/image/freebsd.c</a>:</p>
<pre style='color:#555'>> +
> + // Copy image
> + for_each_image ( module_image ) {
> + if (image == module_image) continue;
> + memcpy_user(phys_to_user(buffer), 0, module_image->data, 0, module_image->len);
> + buffer += ALIGN_PAGE(module_image->len);
> + }
> +
> + kern_end = buffer;
> +
> + entry_lo = ehdr.e_entry & 0xffffffff;
> + entry_hi = (ehdr.e_entry >> 32) & 0xffffffff;
> +
> + for (i = 0; i < 512; i++) {
> + /* Each slot of the level 4 pages points to the same level 3 page */
> + PT4[i] = (p4_entry_t)VTOP((void *)&PT3[0]);
</pre>
<p>For this one, I need to get back the physical address of PT3, see <a href="https://svnweb.freebsd.org/base/head/sys/boot/i386/libi386/elf64_freebsd.c?view=markup#l98">https://svnweb.freebsd.org/base/head/sys/boot/i386/libi386/elf64_freebsd.c?view=markup#l98</a>.</p>
<p>vtop is defined <a href="https://svnweb.freebsd.org/base/head/sys/boot/i386/btx/lib/btxv86.h?view=markup#l57">https://svnweb.freebsd.org/base/head/sys/boot/i386/btx/lib/btxv86.h?view=markup#l57</a> and __base <a href="https://svnweb.freebsd.org/base/head/sys/boot/i386/btx/lib/btxcsu.S?view=markup#l39">https://svnweb.freebsd.org/base/head/sys/boot/i386/btx/lib/btxcsu.S?view=markup#l39</a></p>
<p>It looks like virtual_to_phys does not behave the same.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/ipxe/ipxe/pull/36/files#r33260084">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AArTVLY7V3chJ8Nl1WAjx0zX984kHvT1ks5oXAcBgaJpZM4FLzyb.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/ipxe/ipxe/pull/36/files#r33260084"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>