All of lore.kernel.org
 help / color / mirror / Atom feed
From: Allan Peramaki <aperamak@pp1.inet.fi>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH] hw/audio/gus: Fix registers 32-bit access
Date: Thu, 18 Jun 2020 02:10:31 +0300	[thread overview]
Message-ID: <06bdf82f-858a-6b28-a9f9-e85154ac9c5d@pp1.inet.fi> (raw)
In-Reply-To: <87e628f4-6c0e-c4a2-daba-57cb1e508b77@pp1.inet.fi>

On 18/06/2020 01:25, Allan Peramaki wrote:
> On 17/06/2020 23:23, Peter Maydell wrote:
>> Are these accesses all guaranteed to be correctly aligned
>> to be 16 or 32 bit loads/stores ? Otherwise it would be
>> better to use the ldl_p/stl_p/ldw_p/stw_p/etc accessors,
>> which correctly handle possibly misaligned pointers.
> 
> Yes (assuming compiler aligns struct fields properly.) It is not obvious 
> though (and easy to break), so I suppose refactoring much of the GUS 
> code would be nice. For example, the few places where GUSregd(position) 
> is used, position is 2 (mod 4). On the other hand, gusptr is also 2 (mod 
> 4) bytes (making gusptr+position = 0 (mod 4)), because we have the struct

It is aligned, but my reasoning had a mistake. Both gusptr and position 
(GUSDRAMPOS24bit and voicewavetableirq) are 0 (mod 4). (mixbuf is a 
pointer.) Sorry.

> 
> typedef struct GUSState {
>      ISADevice dev;
>      GUSEmuState emu;
>      QEMUSoundCard card;
>      uint32_t freq;
>      uint32_t port;
>      int pos, left, shift, irqs;
>      int16_t *mixbuf;
>      uint8_t himem[1024 * 1024 + 32 + 4096];
>      int samples;
>      SWVoiceOut *voice;
>      int64_t last_ticks;
>      qemu_irq pic;
>      IsaDma *isa_dma;
>      PortioList portio_list1;
>      PortioList portio_list2;
> } GUSState;
> 
> 

Best regards,
Allan


  reply	other threads:[~2020-06-17 23:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 20:17 [PATCH] hw/audio/gus: Fix registers 32-bit access Allan Peramaki
2020-06-17 19:58 ` Volker Rümelin
2020-06-17 20:23 ` Peter Maydell
2020-06-17 22:25   ` Allan Peramaki
2020-06-17 23:10     ` Allan Peramaki [this message]
2020-06-18  4:57     ` Thomas Huth
2020-06-18  9:13     ` Peter Maydell
2020-06-18 10:22   ` Philippe Mathieu-Daudé
2020-06-18 10:23     ` Peter Maydell
2020-06-18 10:35       ` Philippe Mathieu-Daudé
2020-06-18  4:59 ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=06bdf82f-858a-6b28-a9f9-e85154ac9c5d@pp1.inet.fi \
    --to=aperamak@pp1.inet.fi \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.