qemu-arm
[Top][All Lists]
Advanced

[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



reply via email to

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