Re: Booting L4Re with qemu-system-arm: Panic in sigma0

Leslie Zhai <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
Work :)

I changed to Codesourcery / Mentor cross-compilers GNU toolchain:

$ make qemu 
CROSS_COMPILE=/data/download/arm-2014.05/bin/arm-none-linux-gnueabi- 
E=hello 
MODULE_SEARCH_PATH=/data/project/xiangzhai/l4re/kernel/fiasco/build-arm
make[1]: Entering directory '/data/project/xiangzhai/l4re/l4'
=========== Updating RAM_BASE for platform integrator to 0 =========
   ... Regenerating RAM_BASE settings
   [sigma0] ==> Linking sigma0
   [sigma0] ==> sigma0 built
   [sigma0] ==> Installing sigma0 to local build-tree
   [moe] ==> Linking moe
   [moe] ==> moe built
   [moe] ==> Installing moe to local build-tree
   [bootstrap] ... Building Dependencies
Building entry "hello".
Merging image 
/data/project/xiangzhai/l4re/kernel/fiasco/build-arm/fiasco to mod00 [545kB]
Merging image 
/data/project/xiangzhai/l4re/l4/build-arm/bin/arm_armv5te/l4f/sigma0 to 
mod01 [728kB]
Merging image 
/data/project/xiangzhai/l4re/l4/build-arm/bin/arm_armv5te/l4f/moe to 
mod02 [5591kB]
Merging image 
/data/project/xiangzhai/l4re/l4/build-arm/bin/arm_armv5te/l4f/l4re to 
mod03 [1847kB]
Merging image 
/data/project/xiangzhai/l4re/l4/build-arm/bin/arm_armv5te/l4f/hello to 
mod04 [1292kB]
   [bootstrap] ... Generating bootstrap.ld
   [bootstrap] ... Compiling ARCH-arm/crt0.o
   [bootstrap] ... Compiling exec.o
   [bootstrap] ... Compiling module.o
   [bootstrap] ... Compiling region.o
   [bootstrap] ... Compiling startup.o
   [bootstrap] ... Compiling init_kip_f.o
   [bootstrap] ... Compiling libc_support+.o
   [bootstrap] ... Compiling patch.o
   [bootstrap] ... Compiling koptions.o
   [bootstrap] ... Compiling platform_common.o
   [bootstrap] ... Compiling memory.o
   [bootstrap] ... Compiling boot_modules.o
   [bootstrap] ... Compiling platform/integrator.o
   [bootstrap] ... Compiling ARCH-arm/reboot.o
   [bootstrap] ... Compiling ARCH-arm/head.o
   [bootstrap] ==> Linking bootstrap.elf
   ==> Post-processing bootstrap.elf
   [bootstrap] ==> bootstrap.elf built
   ==> Installing bootstrap.elf in image directory
   ==> Installing bootstrap_hello in image directory
   ==> Installing bootstrap_hello.elf in image directory
   Image size(s) in bytes:
             bootstrap_hello.elf:  1188148
   Start address: 0x1000000
   --> Build-Nr: 2
   [bootstrap] ==> Installing bootstrap.elf to local build-tree
   [bootstrap] ==> Installing bootstrap_hello to local build-tree
   [bootstrap] ==> Installing bootstrap_hello.elf to local build-tree
QEMU-cmd: qemu-system-arm -kernel 
/data/project/xiangzhai/l4re/l4/build-arm/images/bootstrap.elf -serial 
stdio -M integratorcp -m 256

