2

我在 gem5 中遇到以下错误。这仅在 ARM 中发生。使用 X86,我看到一些系统调用被忽略,但没有一个会导致致命错误。

tomas@ubuntu:~/gem5$ ./build/ARM/gem5.opt configs/example/arm/starter_se.py ../tests_gem5/hello
gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled Jul  9 2018 17:09:01
gem5 started Jul  9 2018 18:07:37
gem5 executing on ubuntu, pid 5064
command line: ./build/ARM/gem5.opt configs/example/arm/starter_se.py ../tests_gem5/hello

info: 1. command and arguments: ['../tests_gem5/hello']
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (1024 Mbytes)
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (1024 Mbytes)
0: system.remote_gdb: listening for remote gdb on port 7000
info: Entering event queue @ 0.  Starting simulation...
fatal: syscall openat (#322) unimplemented.
Memory Usage: 2246296 KBytes

我在 gem5 的常见问题解答中找到了这个答案。但现在它显示了这个错误:

warn: ignoring syscall openat(...)
FATAL: kernel too old
warn: ignoring syscall rt_sigprocmask(...)
      (further warnings will be suppressed)
fatal: syscall gettid (#224) unimplemented.

我正在使用以下命令在 Ubuntu 18.04 中进行编译:

arm-linux-gnueabi-gcc hello.c -o hello -static -DUNIX

有没有人找到一种方法来编译一个简单的hello world,针对ARM,不使用gem5不支持的系统调用?有预编译的示例,因此必须有一种方法。

4

2 回答 2

1

更新:x86、arm 和 aarch64 C hello world 正在使用 Ubuntu 18.04 预打包工具链,请参阅:How to compile and run an executable in gem5 syscall emulation mode with se.py?

“致命:内核太旧”之前已在:如何在系统调用仿真 SE 模式下运行 gem5 时解决“致命:内核太旧”?

正如该页面中所解释的,该消息来自 glibc 健全性检查,并且ct-ng是克服它的最明智的方法。

至于未实现的系统调用,我不知道为什么 x86 会忽略它们并且 arm 会爆炸,但是如果您给出 x86 系统调用被忽略的消息,应该很容易在源代码中找到它。

但是这种爆炸行为似乎是明智的:当它试图运行一个未实现的系统调用时,你怎么能期望你的程序正常工作呢?

大多数系统调用在两个架构中都没有实现,如下所示:

所以,我只看到两个明智的解决方案:

  • 实现系统调用,这对他们中的大多数人来说都很容易,并向 gem5 发送补丁
    • 看看其他拱门是否通过 grepping 实现它,有时另一个拱门已经实现了它,你只需要写东西
    • 您也可以尝试忽略系统调用,TODO:ARM 中有什么好的方法吗?但是你必须非常确定它不会有关系。
  • 放弃系统调用仿真,只使用更健全的完整系统:何时在 gem5 中将完整系统 FS 与系统调用仿真 SE 与用户态程序一起使用?
于 2018-07-10T13:37:55.187 回答
0

uclibc is the answer for compiling for gem5. It doesn't use a bunch of syscalls that glibc uses and that gem5 doesn't have implemented. So using crosstool-ng and arm-unknown-linux-uclibcgnueabi solved the issue.

于 2018-07-11T22:26:26.807 回答