add support for sh2 interrupt-masking-based atomics to sh port
authorRich Felker <dalias@aerifal.cx>
Tue, 16 Jun 2015 14:28:30 +0000 (14:28 +0000)
committerRich Felker <dalias@aerifal.cx>
Tue, 16 Jun 2015 14:38:41 +0000 (14:38 +0000)
commitf9d84554bae0fa17c9a1d724549c4408022228a5
treee40d11d2c4af3c4bef11720664e92a288e6d37e4
parent1b0cdc8700d29ef018bf226d74b2b58b23bce91c
add support for sh2 interrupt-masking-based atomics to sh port

the sh2 target is being considered an ISA subset of sh3/sh4, in the
sense that binaries built for sh2 are intended to be usable on later
cpu models/kernels with mmu support. so rather than hard-coding
sh2-specific atomics, the runtime atomic selection mechanisms that was
already in place has been extended to add sh2 atomics.

at this time, the sh2 atomics are not SMP-compatible; since the ISA
lacks actual atomic operations, the new code instead masks interrupts
for the duration of the atomic operation, producing an atomic result
on single-core. this is only possible because the kernel/hardware does
not impose protections against userspace doing so. additional changes
will be needed to support future SMP systems.

care has been taken to avoid producing significant additional code
size in the case where it's known at compile-time that the target is
not sh2 and does not need sh2-specific code.
arch/sh/src/__set_thread_area.c [new file with mode: 0644]
arch/sh/src/atomic.c
arch/sh/src/sh_atomic.h [new file with mode: 0644]
src/thread/sh/__set_thread_area.s