<story><title>Show HN: A simple way to write standalone C programs for i386</title><url>https://github.com/luke8086/boot2c</url></story><parent_chain></parent_chain><comment><author>rwmj</author><text>We actually wrote an optionrom in C for qemu a few years back.  The main challenge was making it work on all the different C compilers that qemu supports because it makes some assumptions about the layout of the final binary which are not necessarily true for modern optimizing compilers.  Anyhow if ever use qemu on x86 with the -kernel option then you are running this code.&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;git.qemu.org&amp;#x2F;?p=qemu.git;a=blob;f=pc-bios&amp;#x2F;optionrom&amp;#x2F;linuxboot_dma.c&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;git.qemu.org&amp;#x2F;?p=qemu.git;a=blob;f=pc-bios&amp;#x2F;optionrom&amp;#x2F;...&lt;/a&gt;</text></comment>
<story><title>Show HN: A simple way to write standalone C programs for i386</title><url>https://github.com/luke8086/boot2c</url></story><parent_chain></parent_chain><comment><author>saagarjha</author><text>The code was surprisingly short and readable. If you have a minute, I’d suggest taking a peek; it’s pretty well designed.</text></comment>