L4 Bootstrapper
   Build: #2 Wed Nov  1 12:34:00 CST 2017, 4.8.3 20140320 (prerelease)
   Scanning up to 256 MB RAM, starting at offset 32MB
   Memory size is 256MB (00000000 - 0fffffff)
   RAM: 0000000000000000 - 000000000fffffff: 262144kB
   Total RAM: 256MB
   Scanning fiasco
   Scanning sigma0
   Scanning moe
   Moving up to 5 modules behind 1100000
   moving module 02 { 10e7000-11184bf } -> { 11d7000-12084bf } [201920]
   moving module 01 { 10d5000-10e6387 } -> { 11c5000-11d6387 } [70536]
   moving module 00 { 104c000-10d4073 } -> { 113c000-11c4073 } [557172]
   moving module 04 { 1032000-104b597 } -> { 1122000-113b597 } [103832]
   moving module 03 { 1010000-1031483 } -> { 1100000-1121483 } [136324]
   Loading fiasco
   Loading sigma0
   Loading moe
   find kernel info page...
   found kernel info page (via ELF) at 2000
Regions of list 'regions'
     [     1000,      197f] {      980} Kern   fiasco
     [     2000,     96fff] {    95000} Kern   fiasco
     [    97000,     970eb] {       ec} Root   mbi_rt
     [    e0000,     eba17] {     ba18} Sigma0 sigma0
     [    f0000,     f6177] {     6178} Sigma0 sigma0
     [   140000,    16d3ef] {    2d3f0} Root   moe
     [   170000,    18242b] {    1242c} Root   moe
     [  1000000,   100f4f7] {     f4f8} Boot   bootstrap
     [  1100000,   113bfff] {    3c000} Root   Module
   found kernel options (via ELF) at 3000
   Sigma0 config    ip:000e0100 sp:00000000
   Roottask config  ip:00140260 sp:00000000
   Starting kernel fiasco at 0000113c
Hello from Startup::stage2
FPU: Initialize
FPU0: Subarch: 1, Part: 10, Rev: 0, Var: 9, Impl: 41

KERNEL: Warning: Buddy::alloc: Size mismatch: 1c000 v 20000
SERIAL ESC: allocated IRQ 1 for serial uart
Not using serial hack in slow timer handler.
Welcome to L4/Fiasco.OC!
L4/Fiasco.OC microkernel on arm
Rev: 362fdae-dirty compiled with gcc 4.8.3 20140320 (prerelease) for 
Integrator    []
Build: #1 Wed Nov  1 12:16:10 CST 2017

Calibrating timer loop... done.
MDB: use page size: 20
MDB: use page size: 12
SIGMA0: Hello!
   KIP @ 2000
   allocated 4KB for maintenance structures
SIGMA0: Dump of all resource maps
RAM:------------------------
[0:0;fff]
[4:97000;97fff]
[0:98000;dffff]
[0:ec000;effff]
[0:f7000;13ffff]
[4:140000;16dfff]
[0:16e000;16ffff]
[4:170000;182fff]
[0:183000;10fffff]
[4:1100000;113bfff]
[0:113c000;effffff]
IOMEM:----------------------
[0:10000000;ffffffff]
MOE: Hello world
MOE: found 244588 KByte free memory
MOE: found RAM from 97000 to f000000
MOE: allocated 239 KByte for the page array @0x98000
MOE: virtual user address space [0-bfffffff]
MOE: rom name space cap -> [C:103000]
MOE: rwfs name space cap -> [C:105000]
   BOOTFS: [1100000-1121484] [C:107000] l4re
   BOOTFS: [1122000-113b598] [C:109000] hello
MOE: cmdline: moe --init=rom/hello
MOE: Starting: rom/hello
MOE: loading 'rom/hello'
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!
Hello World!


