# Why Your AArch64 Spin Lock Crashes on Real Hardware but Not in QEMU

Original title: When Ldaxr Doesn't Work: Exclusive Accesses and Cacheability on AArch64

> Hacker News story 50031289 · language: en · submitted 2026-10-10
> Web version: https://zeli.app/story/50031289
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 23 · by [joelsiks](<https://news.ycombinator.com/user?id=joelsiks>) · 💬 4
[original](<https://joelsiks.com/posts/aarch64-exclusive-access-cacheability/>) · [HN discussion](<https://news.ycombinator.com/item?id=50031289>)

## Summary

I built a spin lock for my hobby OS, floss, using ldaxr/stxr. It ran flawlessly in QEMU but threw a Data Abort on a Raspberry Pi 5. The culprit: the SCTLR.C bit was disabled, making memory non-cacheable. Exclusive accesses require Write-Back cacheable memory. Enabling cacheability fixed it, and I confirmed that Write-Through or Non-cacheable attributes also fail.

## Key quote

> When the data cache is disabled, all load and store instructions to cacheable memory are treated as if they were Non-cacheable and are incoherent with the caches in both this core and other cores in the cluster.

---

## Cite

- Page: https://zeli.app/story/50031289
- Date: 2026-10-10
- Source: joelsiks.com (https://joelsiks.com/posts/aarch64-exclusive-access-cacheability/)
- Hacker News: https://news.ycombinator.com/item?id=50031289

## Other languages

- zh: https://zeli.app/zh/story/50031289 · markdown: https://zeli.app/zh/story/50031289.md
- ja: https://zeli.app/ja/story/50031289 · markdown: https://zeli.app/ja/story/50031289.md
- ko: https://zeli.app/ko/story/50031289 · markdown: https://zeli.app/ko/story/50031289.md
- de: https://zeli.app/de/story/50031289 · markdown: https://zeli.app/de/story/50031289.md
- es: https://zeli.app/es/story/50031289 · markdown: https://zeli.app/es/story/50031289.md
- ru: https://zeli.app/ru/story/50031289 · markdown: https://zeli.app/ru/story/50031289.md
