tinycc/lib/fetch_and_add_arm.S
herman ten brugge 039e4ec2a4 Call __bound_main_arg at startup
This uses a glibc feature present since constructor/destructor support was added.

Modify tccrun.c to call constructor with argc, argcv, envp.
In lib/bcheck.c use these values to register them in the splay tree.
Remove HAS_ENVIRON is lib/bcheck.c as it is not needed any more.
Modify win32/lib/crt1.c/win32/lib/dllcrt1.c/win32/lib/wincrt1.c to also
call constructor with argc, argcv, envp.
While implementing I saw that tccrun did nog call main with envp. Fixed it.
Also fix fetch_and_add_arm.S to make it work on armv6 (raspberry pi default).
2020-06-22 14:55:27 +02:00

29 lines
647 B
ArmAsm

.text
.align 2
.global fetch_and_add_arm
.type fetch_and_add_arm, %function
fetch_and_add_arm:
#ifdef __TINYC__
.int 0xee070fba
.int 0xe1903f9f
.int 0xe0833001
.int 0xe1802f93
.int 0xe3520000
.int 0x1afffffa
.int 0xee070fba
.int 0xe12fff1e
#else
.arch armv6
mcr p15, 0, r0, c7, c10, 5
.L0:
ldrex r3, [r0]
add r3, r3, r1
strex r2, r3, [r0]
cmp r2, #0
bne .L0
mcr p15, 0, r0, c7, c10, 5
bx lr
#endif
.size fetch_and_add_arm, .-fetch_and_add_arm