Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No. Rosetta emulates TSO correctly.


To draw together the two answers here to the original question.

1) Emulating an ISA includes emulating its memory model. As saagarjha says, this means that Rosetta 2 must (and does) correctly implement total store ordering.

2) There are various ways to implement this. For emulators that include a binary translation layer (that is, that translate x86 opcodes into a sequence of ARM opcodes), one route is to generate the appropriate ARM memory barriers as part of the translation. Even with optimization to reduce the number of necessary barriers, though, this is expensive. Instead, as mmwelt mentions, Apple took an unusual route here. The Apple Silicon MMU can be configured on a per-page basis to use either the relaxed ARM memory model or the TSO x86 memory model. There is a performance cost at the hardware level for using TSO, and there is a cost in silicon area for supporting both; but from the point of view of Rosetta 2, all it has to do is mark x86-accessed pages as TSO and the hardware takes care of the details, no software memory barriers needed.


TSO is a per-thread flag; it’s implemented as a write to a MSR on context switch to switch it on or off.


Right, is it POWER that has a per page TSO flag?


I actually do not know, sadly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: