[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH 11/13] target/arm/arm-semi: Implement support for
From: |
Peter Maydell |
Subject: |
Re: [Qemu-arm] [PATCH 11/13] target/arm/arm-semi: Implement support for semihosting feature detection |
Date: |
Tue, 10 Sep 2019 18:00:12 +0100 |
On Tue, 10 Sep 2019 at 15:44, Peter Maydell <address@hidden> wrote:
>
> Version 2.0 of the semihosting specification added support for
> allowing a guest to detect whether the implementation supported
> particular features. This works by the guest opening a magic
> file ":semihosting-features", which contains a fixed set of
> data with some magic numbers followed by a sequence of bytes
> with feature flags. The file is expected to behave sensibly
> for the various semihosting calls which operate on files
> (SYS_FLEN, SYS_SEEK, etc).
> @@ -586,6 +679,18 @@ target_ulong do_arm_semihosting(CPUARMState *env)
> unlock_user(s, arg0, 0);
> return guestfd;
> }
> + if (strcmp(s, ":semihosting-features") == 0) {
> + unlock_user(s, arg0, 0);
> + /* We must fail opens for modes other than 0 ('r') or 1 ('rb') */
> + if (arg1 != 0 && arg1 != 1) {
> + dealloc_guestfd(guestfd);
> + errno = EINVAL;
The spec doesn't mandate any particular errno here, but
EACCES would probably be better, since that's the usual error
for trying to open a read-only file for writing.
thanks
-- PMM
- Re: [Qemu-arm] [PATCH 07/13] target/arm/arm-semi: Factor out implementation of SYS_READ, (continued)
- [Qemu-arm] [PATCH 08/13] target/arm/arm-semi: Factor out implementation of SYS_ISTTY, Peter Maydell, 2019/09/10
- [Qemu-arm] [PATCH 09/13] target/arm/arm-semi: Factor out implementation of SYS_SEEK, Peter Maydell, 2019/09/10
- [Qemu-arm] [PATCH 10/13] target/arm/arm-semi: Factor out implementation of SYS_FLEN, Peter Maydell, 2019/09/10
- [Qemu-arm] [PATCH 13/13] target/arm/arm-semi: Implement SH_EXT_EXIT_EXTENDED extension, Peter Maydell, 2019/09/10
- [Qemu-arm] [PATCH 11/13] target/arm/arm-semi: Implement support for semihosting feature detection, Peter Maydell, 2019/09/10
- [Qemu-arm] [PATCH 12/13] target/arm/arm-semi: Implement SH_EXT_STDOUT_STDERR extension, Peter Maydell, 2019/09/10