Ignore:
Timestamp:
2010-01-07T19:06:59Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8190e63
Parents:
743e17b (diff), eca2435 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/include/atomicdflt.h

    r743e17b r985e26d2  
    11/*
    2  * Copyright (c) 2005 Jakub Jermar
     2 * Copyright (c) 2006 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup generic
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    3333 */
    3434
    35 /*
    36  * Variable argument list manipulation macros
    37  * for architectures using stack to pass arguments.
    38  */
    39  
    40 #ifndef KERN_STACKARG_H_
    41 #define KERN_STACKARG_H_
     35#ifndef LIBC_ATOMICDFLT_H_
     36#define LIBC_ATOMICDFLT_H_
    4237
    43 #include <arch/types.h>
     38#ifndef LIBC_ARCH_ATOMIC_H_
     39#error This file cannot be included directly, include atomic.h instead.
     40#endif
    4441
    45 typedef struct va_list {
    46         int pos;
    47         uint8_t *last;
    48 } va_list;
     42#include <bool.h>
    4943
    50 #define va_start(ap, lst)               \
    51         (ap).pos = sizeof(lst);                         \
    52         (ap).last = (uint8_t *) &(lst)
     44typedef struct atomic {
     45        volatile long count;
     46} atomic_t;
    5347
    54 #define va_arg(ap, type)                \
    55         (*((type *)((ap).last + ((ap).pos += sizeof(type)) - sizeof(type))))
     48static inline void atomic_set(atomic_t *val, long i)
     49{
     50        val->count = i;
     51}
    5652
    57 #define va_copy(dst, src) dst = src
    58 #define va_end(ap)
     53static inline long atomic_get(atomic_t *val)
     54{
     55        return val->count;
     56}
    5957
     58#ifndef CAS
     59static inline bool cas(atomic_t *val, long ov, long nv)
     60{
     61        return __sync_bool_compare_and_swap(&val->count, ov, nv);
     62}
     63#endif
    6064
    6165#endif
Note: See TracChangeset for help on using the changeset viewer.