lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, May 21, 2020 at 5:43 AM Soni "They/Them" L. <fakedme@gmail.com> wrote:

> the 68k can't be interrupted in the middle of an instruction, so on a
> pure 68k even long writes are atomic. however, once you add the z80, it
> *can* sneak in an access in the middle of a long write.

There is certainly a reason why atomics are in C11 and not in C89.

It is also not accidental that Z80 and i8088, ostensibly 16-bit
processors with an 8-bit memory bus, were a high point for Zilog, and
just the beginning for Intel. A relevant difference is that the latter
has a LOCK instruction prefix and a LOCK hardware pin.

In the platform that you mentioned, the main CPU can only do one byte
at a time when accessing the shared memory, and only having acquired
the memory bus of Z80, which stalls the latter - even while it is
trying to access the second half of a 16-bit value, oops.

So it is actually 68K that can "sneak in", which means there are no
"long writes" for either party there. And no atomicity in the shared
memory out of the box. Not that it would be difficult to put together
some atomic protocol.

Cheers,
V.