<div dir="ltr"><div>I believe I have found the problem. The issue is that the memcpy being linked in ./arch/x86/boot/main.c and ./arch/x86/boot/memory.c, etc to create ./arch/x86/boot/setup.bin is different then the one being compiled. Specifically, memcpy from ./arch/x86/boot/copy.S gets linked into setup.elf/setup.bin and memcpy from ./arch/x86/boot/string.h is used when compiling in ./arch/x86/boot/main.c and ./arch/x86/boot/memory.c. The parameters for memcpy for string.h are sent via the stack while the memcpy from copy.S are passed via registers...<br><br>Here is the disassembly...<br><br></div><div>objdump -d ./arch/x86/boot/setup.elf -M i8086<br>...<br>00000910 &lt;memcpy&gt;: &lt;------------ This is from ./arch/x86/boot/copy.S<br>     910:       56                      push   %si<br>     911:       57                      push   %di<br>     912:       89 c7                   mov    %ax,%di<br>     914:       89 d6                   mov    %dx,%si<br>     916:       51                      push   %cx<br>     917:       c1 e9 02                shr    $0x2,%cx<br>     91a:       f3 66 a5                rep movsl %ds:(%si),%es:(%di)<br>     91d:       59                      pop    %cx<br>     91e:       83 e1 03                and    $0x3,%cx<br>     921:       f3 a4                   rep movsb %ds:(%si),%es:(%di)<br>     923:       5f                      pop    %di<br>     924:       5e                      pop    %si<br>     925:       66 c3                   retl<br>...<br>00000945 &lt;copy_from_fs&gt;: &lt;-------- Defined in copy.S, no problem here<br>     945:       1e                      push   %ds<br>     946:       0f a0                   push   %fs<br>     948:       1f                      pop    %ds<br>     949:       66 e8 c1 ff ff ff       calll  910 &lt;memcpy&gt;<br>     94f:       1f                      pop    %ds<br>     950:       66 c3                   retl<br><br>00000952 &lt;copy_to_fs&gt;: &lt;-------- Defined in copy.S, no problem here<br>     952:       06                      push   %es<br>     953:       0f a0                   push   %fs<br>     955:       07                      pop    %es<br>     956:       66 e8 b4 ff ff ff       calll  910 &lt;memcpy&gt;<br>     95c:       07                      pop    %es<br>     95d:       66 c3                   retl<br>     95f:       90                      nop<br>...<br>00001340 &lt;main&gt;: &lt;------ memcpy referenced in arch/x86/boot/string.h<br>    1340:       66 56                   push   %esi<br>    1342:       66 83 ec 78             sub    $0x78,%esp<br>    1346:       67 66 c7 44 24 08 77    movl   $0x77,0x8(%esp) <br>    134d:       00 00 00<br>    1350:       67 66 c7 44 24 04 f1    movl   $0x1f1,0x4(%esp)<br>    1357:       01 00 00<br>    135a:       67 66 c7 04 24 91 44    movl   $0x4491,(%esp)<br>    1361:       00 00<br>    1363:       66 e8 a7 f5 ff ff       calll  910 &lt;memcpy&gt; &lt;----- params set via stack but function expects params via registers<br><br></div><div>Can someone provide me an idea how to fix this? I tried several things like renaming the copy.S version but there is a LLVM backend bug that gets thrown.<br><br>Thanks,<br><br>Jason<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 2, 2014 at 1:59 PM, Jan-Simon Moeller <span dir="ltr">&lt;<a href="mailto:dl9pf@gmx.de" target="_blank">dl9pf@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi !<br>
<br>
Thanks for the report.   Let&#39;s see.   Can you start with a really simple<br>
configuration of the kernel (no smp, no tracing, SLUB allocator ! )<br>
<br>
Right now we know the SLAB allocator i broken (check your .config).<br>
<br>
Best regards,<br>
Jan-Simon<br>
<br>
<br>
Am Samstag, 1. November 2014, 16:06:37 schrieb Jason Gionta:<br>
<div class="HOEnZb"><div class="h5">&gt; Hi,<br>
&gt;<br>
&gt; I am trying to get LLVMLinux to boot in QEMU using the latest Git hub<br>
&gt; sources building both the base source tree (make HOSTCC=clang CC=clang ...)<br>
&gt; and through the build architecture (./target/x86_64_tiny,./target/x86_64).<br>
&gt; I have followed the instruction from both<br>
&gt; <a href="http://llvm.linuxfoundation.org/index.php/X86_64" target="_blank">http://llvm.linuxfoundation.org/index.php/X86_64</a> and<br>
&gt; <a href="http://llvm.linuxfoundation.org/index.php/Main_Page" target="_blank">http://llvm.linuxfoundation.org/index.php/Main_Page</a><br>
&gt;<br>
&gt; All three builds succeed but fail to boot during the setup stage and show<br>
&gt; &quot;Warning: Ancient bootloader, some functionality may be limited!&quot; after<br>
&gt; which the setup seems to hang never reaching init/main.c:start_kernel. (I<br>
&gt; set a gdb break point on start_kernel)<br>
<br>
<br>
<br>
&gt; Can anyone else confirm this or help point me to how to begin solving this<br>
&gt; problem? I am having trouble debugging the boot code through gdb because<br>
&gt; the vmlinux doesn&#39;t have the boot setup symbols. At a minimum I would<br>
&gt; believe the x86_64_tiny should boot but it certainly doesn&#39;t.<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; Jason<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Jason Gionta<br>Cyber Defense Lab<br>North Carolina State University<br><a href="mailto:jjgionta@ncsu.edu">jjgionta@ncsu.edu</a></div>
</div>