diff options
Diffstat (limited to 'src/pkg/runtime/atomic_arm.c')
| -rw-r--r-- | src/pkg/runtime/atomic_arm.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pkg/runtime/atomic_arm.c b/src/pkg/runtime/atomic_arm.c index d914475c7f..537bf18331 100644 --- a/src/pkg/runtime/atomic_arm.c +++ b/src/pkg/runtime/atomic_arm.c @@ -167,3 +167,19 @@ runtime·atomicstore64(uint64 volatile *addr, uint64 v) *addr = v; runtime·unlock(LOCK(addr)); } + +#pragma textflag NOSPLIT +void +runtime·atomicor8(byte volatile *addr, byte v) +{ + uint32 *addr32, old, word, shift; + + // Align down to 4 bytes and use 32-bit CAS. + addr32 = (uint32*)((uintptr)addr & ~3); + word = ((uint32)v) << (((uintptr)addr & 3) * 8); + for(;;) { + old = *addr32; + if(runtime·cas(addr32, old, old|word)) + break; + } +} |
