miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
Loading...
Searching...
No Matches
spinlock.c File Reference
Include dependency graph for spinlock.c:

Functions

static uint16_t atomic_xadd_u16 (volatile uint16_t *ptr, uint16_t val)
static void atomic_inc_u8_low (volatile uint16_t *ptr)
static void save_flags_and_cli (unsigned long *flags)
static void restore_flags (unsigned long flags)
void spinlock_lock (spinlock_t *lock)
void spinlock_unlock (spinlock_t *lock)
void spinlock_irqsave (spinlock_t *lock, unsigned long *flags)
void spinlock_irqrestore (spinlock_t *lock, unsigned long flags)
void spinlock_irq (spinlock_t *lock)
void spinlock_irq_unlock (spinlock_t *lock)

Function Documentation

◆ atomic_inc_u8_low()

void atomic_inc_u8_low ( volatile uint16_t * ptr)
inlinestatic

atomic_inc_u8_low — atomically increment low byte of *ptr (owner field). Must NOT use incw: incw increments the full 16-bit value, so when the owner byte overflows 0xFF→0x00 the carry corrupts the next-ticket byte. incb on the low byte increments only bits [7:0] without carry.

Here is the caller graph for this function:

◆ atomic_xadd_u16()

uint16_t atomic_xadd_u16 ( volatile uint16_t * ptr,
uint16_t val )
inlinestatic

atomic_xadd_u16 — atomically: tmp = *ptr; *ptr += val; return tmp

Here is the caller graph for this function:

◆ restore_flags()

void restore_flags ( unsigned long flags)
inlinestatic

restore_flags — push saved value onto stack, popf restores RFLAGS.IF

Here is the caller graph for this function:

◆ save_flags_and_cli()

void save_flags_and_cli ( unsigned long * flags)
inlinestatic

save_flags_and_cli — push RFLAGS to *flags, then cli

Here is the caller graph for this function: