On 20 January 2012 09:44, 陳韋任 <che...@iis.sinica.edu.tw> wrote: > On Fri, Jan 20, 2012 at 09:09:46AM +0000, Peter Maydell wrote: > AFAIK, LLVM defines it's own memory model [1] which is inspired by the C++11 > memory model. That's why I think instead of implementing architecture-specific > memory model, QEMU should define a more general (strict) one.
LLVM has the advantage that it can require all its incoming code to adhere to a common memory model (ie something like the C++ one). > You said, > > "guest binaries don't actually rely that much on the memory model." > > I think the reason is those guest binaries are single thread. Memory model is > important in multi-threaded case. BTW, our binary translator now can translate > x86 binary to ARM binary, and ARM has weaker memory model than x86. Yes. At the moment this works for QEMU on ARM hosts because in system mode QEMU itself is single-threaded so the nastier interactions between multiple guest CPUs don't occur (just about every memory model defines that memory interactions within a single thread of execution behave in the obvious manner). I also had in mind that guest binaries tend to make fairly stereotypical use of things like LDREX/STREX rather than relying on obscure details like their interaction with plain load/stores. > P.S. Happy Chinese New Year. :) You too! -- PMM