qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Is *-bsd-user target broken?


From: Blue Swirl
Subject: Re: [Qemu-devel] Is *-bsd-user target broken?
Date: Tue, 26 Jun 2012 18:18:11 +0000

On Tue, Jun 26, 2012 at 3:49 PM, Igor Mammedov <address@hidden> wrote:
> Hello Blue,
>
> I've tried to test if *-bsd-user target works but so far wasn't successful
> so far.
> I've tried qemu-1.x ports on the latest freebsd/openbsd and a freshly
> checked out qemu.
>
> If it works for you, could you tell:
>  1. what flavor of bsd you use for testing

OpenBSD 5.1 Sparc64

>  2. what configure options are used for building *-bsd-user and maybe some
> other magic

$ head -2 /src/qemu/obj-sparc64-obsd/config-host.mak
# Automatically generated by configure - do not modify
# Configured with: '../configure' '--prefix=/usr'
'--target-list=sparc-bsd-user i386-bsd-user sparc-softmmu i386-softmmu
sparc64-bsd-user sparc64-softmmu' '--cc=gcc' '--source-path=/src/qemu'
'--disable-werror'

>  3. command line running emulator, for example to execute /bin/ls (may be
> I'm doing something wrong here)

$ /src/qemu/obj-sparc64-obsd/i386-bsd-user/qemu-i386 -strace -L
./obsd-i386 -bsd OpenBSD ./obsd-i386/ls
28008 __sysctl(1006655152,1006710722,1074265530,1074265276,0,1074265172)
= -1 errno=1 (Operation not permitted)
28008 __sysctl(1074265515,1074265116,0,1074265276,0,1074265124) = -1
errno=1 (Operation not permitted)
28008 __syscall(0,1074265116,-1,-1,0,1074265092)28008
syscall(1074265116,-1,-1,0,1074265092,0)28008 Unknown syscall 64540
Bad system call

There's something fishy, sometimes the command does not work:
$ /src/qemu/obj-sparc64-obsd/i386-bsd-user/qemu-i386 -strace -L
./obsd-i386 -bsd OpenBSD ./obsd-i386/ls
Segmentation fault

$ ls obsd-i386/
date* ls*   sync*

For some reason, native binaries produce better output:
$ /src/qemu/obj-sparc64-obsd/sparc64-bsd-user/qemu-sparc64 -strace -L
/ -bsd OpenBSD /bin/sync
5293 __sysctl(1074264344,2,7344956,1074264336,0,0) = 0
5293 __syscall(197,0,8192,3,4098,-1)5293 mmap(0,8192,3,4098,-1,0) =
0x0000000040082000
 = 1074274304
5293 mprotect(0x40082000,0x2000,1) = 0
5293 sync(0,0,0,0,0,0) = 0
5293 mprotect(0x40082000,0x2000,3) = 0
5293 mprotect(0x40082000,0x2000,1) = 0
5293 munmap(0x40082000,8192) = 0
5293 exit(0)

Though it can still segfault:

$ /src/qemu/obj-sparc64-obsd/sparc64-bsd-user/qemu-sparc64 -strace -L
/ -bsd OpenBSD /bin/sync
Segmentation fault
$ gdb --args /src/qemu/obj-sparc64-obsd/sparc64-bsd-user/qemu-sparc64
-strace -L / -bsd OpenBSD /bin/sync
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc64-unknown-openbsd5.1"...
(gdb) r
Starting program:
/src/qemu/obj-sparc64-obsd/sparc64-bsd-user/qemu-sparc64 -strace -L /
-bsd OpenBSD /bin/sync

Program received signal SIGSEGV, Segmentation fault.
0x000000006001d3fc in g_free (ptr=0x26dfc4000)
    at /src/qemu/bsd-user/mmap.c:119
119         munmap(p, *p);
(gdb) bt
#0  0x000000006001d3fc in g_free (ptr=0x26dfc4000)
    at /src/qemu/bsd-user/mmap.c:119
#1  0x000000006001ac34 in load_elf_binary (bprm=0xfffffffffffd63f0,
    regs=Variable "regs" is not available.
) at /src/qemu/bsd-user/elfload.c:698
#2  0x0000000060019acc in loader_exec (
    filename=0xfffffffffffd63f0 "\177ELF\002\002\001",
    argv=0xfffffffffffd8d88, envp=0x816d, regs=0xfffffffffffd8b50,
    infop=0xfffffffffffd67a0) at /src/qemu/bsd-user/bsdload.c:184
#3  0x000000006001c828 in main (argc=Variable "argc" is not available.
) at /src/qemu/bsd-user/main.c:961

>
>
> Example of what I've did on FreeBSD, qemu with your recent patches and ld
> patch form qemu-devel port:
>
> # ./configure  --enable-debug  --disable-werror --target-list=i386-bsd-user
>
> # ./i386-bsd-user/qemu-i386 -strace -bsd FreeBSD -L / /bin/ls
>
> After some waiting it SIGSEGVs with following trace:
>
> 0x801484e8 in g_hash_table_lookup () from /usr/local/lib/libglib-2.0.so.0
> (gdb) bt
> #0  0x801484e8 in g_hash_table_lookup () from
> /usr/local/lib/libglib-2.0.so.0
> #1  0x6001788c in type_table_lookup (name=0x600c72be "i386-cpu") at
> qom/object.c:95
> #2  0x60017b60 in type_get_by_name (name=0x600c72be "i386-cpu") at
> qom/object.c:157
> #3  0x60018837 in object_dynamic_cast (obj=0x80534010, typename=0x600c72be
> "i386-cpu") at qom/object.c:435
> #4  0x6001897e in object_dynamic_cast_assert (obj=0x80534010,
> typename=0x600c72be "i386-cpu") at qom/object.c:484
> #5  0x60051eff in x86_cpu_realize (obj=0x80534010, errp=0x0) at
> /root/qemu/target-i386/cpu.c:1709
> #6  0x60053488 in cpu_x86_init (cpu_model=0x600c3711 "qemu32") at
> /root/qemu/target-i386/helper.c:1178
> #7  0x60022c61 in cpu_init (cpu_model=0x600c3711 "qemu32") at cpu.h:965
> #8  0x6002238e in main (argc=7, argv=0xbfbfebd4) at
> /root/qemu/bsd-user/main.c:915
>
>
>
> --
> -----
>  Igor
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]