qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] qemu softmmu_template.h
Date: Sat, 17 Nov 2007 13:58:51 +0000	[thread overview]
Message-ID: <200711171358.53403.paul@codesourcery.com> (raw)
In-Reply-To: <1195295212.5335.36.camel@rapid>

> > > >       Check permissions for the last byte first in unaligned slow_st
> > > > accesses (patch from TeLeMan).
> > >
> > > Has it been checked that it's legal for all architectures and cannot
> > > have any nasty side effect to do accesses in the reverse order ? Real
> > > hardware do not ever seem to do this...
> >
> > For real hardware the store is a single operation.
>
> For PowerPC, at least, only aligned stores are defined as atomic. It's
> absolutely legal for an implementation to split all non-atomic accesses
> into smaller aligned accesses. And I guess it is the same for all

Depends how you're measuring atomicity. It's possible for an architecture 
could have non-atomic stores (w.r.t. other CPUs in an SMP system), but 
require that MMU faults restore state as it was before the faulting 
instruction executed. By my reading this is that case for x86.

For ARM these checks are unnecessary and the previous code was acceptable. 
Quoting from the ARM architecture manual:
"
If a Data Abort occurs [...] the value of each memory location that the 
instruction stores to is:
* unchanged if the memory system does not permit write access to the memory 
location
* UNPREDICTABLE otherwise
"
There is also wording that explicitly allows the CPU to split an unaligned 
access into multiple smaller accesses.

> One case that obviously can have nasty side effects is if doing
> unaligned IO accesses

ARM does not allow unaligned accesses to IO regions, so this should not be a 
problem there.

Paul

  parent reply	other threads:[~2007-11-17 13:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-17  9:53 [Qemu-devel] qemu softmmu_template.h Andrzej Zaborowski
2007-11-17 10:00 ` J. Mayer
2007-11-17 10:14   ` andrzej zaborowski
2007-11-17 10:26     ` J. Mayer
2007-11-17 10:44       ` andrzej zaborowski
2007-11-17 11:02         ` J. Mayer
2007-11-17 11:57           ` andrzej zaborowski
2007-11-17 12:08             ` J. Mayer
2007-11-17 11:14         ` Blue Swirl
2007-11-17 11:40         ` Fabrice Bellard
2007-11-17 13:58       ` Paul Brook [this message]
2007-11-17 13:00 ` TeLeMan
  -- strict thread matches above, loose matches on Subject: below --
2006-02-08 22:41 Fabrice Bellard
2005-12-05 19:57 Fabrice Bellard
2005-11-26 10:28 Fabrice Bellard
2003-11-09 16:58 Fabrice Bellard

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=200711171358.53403.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).