Gem5 Syscall Emulation Arm C Hello World Fails with "Fatal: Syscall Gettid (#224) Unimplemented"

gem5 syscall emulation arm C hello world fails with fatal: syscall gettid (#224) unimplemented

update: x86, arm and aarch64 C hello world is working on Ubuntu 18.04 pre-packaged toolchain, see: How to compile and run an executable in gem5 syscall emulation mode with se.py?

"FATAL: kernel too old" has been previously asked at: How to solve "FATAL: kernel too old" when running gem5 in syscall emulation SE mode?

As explained in that page, that message comes from a glibc sanity check, and ct-ng is the sanest approach to overcome it.

As for the unimplemented syscalls, I don't know why x86 ignores them and arm blows up, but it should be easy to grep that up in the source if you give the x86 syscall ignored message.

But the blow up behavior does seem sensible: how can you expect your program to work properly when it tries to run an unimplemented syscall?

Most syscalls are unimplemented in both archs as can be seen at:

  • https://github.com/gem5/gem5/blob/5de8ca95506a5f15bfbfdd2ca9babd282a882d1f/src/arch/arm/linux/process.cc#L123
  • https://github.com/gem5/gem5/blob/5de8ca95506a5f15bfbfdd2ca9babd282a882d1f/src/arch/x86/linux/process.cc#L222

So, I only see two sensible solutions:

  • implement the syscall, which is easy for most of them, and send gem5 a patch

    • have a look if other archs implement it by grepping, sometimes another arch has already implemented it and you just need to write things up
    • you could also try to ignore the syscall, TODO: is there a good way in ARM? But you have to be pretty sure that it won't matter.
  • give up on syscall emulation and just use full system which is saner: When to use full system FS vs syscall emulation SE with userland programs in gem5?

gem5 syscall emulation OpenBLAS cblas_dgemm fails with fatal: syscall mbind (#237) unimplemented

I believe that you cannot overcome this error without patching gem5, since in SE mode, every syscall must be explicitly implemented, as can be guessed form the source code:

src/arch/arm/linux/process.cc:443:    /* 319 */ SyscallDesc("mbind", unimplementedFunc),                 

As an alternative, can't you run that in a full system simulation instead? For example, I got it working very easily using this Buildroot setup running your exact same test program.

FS tends to be much simpler to port things to, as the system is more realistic and there are less restrictions on what you can do.

Another alternative would be to patch BLAS to remove the syscall, but you likely don't want to do that, as it would make your run less representative and likely just uncover further failures.

Please write to the mailing list as well to confirm what I've told you.

warn: ignoring syscall mprotect(...) during simple gem5 simulation

The syscall is not implemented, but gem5 devs decided it is usually not needed for the program to run normally enough, and so marked as ignore rather than crash. Syscalls are always 1 tick in SE mode, so implementing it generally won't make much of a difference, unless you have good reason to believe otherwise due to side-effects of the call. See also: gem5 syscall emulation arm C hello world fails with "fatal: syscall gettid (#224) unimplemented"



Related Topics



Leave a reply



Submit