Uclinux-2008r1-rc8 (bf561) to VDSP5 transplantation (in): Question of __cmpxchg

Source: Internet
Author: User
Tags int size requires

There is a __cmpxchg function under include/asm/system.h:

/*
* Atomic Compare and Exchange. Compare old with MEM, if identical,
* Store NEW in MEM. Return to the initial value in MEM. Success is
* indicated by comparing return with old.
*/
Static inline unsigned long __cmpxchg (volatile void *ptr, unsigned long old,
unsigned long new, int size)
{
unsigned long tmp = 0;
unsigned long flags = 0;
Local_irq_save (flags);
switch (size) {
Case 1:
__asm__ __volatile__
("%0 = b%3 (z);/n/t")
"CC =%1 = =%0;/n/t"
"IF! CC JUMP 1f;/n/t "
"b%3 =%2;/n/t"
"1:/n/t"
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
Break
Case 2:
__asm__ __volatile__
("%0 = w%3 (z);/n/t")
"CC =%1 = =%0;/n/t"
"IF! CC JUMP 1f;/n/t "
"w%3 =%2;/n/t"
"1:/n/t"
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
Break
Case 4:
__asm__ __volatile__
("%0 =%3;/n/t"
"CC =%1 = =%0;/n/t"
"IF! CC JUMP 1f;/n/t "
"%3 =%2;/n/t"
"1:/n/t"
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
Break
}
Local_irq_restore (flags);
return TMP;
}

Compiling under VDSP will produce the following syntax error:

".. /.. /include/asm/system.h ", line 209:cc1101:error:invalid constraint in
ASM statement
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
^
".. /.. /include/asm/system.h ", line 209:cc1155:error:gnu ASM operand
Requires integral or pointer type
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
^
".. /.. /include/asm/system.h ", line 218:cc1101:error:invalid constraint in
ASM statement
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
^
".. /.. /include/asm/system.h ", line 218:cc1155:error:gnu ASM operand
Requires integral or pointer type
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
^
".. /.. /include/asm/system.h ", line 227:cc1101:error:invalid constraint in
ASM statement
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
^
".. /.. /include/asm/system.h ", line 227:cc1155:error:gnu ASM operand
Requires integral or pointer type
: "=&d" (TMP): "D" (old), "D" (New), "M" (*__xg (PTR)): "Memory");
^
6 Errors detected in the compilation of ". /.. /fs/sysfs/dir.c ".
Cc3089:fatal Error:compilation failed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.