Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support atomic load and store #68

Open
LnnrtS opened this issue Jan 18, 2021 · 5 comments
Open

Support atomic load and store #68

LnnrtS opened this issue Jan 18, 2021 · 5 comments

Comments

@LnnrtS
Copy link
Contributor

LnnrtS commented Jan 18, 2021

This works out of the box

std::atomic<uint32_t> tmp;
tmp = 123;

this doesn't

std::atomic<uint64_t> tmp;
tmp = 123;

because of this

in function `std::__atomic_base<unsigned long long>::store(unsigned long long, std::memory_order)':
undefined reference to `__atomic_store_8'
@ilg-ul
Copy link
Contributor

ilg-ul commented Jan 18, 2021

I don't remember anything about using atomic operations in µOS++.

Where do the atomic definitions come from?

@LnnrtS
Copy link
Contributor Author

LnnrtS commented Jan 18, 2021

I don't know but I could imagine it knows that the architecture supports atomic operations under some circumstances (everything smaller than words) without further measures.

@ilg-ul
Copy link
Contributor

ilg-ul commented Jan 18, 2021

Then probably it comes from the compiler definitions.

How do you suggest to fix it?

@LnnrtS
Copy link
Contributor Author

LnnrtS commented Jan 18, 2021

How do you suggest to fix it?

I haven't though much about it but I would guess the actual access has to happen inside some critical section.

@ilg-ul
Copy link
Contributor

ilg-ul commented Jan 18, 2021

inside some critical section

AFAIK, atomics are implemented with some special instructions, not explicit critical sections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants