BSD licensed GCC x86 32/64bit RTL atomic operations library
$30-250 USD
已完成
已发布超过 12 年前
$30-250 USD
货到付款
The library shall implement common atomic operations such as inc, dec, add, sub, xchg, cmpxchg, xadd. See for example Linux kernel atomic operations.
A test program written in C must be provided
The library shall compile with GNU/GCC 4.1 or later and is to be BSD licensed.
The library shall support x86 32bit (i686+) and 64bit CPU's
Operand sizes are 8, 16, 32 and 64bits (also on 32 bit i686+ systems).
Examples are:
/*!
* Atomically exchange 32 bit values
*
* @param p Pointer to value
* @param v new 32 bit value
* @return old new v value
*/
static inline uint atomic_xchg32(volatile uint *p, uint v)
{
__asm__ __volatile__("xchgl %0, %1"
:"=q" (v)
:"m" (*p), "0" (v)
:"memory");
return v;
}
/*!
* Atomically xadd to 4byte value
*
* @param p Pointer to value
* @param v value to add
*/
static inline u32 atomic_xadd32(uint *p, uint v)
{
__asm__ __volatile__("lock xaddl %0, (%1)n"
: "+r" (v), "+r" (p)
:
: "memory");
return v;
}
The implementation _must_ be _original_ and the copyright holder is the developer, under the following 2 clause BSD license.
/* Copyright (c), 201x developer
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * The name of developer may not be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Please provide a detailed list of functions you intend to implement.
Please explain how you will implement the test program to test these functions.
Hello. I have implemented this kind of library before on other architectures.
I have experience of concurrent programming from working extensively with Real Time Operating Systems.
Also I am well versed in C, assembly language and GCC.
List of functions sent in PM - please let me know if there's any you wish me to add. Test method also in PM.