qemu-system-aarch64 从来宾系统中退出 [英] qemu-system-aarch64 exit from within the guest system

查看:33
本文介绍了qemu-system-aarch64 从来宾系统中退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法从 aarch64 版本的来宾系统中退出 qemu.例如,x86 具有用于此目的的 isa-debug-exit 设备.

I was wondering if there is a way to exit from qemu from within the guest system in the aarch64 version. For instance the x86 has the isa-debug-exit device which is used for this purpose.

有什么想法吗?

干杯

推荐答案

这个问题的一般答案是做任何你会在真实硬件上做的事情来导致断电".这的细节取决于 QEMU 正在模拟的机器.对于 aarch64virt"板,您可以使用仿真的 PSCI 固件接口使用 SYSTEM_OFF 函数请求断电.

The general answer to this question is "do whatever you would do on the real hardware to cause a power-off". The details of this depend on which machine QEMU is emulating. For the aarch64 "virt" board, you can use the emulated PSCI firmware interface to request a powerdown using the SYSTEM_OFF function.

PSCI API 文档在这里:http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf

The PSCI API documentation is here: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf

出于调试/测试目的,您可能还对半主机 API 感兴趣(https://developer.arm.com/docs/dui0003/b),它有一个 SYS_EXIT 函数,但有一些警告:对于 QEMU,如果你通过 -semihosting 命令行参数启用它,你只能使用半主机,并且只能从内核模式来宾,并且只有在绝对信任来宾代码的情况下才能使用它,因为它提供了对允许来宾读写任何主机文件的功能的访问.但是对于明确信任的小型测试程序,它可以是一种很好的方式来进行简单的调试打印并以给定的退出状态退出.

For debug/test purposes you might also be interested in the semihosting API (https://developer.arm.com/docs/dui0003/b) which has a SYS_EXIT function, but some caveats: for QEMU you can only use semihosting if you enable it via the -semihosting commandline argument, and only from kernel mode in the guest, and you must only use it if you absolutely trust the guest code, because it provides access to functions that allow the guest to read and write any host file. But for explicitly trusted small test programs it can be a nice way to do easy debug printing and exit with a given exit status.

这篇关于qemu-system-aarch64 从来宾系统中退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