qemu-devel
[Top][All Lists]
Advanced

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

Re: [PULL 03/20] nubus-device: expose separate super slot memory region


From: Peter Maydell
Subject: Re: [PULL 03/20] nubus-device: expose separate super slot memory region
Date: Sat, 2 Oct 2021 11:33:47 +0100

On Wed, 29 Sept 2021 at 10:49, Laurent Vivier <laurent@vivier.eu> wrote:
>
> From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>
> According to "Designing Cards and Drivers for the Macintosh Family" each 
> physical
> nubus slot can access 2 separate address ranges: a super slot memory region 
> which
> is 256MB and a standard slot memory region which is 16MB.
>
> Currently a Nubus device uses the physical slot number to determine whether 
> it is
> using a standard slot memory region or a super slot memory region rather than
> exposing both memory regions for use as required.


> +    /* Super */
> +    slot_offset = nd->slot * NUBUS_SUPER_SLOT_SIZE;

Hi; Coverity thinks this multiply might overflow, because
we're calculating a hw_addr (64-bits) but the multiply is only
done at 32-bits. Adding an explicit cast or using 'ULL' in the
constant #define rather than just 'U' would fix this.
This is CID 1464070.

> +
> +    name = g_strdup_printf("nubus-super-slot-%x", nd->slot);
> +    memory_region_init(&nd->super_slot_mem, OBJECT(dev), name,
> +                       NUBUS_SUPER_SLOT_SIZE);
> +    memory_region_add_subregion(&nubus->super_slot_io, slot_offset,
> +                                &nd->super_slot_mem);
> +    g_free(name);
> +
> +    /* Normal */
> +    slot_offset = nd->slot * NUBUS_SLOT_SIZE;

Same with this one.

thanks
-- PMM



reply via email to

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