qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AArch64 semihosting?


From: Liviu Ionescu
Subject: AArch64 semihosting?
Date: Thu, 26 May 2022 11:14:31 +0300

I'm trying to set-up an environment for running unit-tests on AArch64, and I'm 
constantly getting crashes:

```
ilg@wksi ~ % 
/Users/ilg/Library/xPacks/@xpack-dev-tools/qemu-arm/6.2.0-1.1/.content/bin/qemu-system-aarch64
  "--machine" "virt" "--cpu" "cortex-a57" "--kernel" "/Users/ilg/My Files/WKS 
Projects/micro-os-plus.github/work/aarch64-boot-libgloss/Debug/aarch64-boot-libgloss.elf"
 "--nographic" "-d" "unimp,guest_errors" "--semihosting-config" 
"enable=on,target=native" "--semihosting-config" 
"arg=sample-test,arg=one,arg=two" -s

zsh: segmentation fault   "--machine" "virt" "--cpu" "cortex-a57" "--kernel"  
"--nographic" "-d"      
ilg@wksi ~ % 
```

The application was built with newlib libgloss and all it does is a series of 
printfs to display Hello World and the argv array.

I also tried with a custom semihosting implementation that I use for other 
projects, and the result is the same, QEMU crashes.

However, if I start QEMU with -s (in GDB server mode) and load the application 
via the GDB client, the application no longer crashes, it passes the command 
lines arguments properly, it runs through the printfs, it returns, it reaches 
the semihosting SYS_EXIT_EXTENDED call and emulation terminates normally.

Things are not entirely ok, since the messages expected to be printed by QEMU 
are not shown; instead, they appear in the GDB trace window, so they are 
reflected back to GDB.


Are there any known issues with semihosting on AArch64? I'm using a similar 
configuration for running Cortex-M unit-tests on mps2-an500/mps2-an385 and on 
those machines semihosting works as expected.

Some time ago I reworked the semihosting implementation in OpenOCD, and there I 
used a common semihosting implementation for all Arm and RISC-V devices; 
everything worked fine, so a common approach is realistic.

My testing environment depends on running semihosted application in QEMU, so I 
have to find a solution to make it work.

Any thoughts on this?


Liviu








reply via email to

[Prev in Thread] Current Thread [Next in Thread]