[llvmlinux] Latest LLVMLinux Git not booting (both from build architecture and source tree)

Jason Gionta jjgionta at ncsu.edu
Sun Nov 2 19:13:58 UTC 2014


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...

Here is the disassembly...

objdump -d ./arch/x86/boot/setup.elf -M i8086
...
00000910 <memcpy>: <------------ This is from ./arch/x86/boot/copy.S
     910:       56                      push   %si
     911:       57                      push   %di
     912:       89 c7                   mov    %ax,%di
     914:       89 d6                   mov    %dx,%si
     916:       51                      push   %cx
     917:       c1 e9 02                shr    $0x2,%cx
     91a:       f3 66 a5                rep movsl %ds:(%si),%es:(%di)
     91d:       59                      pop    %cx
     91e:       83 e1 03                and    $0x3,%cx
     921:       f3 a4                   rep movsb %ds:(%si),%es:(%di)
     923:       5f                      pop    %di
     924:       5e                      pop    %si
     925:       66 c3                   retl
...
00000945 <copy_from_fs>: <-------- Defined in copy.S, no problem here
     945:       1e                      push   %ds
     946:       0f a0                   push   %fs
     948:       1f                      pop    %ds
     949:       66 e8 c1 ff ff ff       calll  910 <memcpy>
     94f:       1f                      pop    %ds
     950:       66 c3                   retl

00000952 <copy_to_fs>: <-------- Defined in copy.S, no problem here
     952:       06                      push   %es
     953:       0f a0                   push   %fs
     955:       07                      pop    %es
     956:       66 e8 b4 ff ff ff       calll  910 <memcpy>
     95c:       07                      pop    %es
     95d:       66 c3                   retl
     95f:       90                      nop
...
00001340 <main>: <------ memcpy referenced in arch/x86/boot/string.h
    1340:       66 56                   push   %esi
    1342:       66 83 ec 78             sub    $0x78,%esp
    1346:       67 66 c7 44 24 08 77    movl   $0x77,0x8(%esp)
    134d:       00 00 00
    1350:       67 66 c7 44 24 04 f1    movl   $0x1f1,0x4(%esp)
    1357:       01 00 00
    135a:       67 66 c7 04 24 91 44    movl   $0x4491,(%esp)
    1361:       00 00
    1363:       66 e8 a7 f5 ff ff       calll  910 <memcpy> <----- params
set via stack but function expects params via registers

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.

Thanks,

Jason


On Sun, Nov 2, 2014 at 1:59 PM, Jan-Simon Moeller <dl9pf at gmx.de> wrote:

> Hi !
>
> Thanks for the report.   Let's see.   Can you start with a really simple
> configuration of the kernel (no smp, no tracing, SLUB allocator ! )
>
> Right now we know the SLAB allocator i broken (check your .config).
>
> Best regards,
> Jan-Simon
>
>
> Am Samstag, 1. November 2014, 16:06:37 schrieb Jason Gionta:
> > Hi,
> >
> > I am trying to get LLVMLinux to boot in QEMU using the latest Git hub
> > sources building both the base source tree (make HOSTCC=clang CC=clang
> ...)
> > and through the build architecture
> (./target/x86_64_tiny,./target/x86_64).
> > I have followed the instruction from both
> > http://llvm.linuxfoundation.org/index.php/X86_64 and
> > http://llvm.linuxfoundation.org/index.php/Main_Page
> >
> > All three builds succeed but fail to boot during the setup stage and show
> > "Warning: Ancient bootloader, some functionality may be limited!" after
> > which the setup seems to hang never reaching init/main.c:start_kernel. (I
> > set a gdb break point on start_kernel)
>
>
>
> > Can anyone else confirm this or help point me to how to begin solving
> this
> > problem? I am having trouble debugging the boot code through gdb because
> > the vmlinux doesn't have the boot setup symbols. At a minimum I would
> > believe the x86_64_tiny should boot but it certainly doesn't.
> >
> > Thanks,
> >
> > Jason
>
>


-- 
Jason Gionta
Cyber Defense Lab
North Carolina State University
jjgionta at ncsu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/llvmlinux/attachments/20141102/6c00d683/attachment.html>


More information about the LLVMLinux mailing list