Re: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng
Hi Boris, Don’t get me wrong, if someone is happy to fix it that would obviously be great news. I’m merely cautioning new users. Getting gem5 off the ground with actual representative workloads is a challenge in itself, even for the well-maintained and well-supported ISAs. Andreas From: gem5-users mailto:gem5-users-boun...@gem5.org>> on behalf of "shinga...@labware.com<mailto:shinga...@labware.com>" mailto:shinga...@labware.com>> Reply-To: gem5 users mailing list mailto:gem5-users@gem5.org>> Date: Thursday, 22 October 2015 at 13:19 To: gem5 users mailing list mailto:gem5-users@gem5.org>> Subject: Re: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng Yes, MIPS SE syscall emulation definitely does not work. As a trivial experiment, one of the "known good examples" in crosstools-NG is "mipsel-unknown-linux-gnu". This is with gcc-5.1.0, linux-4.0.4, glibc-2.21. If you compile "Hello World" with this toolchain, its glibc will try to complain about "kernel too old" -- fair enough (because the uname syscall reports kernel 3.0.0), except it can't even get that far, because arch/mips/linux/linux.hh is missing the definition of struct tgt_iovec. The way glibc reports a "FATAL" is via the writev() syscall on stderr, at which point GEM5 crashes because the two 32-bit fields of tgt_iovec in guest memory are interpreted as one 64-bit "size" member, giving a garbage value. I guess this is exactly what Will is seeing. Ok, let's implement the struct; now writev() works correctly (we can even see it print "kernel too old"). Recompile the toolchain with CT_LIBC_GLIBC_MIN_KERNEL_VERSION=2.6.32.66. Do we get very far? No, now we crash in a page miss shortly after the set_thread_area syscall. And this goes on and on; a cursory look at just linux.hh reveals other missing pieces. So yeah, making SE fully work on MIPS would be a bumpy ride. However, it is not completely useless. For example, I use it for experiments with a prototype compiler backend. This is purely ISA, no real program linked with complex things like glibc; nor do I need syscalls. This works pretty smoothly, even guest remote debugging. So YMMV. After all, if there is more people than just myself interested in fixing it, we might just do it -- that's why it's called open source. Boris -"gem5-users" mailto:gem5-users-boun...@gem5.org>> wrote: - To: gem5 users mailing list mailto:gem5-users@gem5.org>>, "gem5-us...@m5sim.org<mailto:gem5-us...@m5sim.org>" mailto:gem5-us...@m5sim.org>> From: Andreas Hansson Sent by: "gem5-users" Date: 10/20/2015 04:08AM Subject: Re: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng Hi Will, I think the best piece of advice when it comes to MIPS in gem5 is: avoid it. You are in for a very bumpy ride otherwise. The best-supported ISAs are ARM, X86 and ALPHA. Andreas From: gem5-users mailto:gem5-users-boun...@gem5.org>> on behalf of Will mailto:alpha0...@yeah.net>> Reply-To: gem5 users mailing list mailto:gem5-users@gem5.org>> Date: Tuesday, 20 October 2015 at 06:12 To: "gem5-us...@m5sim.org<mailto:gem5-us...@m5sim.org>" mailto:gem5-us...@m5sim.org>> Subject: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng Hello, I have built some cross compilers for MIPS using crosstools-ng, but gem5 always terminated with error messages below when execute the binary generated by the cross compiler. Does someone has any idea about the configuration for MIPS cross compiler which could work for gem5? I would appreciate if some one can shed some light on this. Best regards, Will == $ build/MIPS/gem5.debug configs/example/se.py -c ~/hello gem5 Simulator System. http://gem5.org gem5 is copyrighted software; use the --copyright option for details. gem5 compiled Oct 16 2015 14:43:56 gem5 started Oct 20 2015 12:59:38 gem5 executing on Stormy command line: build/MIPS/gem5.debug configs/example/se.py -c /home/fkong/hello Global frequency set at 1 ticks per second warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes) 0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000 REAL SIMULATION info: Entering event queue @ 0. Starting simulation... info: Increasing stack size by one page. tcmalloc: large alloc 18206143029444608 bytes == (nil) @ 0x7fd0f3fa7126 0xbfe6ab 0xe921ac 0xe8df87 0xa818c8 0xb38580 0x1540118 0xb36f41 0xb33ca6 0xe547d6 0xe756fc 0xe7547d 0xc4ab54 0xc4ad10 0x7fd0f5019f43 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd0f501a666 0x7fd0f501a666 0x7fd0f501b6b4 0x7fd0f501b7d9 0x7fd0f5019ec2 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd
Re: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng
Yes, MIPS SE syscall emulation definitely does not work.As a trivial experiment, one of the "known good examples" in crosstools-NG is "mipsel-unknown-linux-gnu". This is with gcc-5.1.0, linux-4.0.4, glibc-2.21.If you compile "Hello World" with this toolchain, its glibc will try to complain about "kernel too old" -- fair enough (because the uname syscall reports kernel 3.0.0), except it can't even get that far, because arch/mips/linux/linux.hh is missing the definition of struct tgt_iovec. The way glibc reports a "FATAL" is via the writev() syscall on stderr, at which point GEM5 crashes because the two 32-bit fields of tgt_iovec in guest memory are interpreted as one 64-bit "size" member, giving a garbage value. I guess this is exactly what Will is seeing.Ok, let's implement the struct; now writev() works correctly (we can even see it print "kernel too old"). Recompile the toolchain with CT_LIBC_GLIBC_MIN_KERNEL_VERSION=2.6.32.66. Do we get very far? No, now we crash in a page miss shortly after the set_thread_area syscall. And this goes on and on; a cursory look at just linux.hh reveals other missing pieces.So yeah, making SE fully work on MIPS would be a bumpy ride. However, it is not completely useless. For example, I use it for experiments with a prototype compiler backend. This is purely ISA, no real program linked with complex things like glibc; nor do I need syscalls. This works pretty smoothly, even guest remote debugging. So YMMV. After all, if there is more people than just myself interested in fixing it, we might just do it -- that's why it's called open source.Boris-"gem5-users" wrote: -To: gem5 users mailing list , "gem5-us...@m5sim.org" From: Andreas Hansson Sent by: "gem5-users" Date: 10/20/2015 04:08AMSubject: Re: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng Hi Will, I think the best piece of advice when it comes to MIPS in gem5 is: avoid it. You are in for a very bumpy ride otherwise. The best-supported ISAs are ARM, X86 and ALPHA. Andreas From: gem5-users <gem5-users-boun...@gem5.org> on behalf of Will <alpha0...@yeah.net> Reply-To: gem5 users mailing list <gem5-users@gem5.org> Date: Tuesday, 20 October 2015 at 06:12 To: "gem5-us...@m5sim.org" <gem5-us...@m5sim.org> Subject: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng Hello, I have built some cross compilers for MIPS using crosstools-ng, but gem5 always terminated with error messages below when execute the binary generated by the cross compiler. Does someone has any idea about the configuration for MIPS cross compiler which could work for gem5?I would appreciate if some one can shed some light on this. Best regards, Will==$ build/MIPS/gem5.debug configs/example/se.py -c ~/hello gem5 Simulator System. http://gem5.org gem5 is copyrighted software; use the --copyright option for details. gem5 compiled Oct 16 2015 14:43:56 gem5 started Oct 20 2015 12:59:38 gem5 executing on Stormy command line: build/MIPS/gem5.debug configs/example/se.py -c /home/fkong/hello Global frequency set at 1 ticks per second warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes) 0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000 REAL SIMULATION info: Entering event queue @ 0. Starting simulation... info: Increasing stack size by one page. tcmalloc: large alloc 18206143029444608 bytes == (nil) @ 0x7fd0f3fa7126 0xbfe6ab 0xe921ac 0xe8df87 0xa818c8 0xb38580 0x1540118 0xb36f41 0xb33ca6 0xe547d6 0xe756fc 0xe7547d 0xc4ab54 0xc4ad10 0x7fd0f5019f43 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd0f501a666 0x7fd0f501a666 0x7fd0f501b6b4 0x7fd0f501b7d9 0x7fd0f5019ec2 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd0f501b6b4 0x7fd0f501b7d9 0x7fd0f5034bdf 0x7fd0f5035a54 0xe5a684 0xa6350d 0x7fd0f332d790 terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Program aborted at cycle 391500 Aborted (core dumped) -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.___gem5-users mailing listgem5-users@gem5.orghttp://m5sim.org/cgi-bin/mailman/listinfo/gem5-users ___ gem5-users mailing list gem5-users@gem5.org http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
Re: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng
Hi Will, I think the best piece of advice when it comes to MIPS in gem5 is: avoid it. You are in for a very bumpy ride otherwise. The best-supported ISAs are ARM, X86 and ALPHA. Andreas From: gem5-users mailto:gem5-users-boun...@gem5.org>> on behalf of Will mailto:alpha0...@yeah.net>> Reply-To: gem5 users mailing list mailto:gem5-users@gem5.org>> Date: Tuesday, 20 October 2015 at 06:12 To: "gem5-us...@m5sim.org<mailto:gem5-us...@m5sim.org>" mailto:gem5-us...@m5sim.org>> Subject: [gem5-users] Problem in building cross compiler for MIPS using crosstools-ng Hello, I have built some cross compilers for MIPS using crosstools-ng, but gem5 always terminated with error messages below when execute the binary generated by the cross compiler. Does someone has any idea about the configuration for MIPS cross compiler which could work for gem5? I would appreciate if some one can shed some light on this. Best regards, Will == $ build/MIPS/gem5.debug configs/example/se.py -c ~/hello gem5 Simulator System. http://gem5.org gem5 is copyrighted software; use the --copyright option for details. gem5 compiled Oct 16 2015 14:43:56 gem5 started Oct 20 2015 12:59:38 gem5 executing on Stormy command line: build/MIPS/gem5.debug configs/example/se.py -c /home/fkong/hello Global frequency set at 1 ticks per second warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes) 0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000 REAL SIMULATION info: Entering event queue @ 0. Starting simulation... info: Increasing stack size by one page. tcmalloc: large alloc 18206143029444608 bytes == (nil) @ 0x7fd0f3fa7126 0xbfe6ab 0xe921ac 0xe8df87 0xa818c8 0xb38580 0x1540118 0xb36f41 0xb33ca6 0xe547d6 0xe756fc 0xe7547d 0xc4ab54 0xc4ad10 0x7fd0f5019f43 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd0f501a666 0x7fd0f501a666 0x7fd0f501b6b4 0x7fd0f501b7d9 0x7fd0f5019ec2 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd0f501b6b4 0x7fd0f501b7d9 0x7fd0f5034bdf 0x7fd0f5035a54 0xe5a684 0xa6350d 0x7fd0f332d790 terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Program aborted at cycle 391500 Aborted (core dumped) -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. ___ gem5-users mailing list gem5-users@gem5.org http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
[gem5-users] Problem in building cross compiler for MIPS using crosstools-ng
Hello, I have built some cross compilers for MIPS using crosstools-ng, but gem5 always terminated with error messages below when execute the binary generated by the cross compiler. Does someone has any idea about the configuration for MIPS cross compiler which could work for gem5? I would appreciate if some one can shed some light on this. Best regards, Will == $ build/MIPS/gem5.debug configs/example/se.py -c ~/hello gem5 Simulator System. http://gem5.org gem5 is copyrighted software; use the --copyright option for details. gem5 compiled Oct 16 2015 14:43:56 gem5 started Oct 20 2015 12:59:38 gem5 executing on Stormy command line: build/MIPS/gem5.debug configs/example/se.py -c /home/fkong/hello Global frequency set at 1 ticks per second warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes) 0: system.remote_gdb.listener: listening for remote gdb #0 on port 7000 REAL SIMULATION info: Entering event queue @ 0. Starting simulation... info: Increasing stack size by one page. tcmalloc: large alloc 18206143029444608 bytes == (nil) @ 0x7fd0f3fa7126 0xbfe6ab 0xe921ac 0xe8df87 0xa818c8 0xb38580 0x1540118 0xb36f41 0xb33ca6 0xe547d6 0xe756fc 0xe7547d 0xc4ab54 0xc4ad10 0x7fd0f5019f43 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd0f501a666 0x7fd0f501a666 0x7fd0f501b6b4 0x7fd0f501b7d9 0x7fd0f5019ec2 0x7fd0f501b6b4 0x7fd0f501a5c6 0x7fd0f501b6b4 0x7fd0f501b7d9 0x7fd0f5034bdf 0x7fd0f5035a54 0xe5a684 0xa6350d 0x7fd0f332d790 terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Program aborted at cycle 391500 Aborted (core dumped) ___ gem5-users mailing list gem5-users@gem5.org http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users