From f4c255955f34203a7936c333e14a5d4ea118604b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 15 Jan 2025 14:31:57 +0100 Subject: [PATCH] fixup "base: remove base/internal/unmanaged_singleton.h" (armv6) --- repos/base-hw/src/bootstrap/init.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/repos/base-hw/src/bootstrap/init.cc b/repos/base-hw/src/bootstrap/init.cc index d8d266fd4f..e29fe4b91b 100644 --- a/repos/base-hw/src/bootstrap/init.cc +++ b/repos/base-hw/src/bootstrap/init.cc @@ -28,8 +28,16 @@ __attribute__((aligned(get_page_size()))); Bootstrap::Platform & Bootstrap::platform() { - static Bootstrap::Platform platform { }; - return platform; + /* + * Don't use static local variable because cmpxchg cannot be executed + * w/o MMU on ARMv6. + */ + static long _obj[(sizeof(Bootstrap::Platform)+sizeof(long))/sizeof(long)]; + static Bootstrap::Platform *ptr; + if (!ptr) + ptr = construct_at(_obj); + + return *ptr; }