Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

kernel/atomic.c

Go to the documentation of this file.
00001 #include "config.h"
00002 #include <atomic.h>
00003 
00004 #ifdef CONF_ATOMIC
00005 
00012 void atomic_inc(atomic_t* counter);
00013 __asm__("\n\
00014 .text\n\
00015 .globl _atomic_inc\n\
00016        _atomic_inc:\n\
00017         stc   ccr, r1h                          ; save flags\n\
00018         orc   #0x80, ccr                        ; disable all but NMI\n\
00019         mov.b @r0, r1l\n\
00020         inc   r1l\n\
00021         mov.b r1l, @r0\n\
00022         ldc   r1h, ccr                          ; restore flags\n\
00023         rts\n\
00024 ");
00025 
00033 void atomic_dec(atomic_t* counter);
00034 __asm__("\n\
00035 .text\n\
00036 .globl _atomic_dec\n\
00037        _atomic_dec:\n\
00038          stc   ccr, r1h\n\
00039          orc   #0x80, ccr\n\
00040          mov.b @r0, r1l\n\
00041          dec   r1l\n\
00042          mov.b r1l, @r0\n\
00043          ldc   r1h, ccr\n\
00044          rts\n\
00045 ");
00046 #endif

brickOS is released under the Mozilla Public License.
Original code copyright 1998-2002 by the authors.

Generated on Mon Feb 16 21:02:10 2004 for brickOS Kernel Developer by doxygen 1.3.5