MentOS
0.8.0
The Mentoring Operating System
|
Go to the source code of this file.
Macros | |
#define | LOCK_PREFIX "\n\tlock; " |
The prefix used to lock. | |
#define | barrier() |
Compile read-write barrier. More... | |
#define | cpu_relax() |
Pause instruction to prevent excess processor bus usage. More... | |
Typedefs | |
typedef volatile unsigned | atomic_t |
Standard structure for atomic operations (see below for volatile explanation). | |
Functions | |
static int | atomic_set_and_test (atomic_t *ptr, int value) |
Atomically sets value at ptr . More... | |
static void | atomic_set (atomic_t *ptr, int value) |
Atomically set the value pointed by ptr to value . More... | |
static int | atomic_read (const atomic_t *ptr) |
Atomically read the value pointed by ptr . More... | |
static int | atomic_add (atomic_t *ptr, int value) |
Atomically add value to the value pointed by ptr . More... | |
static int | atomic_sub (atomic_t *ptr, int value) |
Atomically subtract value from the value pointed by ptr . More... | |
static int | atomic_inc (atomic_t *ptr) |
Atomically increment the value at ptr . More... | |
static int | atomic_dec (atomic_t *ptr) |
Atomically decrement the value at ptr . More... | |
static int | atomic_add_negative (atomic_t *ptr, int value) |
Atomically add value to ptr and checks if the result is negative. More... | |
static int | atomic_sub_and_test (atomic_t *ptr, int value) |
Atomically subtract value from ptr and checks if the result is zero. More... | |
static int | atomic_inc_and_test (atomic_t *ptr) |
Atomically increment ptr and checks if the result is zero. More... | |
static int | atomic_dec_and_test (atomic_t *ptr) |
Atomically decrement ptr and checks if the result is zero. More... | |
static void | set_bit (int offset, volatile unsigned long *base) |
Atomically sets a bit in memory, using Bit Test And Set (bts). More... | |
static void | clear_bit (int offset, volatile unsigned long *base) |
Atomically clears a bit in memory. More... | |
static int | test_bit (int offset, volatile unsigned long *base) |
Atomically tests a bit in memory. More... | |
#define barrier | ( | ) |
Compile read-write barrier.
#define cpu_relax | ( | ) |
Pause instruction to prevent excess processor bus usage.
|
inlinestatic |
Atomically add value
to the value pointed by ptr
.
ptr | the pointer we are working with. |
value | the value we need to add. |
|
inlinestatic |
Atomically add value
to ptr
and checks if the result is negative.
ptr | the pointer we are working with. |
value | the value we need to add. |
|
inlinestatic |
Atomically decrement the value at ptr
.
ptr | the pointer we are working with. |
|
inlinestatic |
Atomically decrement ptr
and checks if the result is zero.
ptr | the pointer we are working with. |
|
inlinestatic |
Atomically increment the value at ptr
.
ptr | the pointer we are working with. |
|
inlinestatic |
Atomically increment ptr
and checks if the result is zero.
ptr | the pointer we are working with. |
|
inlinestatic |
Atomically read the value pointed by ptr
.
ptr | the pointer we are working with. |
|
inlinestatic |
Atomically set the value pointed by ptr
to value
.
ptr | the pointer we are working with. |
value | the value we need to set. |
|
inlinestatic |
Atomically sets value
at ptr
.
ptr | the pointer we are working with. |
value | the value to set. |
|
inlinestatic |
Atomically subtract value
from the value pointed by ptr
.
ptr | the pointer we are working with. |
value | the value we need to subtract. |
|
inlinestatic |
Atomically subtract value
from ptr
and checks if the result is zero.
ptr | the pointer we are working with. |
value | the value we need to subtract. |
|
inlinestatic |
Atomically clears a bit in memory.
offset | The offset to the bit. |
base | The base address. |
|
inlinestatic |
Atomically sets a bit in memory, using Bit Test And Set (bts).
offset | The offset to the bit. |
base | The base address. |
|
inlinestatic |
Atomically tests a bit in memory.
offset | The offset to the bit. |
base | The base address. |