Changeset 9a2d6e1 in mainline


Ignore:
Timestamp:
2006-03-15T18:58:26Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
649799a
Parents:
9e1c942
Message:

Redefine semantics of unary atomic operations.
Add test to verify that an architecture understands the semantics correctly.

Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/atomic.h

    r9e1c942 r9a2d6e1  
    6060}
    6161
    62 static inline count_t atomic_inc_pre(atomic_t *val)
     62static inline count_t atomic_postinc(atomic_t *val)
    6363{
    6464        count_t r;
     
    7373}
    7474
    75 static inline count_t atomic_dec_pre(atomic_t *val)
     75static inline count_t atomic_postdec(atomic_t *val)
    7676{
    7777        count_t r;
     
    8686}
    8787
    88 #define atomic_inc_post(val) (atomic_inc_pre(val)+1)
    89 #define atomic_dec_post(val) (atomic_dec_pre(val)-1)
     88#define atomic_preinc(val) (atomic_postinc(val)+1)
     89#define atomic_predec(val) (atomic_postdec(val)-1)
    9090
    9191static inline __u64 test_and_set(atomic_t *val) {
  • arch/ia32/include/atomic.h

    r9e1c942 r9a2d6e1  
    6060}
    6161
    62 static inline count_t atomic_inc_pre(atomic_t *val)
     62static inline count_t atomic_postinc(atomic_t *val)
    6363{
    6464        count_t r;
     
    7373}
    7474
    75 static inline count_t atomic_dec_pre(atomic_t *val)
     75static inline count_t atomic_postdec(atomic_t *val)
    7676{
    7777        count_t r;
     
    8686}
    8787
    88 #define atomic_inc_post(val) (atomic_inc_pre(val)+1)
    89 #define atomic_dec_post(val) (atomic_dec_pre(val)-1)
     88#define atomic_preinc(val) (atomic_postinc(val)+1)
     89#define atomic_predec(val) (atomic_postdec(val)-1)
    9090
    9191static inline __u32 test_and_set(atomic_t *val) {
  • arch/ia64/include/atomic.h

    r9e1c942 r9a2d6e1  
    3939 * @param imm Value to add.
    4040 *
    41  * @return Value after addition.
     41 * @return Value before addition.
    4242 */
    4343static inline count_t atomic_add(atomic_t *val, int imm)
     
    6363static inline void atomic_dec(atomic_t *val) { atomic_add(val, -1); }
    6464
    65 static inline count_t atomic_inc_pre(atomic_t *val) { return atomic_add(val, 1); }
    66 static inline count_t atomic_dec_pre(atomic_t *val) { return atomic_add(val, -1); }
     65static inline count_t atomic_preinc(atomic_t *val) { return atomic_add(val, 1) + 1; }
     66static inline count_t atomic_predec(atomic_t *val) { return atomic_add(val, -1) - 1; }
    6767
    68 static inline count_t atomic_inc_post(atomic_t *val) { return atomic_add(val, 1) + 1; }
    69 static inline count_t atomic_dec_post(atomic_t *val) { return atomic_add(val, -1) - 1; }
     68static inline count_t atomic_postinc(atomic_t *val) { return atomic_add(val, 1); }
     69static inline count_t atomic_postdec(atomic_t *val) { return atomic_add(val, -1); }
    7070
    7171#endif
  • arch/mips32/include/atomic.h

    r9e1c942 r9a2d6e1  
    3535#define atomic_dec(x)   ((void) atomic_add(x, -1))
    3636
    37 #define atomic_inc_pre(x) (atomic_add(x, 1) - 1)
    38 #define atomic_dec_pre(x) (atomic_add(x, -1) + 1)
     37#define atomic_postinc(x) (atomic_add(x, 1) - 1)
     38#define atomic_postdec(x) (atomic_add(x, -1) + 1)
    3939
    40 #define atomic_inc_post(x) atomic_add(x, 1)
    41 #define atomic_dec_post(x) atomic_add(x, -1)
    42 
     40#define atomic_preinc(x) atomic_add(x, 1)
     41#define atomic_predec(x) atomic_add(x, -1)
    4342
    4443typedef struct { volatile __u32 count; } atomic_t;
  • arch/ppc32/include/atomic.h

    r9e1c942 r9a2d6e1  
    6464}
    6565
    66 static inline __u32 atomic_inc_pre(atomic_t *val)
     66static inline __u32 atomic_postinc(atomic_t *val)
    6767{
    6868        atomic_inc(val);
     
    7070}
    7171
    72 static inline __u32 atomic_dec_pre(atomic_t *val)
     72static inline __u32 atomic_postdec(atomic_t *val)
    7373{
    7474        atomic_dec(val);
     
    7676}
    7777
    78 static inline __u32 atomic_inc_post(atomic_t *val)
     78static inline __u32 atomic_preinc(atomic_t *val)
    7979{
    8080        atomic_inc(val);
     
    8282}
    8383
    84 static inline __u32 atomic_dec_post(atomic_t *val)
     84static inline __u32 atomic_predec(atomic_t *val)
    8585{
    8686        atomic_dec(val);
  • arch/sparc64/include/atomic.h

    r9e1c942 r9a2d6e1  
    6363}
    6464
     65static inline count_t atomic_preinc(atomic_t *val)
     66{
     67        return atomic_add(val, 1) + 1;
     68}
     69
     70static inline count_t atomic_postinc(atomic_t *val)
     71{
     72        return atomic_add(val, 1);
     73}
     74
     75static inline count_t atomic_predec(atomic_t *val)
     76{
     77        return atomic_add(val, -1) - 1;
     78}
     79
     80static inline count_t atomic_postdec(atomic_t *val)
     81{
     82        return atomic_add(val, 1);
     83}
     84
    6585static inline void atomic_inc(atomic_t *val)
    6686{
  • generic/src/syscall/syscall.c

    r9e1c942 r9a2d6e1  
    125125static int check_call_limit(void)
    126126{
    127         if (atomic_inc_post(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) {
     127        if (atomic_preinc(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) {
    128128                atomic_dec(&TASK->active_calls);
    129129                return -1;
  • kernel.config

    r9e1c942 r9a2d6e1  
    7575# Kernel test type
    7676@ "" No test
     77@ "atomic/atomic1" Test of atomic operations.
    7778@ "synch/rwlock1" Read write test 1
    7879@ "synch/rwlock2" Read write test 2
Note: See TracChangeset for help on using the changeset viewer.