在 2017年10月31日 20:41, Matthias Lange 写道:
> Hi,
>
> this looks like an undefined instruction. Maybe the build and the
> emulated CPU model does not match? Have you tried changing the CPU model
> with the '-cpu" option?
>
> Best,
> Matthias.
>
>
> On 10/31/2017 09:24 AM, Leslie Zhai wrote:
>> Hi L4 hackers,
>>
>>
>> $ svn info
>> Path: .
>> Working Copy Root Path: /data/project/l4re
>> URL: https://svn.l4re.org/repos/oc/l4re/trunk
>> Relative URL: ^/trunk
>> Repository Root: https://svn.l4re.org/repos/oc/l4re
>> Repository UUID: d050ee49-bd90-4346-b210-929a50b99cfc
>> Revision: 75
>> Node Kind: directory
>> Schedule: normal
>> Last Changed Author: l4check
>> Last Changed Rev: 75
>> Last Changed Date: 2017-10-15 19:49:39 +0800 (Sun, 15 Oct 2017)
>>
>>
>> My Fiasco build config:
>>
>> #
>> # Automatically generated file; DO NOT EDIT.
>> # Fiasco configuration
>> #
>> CONFIG_HAS_FPU_OPTION=y
>> CONFIG_HAS_SERIAL_OPTION=y
>> CONFIG_HAS_JDB_GZIP_OPTION=y
>>
>> #
>> # Target configuration
>> #
>> # CONFIG_IA32 is not set
>> # CONFIG_AMD64 is not set
>> CONFIG_ARM=y
>> # CONFIG_MIPS is not set
>> CONFIG_PF_INTEGRATOR=y
>> # CONFIG_PF_REALVIEW is not set
>> # CONFIG_PF_SUNXI is not set
>> # CONFIG_PF_BCM283X is not set
>> # CONFIG_PF_SA1100 is not set
>> # CONFIG_PF_XSCALE is not set
>> # CONFIG_PF_ARMADA38X is not set
>> # CONFIG_PF_KIRKWOOD is not set
>> # CONFIG_PF_TEGRA is not set
>> # CONFIG_PF_LAYERSCAPE is not set
>> # CONFIG_PF_IMX is not set
>> # CONFIG_PF_RCAR3 is not set
>> # CONFIG_PF_EXYNOS is not set
>> # CONFIG_PF_S3C2410 is not set
>> # CONFIG_PF_OMAP is not set
>> # CONFIG_PF_ZYNQ is not set
>> CONFIG_BSP_NAME="integrator"
>> CONFIG_CAN_ARM_CPU_926=y
>> CONFIG_CAN_ARM_CPU_1176=y
>> CONFIG_ABI_VF=y
>> CONFIG_ARM_926=y
>> # CONFIG_ARM_1176 is not set
>> CONFIG_FPU=y
>> CONFIG_ARM_ALIGNMENT_CHECK=y
>> CONFIG_ARM_EM_STD=y
>> CONFIG_ARM_CPU_ERRATA=y
>>
>> #
>> # Kernel options
>> #
>> # CONFIG_CONTEXT_8K is not set
>> CONFIG_CONTEXT_4K=y
>> CONFIG_FINE_GRAINED_CPUTIME=y
>> CONFIG_SCHED_FIXED_PRIO=y
>> # CONFIG_SCHED_WFQ is not set
>> # CONFIG_SCHED_FP_WFQ is not set
>>
>> #
>> # Debugging
>> #
>> CONFIG_INLINE=y
>> # CONFIG_NDEBUG is not set
>> # CONFIG_NO_FRAME_PTR is not set
>> CONFIG_STACK_DEPTH=y
>> CONFIG_LIST_ALLOC_SANITY=y
>> CONFIG_SERIAL=y
>> CONFIG_JDB=y
>> CONFIG_JDB_LOGGING=y
>> CONFIG_JDB_GZIP=y
>> # CONFIG_JDB_ACCOUNTING is not set
>> # CONFIG_WARN_NONE is not set
>> # CONFIG_WARN_WARNING is not set
>> CONFIG_WARN_ANY=y
>>
>> #
>> # ARM debugging options
>> #
>> CONFIG_VMEM_ALLOC_TEST=y
>> CONFIG_DEBUG_KERNEL_PAGE_FAULTS=y
>>
>> #
>> # Compiling
>> #
>> CONFIG_CC="gcc"
>> CONFIG_CXX="g++"
>> CONFIG_HOST_CC="gcc"
>> CONFIG_HOST_CXX="g++"
>> CONFIG_MAINTAINER_MODE=y
>> CONFIG_LABEL=""
>> CONFIG_EXPERIMENTAL=y
>> CONFIG_PERF_CNT=y
>> CONFIG_BIT32=y
>> CONFIG_WARN_LEVEL=2
>> CONFIG_XARCH="arm"
>> CONFIG_ABI="vf"
>>
>>
>> My L4Re build config:
>>
>> # Automatically generated. Don't edit
>>
>> BID_COMPILER_TYPE=gcc
>> BUILD_SYSTEMS=arm_armv5te arm_armv5te-l4f
>> CONFIG_ARCH_ENABLE_STACK_PROTECTOR=y
>> CONFIG_BID_GCC_ENABLE_STACK_PROTECTOR=y
>> CONFIG_BID_GCC_STACK_PROTECTOR=y
>> CONFIG_BUILD_ABI="l4f"
>> CONFIG_BUILD_ABI_l4f=y
>> CONFIG_BUILD_ARCH="arm"
>> CONFIG_BUILD_ARCH_arm=y
>> CONFIG_CPU_ARM_ARMV5TE=y
>> CONFIG_CPU="armv5te"
>> CONFIG_CTAGS="ctags"
>> CONFIG_DROPS_INSTDIR="/path/to/l4re"
>> CONFIG_DROPS_STDDIR="/path/to/l4re"
>> CONFIG_ETAGS="etags"
>> CONFIG_LEX="flex"
>> CONFIG_MAKECONFS_ADD=""
>> CONFIG_YACC="yacc"
>> GCCDIR=/usr/lib/gcc/arm-linux-gnueabi/6.1.1
>> GCCFORTRANAVAIL=
>> GCC_HAS_ATOMICS=
>> GCCINCFIXEDPATH=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/include-fixed
>> GCCLIB_EH=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/libgcc_eh.a
>> GCCLIB_FILE_crtbegin.o=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/crtbegin.o
>> GCCLIB_FILE_crtbeginS.o=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/crtbeginS.o
>> GCCLIB_FILE_crtbeginT.o=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/crtbeginT.o
>> GCCLIB_FILE_crtend.o=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/crtend.o
>> GCCLIB_FILE_crtendS.o=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/crtendS.o
>> GCCLIB_HOST=/usr/lib/gcc/arm-linux-gnueabi/6.1.1/libgcc.a
>> GCCLIB_S_SO=
>> GCCMAJORVERSION=6
>> GCCMINORVERSION=1
>> GCCNOSTACKPROTOPT=-fno-stack-protector
>> GCCPATCHLEVEL=1
>> GCCSTACKPROTALLOPT=-fstack-protector-all
>> GCCSTACKPROTOPT=-fstack-protector
>> GCCSYSLIBDIRS=-L/usr/lib/gcc/arm-linux-gnueabi/6.1.1/
>> -L/usr/lib/gcc/arm-linux-gnueabi/6.1.1/../../../../arm-linux-gnueabi/lib/arm-linux-gnueabi/6.1.1/
>> -L/usr/lib/gcc/arm-linux-gnueabi/6.1.1/../../../../arm-linux-gnueabi/lib/ -L/usr/arm-linux-gnu/sys-root/lib/arm-linux-gnueabi/6.1.1/
>> -L/usr/arm-linux-gnu/sys-root/lib/
>> -L/usr/arm-linux-gnu/sys-root/usr/lib/arm-linux-gnueabi/6.1.1/
>> -L/usr/arm-linux-gnu/sys-root/usr/lib/
>> GCCVERSION=6
>> HOST_SYSTEM=linux
>> INT_CPP_NAME=cc1
>> INT_CXX_NAME=cc1plus
>> INT_LD_NAME=arm-linux-gnu-ld
>> LD_EMULATION=armelf_linux_eabi
>> LD_GENDEP_PREFIX=LD_PRELOAD=libgendep.so
>> LD_LIBRARY_PATH=/data/project/xiangzhai/l4re/l4/build-arm/tool/gendep/64:/data/project/xiangzhai/l4re/l4/build-arm/tool/gendep/32
>>
>> LD_HAS_HASH_STYLE_OPTION=n
>> LDVERSION=227-3
>> include /data/project/xiangzhai/l4re/l4/build-arm/.config.indep
>> include /data/project/xiangzhai/l4re/l4/build-arm/.config.platform
>>
>>
>> Booting L4Re with qemu-system-arm:
>>
>> $ make qemu CROSS_COMPILE=arm-linux-gnu- E=hello
>> MODULE_SEARCH_PATH=/data/project/xiangzhai/l4re/kernel/fiasco/build-arm
>> make[1]: Entering directory '/data/project/xiangzhai/l4re/l4'
>>    Image size(s) in bytes:
>>              bootstrap_hello.elf:  1279488
>>    Start address: 0x1000000
>>    --> Build-Nr: 6
>> QEMU-cmd: qemu-system-arm -kernel
>> /data/project/xiangzhai/l4re/l4/build-arm/images/bootstrap.elf -serial
>> stdio -M integratorcp -m 256
>>
>> L4 Bootstrapper
>>    Build: #6 Tue Oct 31 15:50:55 CST 2017, 6.1.1 20160621 (Red Hat Cross
>> 6.1.1-2)
>>    Scanning up to 256 MB RAM, starting at offset 32MB
>>    Memory size is 256MB (00000000 - 0fffffff)
>>    RAM: 0000000000000000 - 000000000fffffff: 262144kB
>>    Total RAM: 256MB
>>    Scanning fiasco
>>    Scanning sigma0
>>    Scanning moe
>>    Moving up to 5 modules behind 1100000
>>    moving module 02 { 10e7000-11284af } -> { 11d8000-12194af } [267440]
>>    moving module 01 { 10d5000-10e6343 } -> { 11c6000-11d7343 } [70468]
>>    moving module 00 { 1053000-10d4edb } -> { 1144000-11c5edb } [532188]
>>    moving module 04 { 1031000-1052697 } -> { 1122000-1143697 } [136856]
>>    moving module 03 { 100f000-1030473 } -> { 1100000-1121473 } [136308]
>>    Loading fiasco
>>    Loading sigma0
>>    Loading moe
>>    find kernel info page...
>>    found kernel info page (via ELF) at 2000
>> Regions of list 'regions'
>>      [     1000,      193f] {      940} Kern   fiasco
>>      [     2000,     8efff] {    8d000} Kern   fiasco
>>      [    8f000,     8f0eb] {       ec} Root   mbi_rt
>>      [    e0000,     eb16b] {     b16c} Sigma0 sigma0
>>      [    f0000,     f517b] {     517c} Sigma0 sigma0
>>      [   140000,    1711df] {    311e0} Root   moe
>>      [   180000,    18c4eb] {     c4ec} Root   moe
>>      [  1000000,   100e4f7] {     e4f8} Boot   bootstrap
>>      [  1100000,   1143fff] {    44000} Root   Module
>>    found kernel options (via ELF) at 3000
>>    Sigma0 config    ip:000e0100 sp:00000000
>>    Roottask config  ip:00140254 sp:00000000
>>    Starting kernel fiasco at 00001118
>> Hello from Startup::stage2
>> FPU: Initialize
>> FPU0: Subarch: 1, Part: 10, Rev: 0, Var: 9, Impl: 41
>>
>> KERNEL: Warning: Buddy::alloc: Size mismatch: 1c000 v 20000
>> SERIAL ESC: allocated IRQ 1 for serial uart
>> Not using serial hack in slow timer handler.
>> Welcome to L4/Fiasco.OC!
>> L4/Fiasco.OC microkernel on arm
>> Rev: 362fdae-dirty compiled with gcc 6.1.1 20160621 (Red Hat Cross
>> 6.1.1-2) for Integrator    []
>> Build: #2 Tue Oct 31 15:39:15 CST 2017
>>
>> Calibrating timer loop... done.
>> MDB: use page size: 20
>> MDB: use page size: 12
>> EXCEPTION: (00) Why undef insn? pfa=00002000, error=00000000 psr=20000110
>> R[0]: 00002000 00000000 00000000 000e01d0  000f0004 00002000 000f0030
>> 00000000
>> R[8]: 00000000 00000000 00000000 000f281c  000f2808 00000000 00000000
>> 000e01d4
>>
>> KERNEL: Warning: Sigma0 raised an exception --> HALT
>> Panic: ...
>> ---------------------------------------------------------------------
>>      CPU 0 [f001519c]: abort
>> jdb:
>>
>>
>> Then how to use addr2line to find the root cause? please give me some
>> hint, thanks a lot!
>>
>> $ arm-linux-gnu-addr2line -p -i -e bin/arm_armv5te/bootstrap.elf -a
>> 00002000
>>
>>
>> Because 0001-Fix-invalid-initialization-in-new.patch has been already
>> merged into svn trunk, so this
>> http://os.inf.tu-dresden.de/pipermail/l4-hackers/2017/008111.html might
>> not fix my issue, but as Sarah mentioned "looks like a compiler issue"?
>>
>> $ arm-linux-gnu-gcc -v
>> Using built-in specs.
>> COLLECT_GCC=arm-linux-gnu-gcc
>> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-linux-gnueabi/6.1.1/lto-wrapper
>> Target: arm-linux-gnueabi
>> Configured with: ../gcc-6.1.1-20160621/configure --bindir=/usr/bin
>> --build=x86_64-redhat-linux-gnu --datadir=/usr/share
>> --disable-decimal-float --disable-dependency-tracking --disable-gold
>> --disable-libgcj --disable-libgomp --disable-libmpx
>> --disable-libquadmath --disable-libssp --disable-libunwind-exceptions
>> --disable-shared --disable-silent-rules --disable-sjlj-exceptions
>> --disable-threads --with-ld=/usr/bin/arm-linux-gnu-ld
>> --enable-__cxa_atexit --enable-checking=release
>> --enable-gnu-unique-object --enable-initfini-array
>> --enable-languages=c,c++ --enable-linker-build-id --enable-lto
>> --enable-nls --enable-obsolete --enable-plugin --enable-targets=all
>> --exec-prefix=/usr --host=x86_64-redhat-linux-gnu
>> --includedir=/usr/include --infodir=/usr/share/info
>> --libexecdir=/usr/libexec --localstatedir=/var --mandir=/usr/share/man
>> --prefix=/usr --program-prefix=arm-linux-gnu- --sbindir=/usr/sbin
>> --sharedstatedir=/var/lib --sysconfdir=/etc --target=arm-linux-gnueabi
>> --with-bugurl=http://bugzilla.redhat.com/bugzilla/ --with-isl
>> --with-newlib --with-plugin-ld=/usr/bin/arm-linux-gnu-ld
>> --with-sysroot=/usr/arm-linux-gnu/sys-root --with-system-libunwind
>> --with-system-zlib --without-headers --with-tune=cortex-a8
>> --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16
>> --with-abi=aapcs-linux --enable-gnu-indirect-function
>> --with-linker-hash-style=gnu
>> Thread model: single
>> gcc version 6.1.1 20160621 (Red Hat Cross 6.1.1-2) (GCC)

-- 
Regards,
Leslie Zhai - https://reviews.llvm.org/p/xiangzhai/




_______________________________________________
l4-hackers mailing list
[email protected]
http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.