qemu-arm
[Top][All Lists]
Advanced

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

Re: [Qemu-arm] [Qemu-devel] [PATCH] arm: Don't crash if user tries to us


From: Peter Maydell
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH] arm: Don't crash if user tries to use a Cortex-M CPU without an NVIC
Date: Mon, 11 Jun 2018 16:33:10 +0100

On 11 June 2018 at 16:26, Igor Mammedov <address@hidden> wrote:
> On Fri,  1 Jun 2018 17:03:55 +0100
> Peter Maydell <address@hidden> wrote:
>
>> The Cortex-M CPU and its NVIC are two intimately intertwined parts of
>> the same hardware; it is not possible to use one without the other.
>> Unfortunately a lot of our board models don't do any sanity checking
>> on the CPU type the user asks for, so a command line like
>>     qemu-system-arm -M versatilepb -cpu cortex-m3
>> will create an M3 without an NVIC, and coredump immediately.
>> In the other direction, trying a non-M-profile CPU in an M-profile
>> board won't blow up, but doesn't do anything useful either:
>>     qemu-system-arm -M lm3s6965evb -cpu arm926

>> +#ifndef CONFIG_USER_ONLY
>> +    /* The NVIC and M-profile CPU are two halves of a single piece of
>> +     * hardware; trying to use one without the other is a command line
>> +     * error and will result in segfaults if not caught here.
>> +     */
>> +    if (arm_feature(env, ARM_FEATURE_M)) {
>> +        if (!env->nvic) {
>> +            error_setg(errp, "This board cannot be used with Cortex-M 
>> CPUs");
> mentioning board in CPU's realize seems a little bit strange,
> maybe something similar to following would be better:
>
>   "Cortex-M CPUs require device_foo for working"

I think the text as I have it is of more practical use to the
user, who is clearly not going to be very familiar with how
M-profile systems work if they've run into this error message.
"requires an NVIC" doesn't tell them what's actually wrong;
"this board doesn't work with this CPU" gives them a fighting
chance of understanding that they've given two incompatible
command line options.

thanks
-- PMM



reply via email to

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