On Sat, May 14, 2011 at 1:23 AM, Artyom Tarasenko <atar4q...@gmail.com> wrote: > Trying to run linux-user-test-0.3 from qemu.org. The programs produce > the expected output but always end up with a segmentation fault: > > $ sparc64-linux-user/qemu-sparc64 ../linux-user-test-0.3/sparc64/busybox > BusyBox v1.6.1 (2007-10-20 10:22:43 EEST) multi-call binary > Copyright (C) 1998-2006 Erik Andersen, Rob Landley, and others. > Licensed under GPLv2. See source distribution for full notice. > > Usage: busybox [function] [arguments]... > or: [function] [arguments]... > > BusyBox is a multi-call binary that combines many common Unix > utilities into a single executable. Most people will create a > link to busybox for each function they wish to use and BusyBox > will act like whatever it was invoked as! > > Currently defined functions: > echo, expr, ls > > Segmentation fault > $ > > Program received signal SIGSEGV, Segmentation fault. > 0x00000000600313ce in ldl_be_p (dc=0x7fffffffd510) at ../cpu-all.h:446 > 446 asm volatile ("movl %1, %0\n" > (gdb) bt > #0 0x00000000600313ce in ldl_be_p (dc=0x7fffffffd510) at ../cpu-all.h:446 > #1 disas_sparc_insn (dc=0x7fffffffd510) at qemu/target-sparc/translate.c:1876 > #2 0x00000000600666b9 in gen_intermediate_code_internal > (env=0x6224aed0, tb=0x7ffff43d71b0) at > qemu/target-sparc/translate.c:4897 > #3 gen_intermediate_code (env=0x6224aed0, tb=0x7ffff43d71b0) at > qemu/target-sparc/translate.c:4967 > #4 0x000000006002bb06 in cpu_sparc_gen_code (env=0x6224aed0, > tb=0x7ffff43d71b0, gen_code_size_ptr=0x7fffffffd5f4) at > qemu/translate-all.c:73 > #5 0x000000006002af6c in tb_gen_code (env=0x6224aed0, pc=593344, > cs_base=<value optimized out>, flags=<value optimized out>, > cflags=<value optimized out>) > at qemu/exec.c:995 > #6 0x000000006002c22d in tb_find_slow (env1=<value optimized out>) at > qemu/cpu-exec.c:167 > #7 tb_find_fast (env1=<value optimized out>) at qemu/cpu-exec.c:194 > #8 cpu_sparc_exec (env1=<value optimized out>) at qemu/cpu-exec.c:599 > #9 0x0000000060005f60 in cpu_loop (env=0x6224aed0) at > qemu/linux-user/main.c:1026 > #10 0x0000000060006b92 in main (argc=1646563376, argv=<value optimized > out>, envp=<value optimized out>) at qemu/linux-user/main.c:3468 > (gdb) > > Is that a bad test or a qemu bug? The host runs Linux x86_64.
Bug. BPcc branch target is sign extended incorrectly in some cases. I'll push a fix.