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

Feature: Synchronization between cached and non-cached memory #129

Open
nsch0e opened this issue Sep 12, 2021 · 0 comments
Open

Feature: Synchronization between cached and non-cached memory #129

nsch0e opened this issue Sep 12, 2021 · 0 comments

Comments

@nsch0e
Copy link

nsch0e commented Sep 12, 2021

Missing feature

Function to synchronize between cached and non-cached memory so they contain the same content.

Justification

For example dma seems to work only on non-cached memory so all cached memory arguments get copied to extra allocated non-cached memory:

memcpy(src_io, src, 1<<dmac_trans_width);

this is non-performant and dangerous because of the amount of mallocs used.

Workarounds (kind of)

you can use a normal variable as non-cached by subtracting the offset between cache and non-cached memory like this:

uint8_t arrCached[1024];
uint8_t *arr = arrCached - 0x40000000;

but there is no guarantee at any point that arrCached and arr show the same results although they point to mirrored memory.

Would using the mb() (memory barrier) macro be enough?

Kind regards!

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

No branches or pull requests

1 participant