Hi Jiří,

Jiří Zárevúcky <[email protected]> wrote:

> Hi Miroslav,
> supporting the atomic operations you need is a simple matter of adding the 
> missing functions to uspace/lib/c/arch/arm32/src/atomic.c
>
> I wouldn't worry too much about it. Use what you need, I'll help sort out the 
> missing stuff if needed. :)

Thanks, I didn't know about that. I wrote implementations for:
    - __atomic_compare_exchange_1 [1]
    - __atomic_{load,store}_8 [2]

Could you please review them?


Other functions in uspace/lib/c/arch/arm32/src/atomic.c seem to not have a 
clobber argument
"memory", even though they modify memory [3]. (I don't know if they are needed 
at all:
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Clobbers-and-Scratch-Registers-1)


Another question: in `__atomic_fetch_add_2()' (same file) there is an `unsigned 
short ret',
to which there is a *word* written to in the inline assembly RAS (Restartable 
Atomic Seqeunce)
prologue, while the `ret' is half-word. Does the compiler internally promote it 
to 32-bits
for the `str', `ldr', or it doesn't care as it is a register anyway? That's 
also the reason
I let the `ret' in [1] be an `unsigned', instead of `unsigned char'.


... and I tried mips32 as well, the 8 byte stores and loads are missing there, 
but there
is no uspace/lib/c/arch/mips32/src/atomic.c, is it technically possible to add 
it?


[1]:
 - branch: arm32-atomic_cmpexchg_1 
(https://github.com/mcimerman/helenos/tree/arm32-atomic_cmpexchg_1)
 - commit: 
https://github.com/mcimerman/helenos/commit/a2332a14639bbc3b179b56366ddf2805ca2863d6

[2]:
 - branch: arm32-atomic_ldr_str_8 
(https://github.com/mcimerman/helenos/tree/arm32-atomic_ldr_str_8)
 - commit: 
https://github.com/mcimerman/helenos/commit/977df1a63f1409c1c3da4dd4a8b2e2da8fc8f634

[3]:
 - branch: arm32-atomic-mem-fix 
(https://github.com/mcimerman/helenos/tree/arm32-atomic-mem-fix)
 - commit: 
https://github.com/mcimerman/helenos/commit/958f62d64d06cdcafaf0e00fc713b455743cb58d


Thanks.
--
mc

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to