2020-06-16 13:39:48 +08:00
|
|
|
.text
|
|
|
|
.align 2
|
|
|
|
.global fetch_and_add_arm
|
|
|
|
.type fetch_and_add_arm, %function
|
|
|
|
fetch_and_add_arm:
|
2020-06-18 13:21:48 +08:00
|
|
|
#ifdef __TINYC__
|
2020-06-22 20:55:27 +08:00
|
|
|
.int 0xee070fba
|
2020-06-18 13:21:48 +08:00
|
|
|
.int 0xe1903f9f
|
|
|
|
.int 0xe0833001
|
|
|
|
.int 0xe1802f93
|
|
|
|
.int 0xe3520000
|
|
|
|
.int 0x1afffffa
|
2020-06-22 20:55:27 +08:00
|
|
|
.int 0xee070fba
|
2020-06-18 13:21:48 +08:00
|
|
|
.int 0xe12fff1e
|
|
|
|
#else
|
2020-06-22 20:55:27 +08:00
|
|
|
.arch armv6
|
2020-06-16 13:39:48 +08:00
|
|
|
|
2020-06-22 20:55:27 +08:00
|
|
|
mcr p15, 0, r0, c7, c10, 5
|
2020-06-18 13:21:48 +08:00
|
|
|
.L0:
|
|
|
|
ldrex r3, [r0]
|
|
|
|
add r3, r3, r1
|
|
|
|
strex r2, r3, [r0]
|
|
|
|
cmp r2, #0
|
|
|
|
bne .L0
|
2020-06-22 20:55:27 +08:00
|
|
|
mcr p15, 0, r0, c7, c10, 5
|
2020-06-18 13:21:48 +08:00
|
|
|
bx lr
|
|
|
|
#endif
|
2020-06-16 13:39:48 +08:00
|
|
|
.size fetch_and_add_arm, .-fetch_and_add_arm
|