Changeset 09a0bd4a in mainline
- Timestamp:
- 2010-06-24T13:00:16Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2d03471, 33c4f72
- Parents:
- e821e49
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/abs32le/include/atomic.h
re821e49 r09a0bd4a 39 39 #include <arch/barrier.h> 40 40 #include <preemption.h> 41 #include <verify.h> 41 42 42 static inline void atomic_inc(atomic_t *val) { 43 ATOMIC static inline void atomic_inc(atomic_t *val) 44 REQUIRES(val->count < ATOMIC_COUNT_MAX) 45 { 43 46 /* On real hardware the increment has to be done 44 47 as an atomic action. */ … … 47 50 } 48 51 49 static inline void atomic_dec(atomic_t *val) { 52 ATOMIC static inline void atomic_dec(atomic_t *val) 53 REQUIRES(val->count > ATOMIC_COUNT_MIN) 54 { 50 55 /* On real hardware the decrement has to be done 51 56 as an atomic action. */ 52 57 53 val->count ++;58 val->count--; 54 59 } 55 60 56 static inline atomic_count_t atomic_postinc(atomic_t *val) 61 ATOMIC static inline atomic_count_t atomic_postinc(atomic_t *val) 62 REQUIRES(val->count < ATOMIC_COUNT_MAX) 57 63 { 58 64 /* On real hardware both the storing of the previous … … 66 72 } 67 73 68 static inline atomic_count_t atomic_postdec(atomic_t *val) 74 ATOMIC static inline atomic_count_t atomic_postdec(atomic_t *val) 75 REQUIRES(val->count > ATOMIC_COUNT_MIN) 69 76 { 70 77 /* On real hardware both the storing of the previous … … 81 88 #define atomic_predec(val) (atomic_postdec(val) - 1) 82 89 83 static inline atomic_count_t test_and_set(atomic_t *val)90 ATOMIC static inline atomic_count_t test_and_set(atomic_t *val) 84 91 { 92 /* On real hardware the retrieving of the original 93 value and storing 1 have to be done as a single 94 atomic action. */ 95 85 96 atomic_count_t prev = val->count; 86 97 val->count = 1; … … 88 99 } 89 100 101 ATOMIC static inline atomic_count_t arch_atomic_get(atomic_t *val) 102 { 103 /* This function is not needed on real hardware, it just 104 duplicates the functionality of atomic_get(). It is 105 defined here because atomic_get() is an inline function 106 declared in a header file which we are included in. */ 107 108 return val->count; 109 } 110 90 111 static inline void atomic_lock_arch(atomic_t *val) 91 112 { 92 113 do { 93 while ( val->count);114 while (arch_atomic_get(val)); 94 115 } while (test_and_set(val)); 95 116 } -
kernel/arch/abs32le/include/types.h
re821e49 r09a0bd4a 35 35 #ifndef KERN_abs32le_TYPES_H_ 36 36 #define KERN_abs32le_TYPES_H_ 37 38 #define ATOMIC_COUNT_MIN UINT32_MIN 39 #define ATOMIC_COUNT_MAX UINT32_MAX 37 40 38 41 typedef uint32_t size_t; -
kernel/generic/include/atomic.h
re821e49 r09a0bd4a 38 38 #include <typedefs.h> 39 39 #include <arch/atomic.h> 40 #include <verify.h> 40 41 41 static inline void atomic_set(atomic_t *val, atomic_count_t i)42 ATOMIC static inline void atomic_set(atomic_t *val, atomic_count_t i) 42 43 { 43 44 val->count = i; 44 45 } 45 46 46 static inline atomic_count_t atomic_get(atomic_t *val)47 ATOMIC static inline atomic_count_t atomic_get(atomic_t *val) 47 48 { 48 49 return val->count; -
tools/checkers/vcc.py
re821e49 r09a0bd4a 59 59 args = ['gcc', '-E'] 60 60 args.extend(options.split()) 61 args. append(srcfname)61 args.extend(['-DCONFIG_VERIFY_VCC=1', srcfname]) 62 62 63 63 # Change working directory … … 69 69 70 70 tmpf = file(tmpfname, "w") 71 72 tmpf.write("__specification(const char * const \\declspec_atomic_inline;)\n\n"); 73 74 tmpf.write("#define __spec_attr(key, value) \\\n"); 75 tmpf.write(" __declspec(System.Diagnostics.Contracts.CodeContract.StringVccAttr, \\\n"); 76 tmpf.write(" key, value)\n\n"); 71 77 72 78 for line in preproc.splitlines(): … … 149 155 # Run Vcc 150 156 print " -- %s --" % srcfname 151 retval = subprocess.Popen([vcc_path, cygpath(tmpfqname)]).wait()157 retval = subprocess.Popen([vcc_path, '/pointersize:32', cygpath(tmpfqname)]).wait() 152 158 153 159 if (retval != 0):
Note:
See TracChangeset
for help on using the changeset viewer.