On Tue, 10 Sep 2019 at 15:44, Peter Maydell <peter.mayd...@linaro.org> 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