[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 07/11] hw/m68k: add Nubus support
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH v4 07/11] hw/m68k: add Nubus support |
Date: |
Tue, 23 Oct 2018 08:36:44 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 2018-10-18 19:28, Mark Cave-Ayland wrote:
> From: Laurent Vivier <address@hidden>
>
> Co-developed-by: Mark Cave-Ayland <address@hidden>
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> Signed-off-by: Laurent Vivier <address@hidden>
> ---
[...]
> +static void nubus_register_format_block(NubusDevice *dev)
> +{
> + char fblock_name[27];
> +
> + sprintf(fblock_name, "nubus-slot-%d-format-block", dev->slot_nb);
Latest GCC (version 8) got very picky about possible buffer overflows
during sprintf() ... not sure, but it might be necessary to either use a
bigger array here, or assert(dev->slot_nb < NUBUS_SLOT_NB), or even
better use g_strdup_printf() instead (with g_free() at the end of the
function) instead.
> + hwaddr fblock_offset = memory_region_size(&dev->slot_mem) - FBLOCK_SIZE;
> + memory_region_init_io(&dev->fblock_io, NULL, &nubus_format_block_ops,
> + dev, fblock_name, FBLOCK_SIZE);
> + memory_region_add_subregion(&dev->slot_mem, fblock_offset,
> + &dev->fblock_io);
> +}
[...]
> diff --git a/include/hw/display/macfb.h b/include/hw/display/macfb.h
> index 70ea5480fe..3059f2f36a 100644
> --- a/include/hw/display/macfb.h
> +++ b/include/hw/display/macfb.h
> @@ -39,4 +39,25 @@ typedef struct {
> MacfbState macfb;
> } MacfbSysBusState;
>
> +#define MACFB_NUBUS_DEVICE_CLASS(class) \
> + OBJECT_CLASS_CHECK(MacfbNubusDeviceClass, (class), TYPE_NUBUS_MACFB)
> +#define MACFB_NUBUS_GET_CLASS(obj) \
> + OBJECT_GET_CLASS(MacfbNubusDeviceClass, (obj), TYPE_NUBUS_MACFB)
> +
> +typedef struct MacfbNubusDeviceClass {
> + DeviceClass parent_class;
> +
> + DeviceRealize parent_realize;> +} MacfbNubusDeviceClass;
>
> +#define TYPE_NUBUS_MACFB "nubus-macfb"
> +#define NUBUS_MACFB(obj) \
> + OBJECT_CHECK(MacfbNubusState, (obj), TYPE_NUBUS_MACFB)
> +
> +typedef struct {
> + NubusDevice busdev;
> +
> + MacfbState macfb;
> +} MacfbNubusState;
> +
> #endif
I think this should rather be part of the next patch instead?
Thomas
- [Qemu-devel] [PATCH v4 05/11] hw/m68k: Apple Sound Chip (ASC) emulation, (continued)
- [Qemu-devel] [PATCH v4 05/11] hw/m68k: Apple Sound Chip (ASC) emulation, Mark Cave-Ayland, 2018/10/18
- [Qemu-devel] [PATCH v4 08/11] hw/m68k: add Nubus support for macfb video card, Mark Cave-Ayland, 2018/10/18
- [Qemu-devel] [PATCH v4 06/11] ESP: add pseudo-DMA as used by Macintosh, Mark Cave-Ayland, 2018/10/18
- [Qemu-devel] [PATCH v4 03/11] escc: introduce a selector for the register bit, Mark Cave-Ayland, 2018/10/18
- [Qemu-devel] [PATCH v4 04/11] hw/m68k: add macfb video card, Mark Cave-Ayland, 2018/10/18
- [Qemu-devel] [PATCH v4 07/11] hw/m68k: add Nubus support, Mark Cave-Ayland, 2018/10/18
- Re: [Qemu-devel] [PATCH v4 07/11] hw/m68k: add Nubus support,
Thomas Huth <=
- [Qemu-devel] [PATCH v4 09/11] hw/m68k: add a dummy SWIM floppy controller, Mark Cave-Ayland, 2018/10/18
- [Qemu-devel] [PATCH v4 10/11] dp8393x: manage big endian bus, Mark Cave-Ayland, 2018/10/18
- [Qemu-devel] [PATCH v4 11/11] hw/m68k: define Macintosh Quadra 800, Mark Cave-Ayland, 2018/10/18
- Re: [Qemu-devel] [PATCH v4 00/11] hw/m68k: add Apple Machintosh Quadra 800 machine, Laurent Vivier, 2018/10/18