MOS Source Code
Loading...
Searching...
No Matches
spinlock.h File Reference
#include "mos/platform/platform_defs.h"
#include <mos/mos_global.h>
#include <mos/types.h>
+ Include dependency graph for spinlock.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  spinlock_t
 
struct  recursive_spinlock_t
 

Macros

#define barrier()
 
#define spinlock_init(lock)
 
#define SPINLOCK_INIT   { 0 }
 
#define _spinlock_real_acquire(lock)
 
#define _spinlock_real_release(lock)
 
#define spinlock_acquire(lock)
 
#define spinlock_release(lock)
 
#define spinlock_acquire_nodebug(lock)
 
#define spinlock_release_nodebug(lock)
 
#define RECURSIVE_SPINLOCK_INIT   { SPINLOCK_INIT, NULL, 0 }
 

Functions

should_inline bool spinlock_is_locked (const spinlock_t *lock)
 
should_inline void recursive_spinlock_acquire (recursive_spinlock_t *lock, void *owner)
 
should_inline void recursive_spinlock_release (recursive_spinlock_t *lock, void *owner)
 
should_inline bool recursive_spinlock_is_locked (recursive_spinlock_t *lock)
 

Macro Definition Documentation

◆ barrier

#define barrier ( )
Value:
#define MOS_PLATFORM_MEMORY_BARRIER()

Definition at line 10 of file spinlock.h.

◆ spinlock_init

#define spinlock_init ( lock)
Value:
do \
{ \
(lock)->flag = 0; \
} while (0)

Definition at line 21 of file spinlock.h.

Referenced by mos_start_kernel(), and naive_sched_init().

◆ SPINLOCK_INIT

#define SPINLOCK_INIT   { 0 }

Definition at line 28 of file spinlock.h.

Referenced by console_register(), and slab_init_one().

◆ _spinlock_real_acquire

#define _spinlock_real_acquire ( lock)
Value:
do \
{ \
barrier(); \
while (__atomic_test_and_set(&(lock)->flag, __ATOMIC_ACQUIRE)) \
; \
} while (0)

Definition at line 31 of file spinlock.h.

◆ _spinlock_real_release

#define _spinlock_real_release ( lock)
Value:
do \
{ \
__atomic_clear(&(lock)->flag, __ATOMIC_RELEASE); \
} while (0)

Definition at line 39 of file spinlock.h.

◆ spinlock_acquire

#define spinlock_acquire ( lock)
Value:
#define _spinlock_real_acquire(lock)
Definition spinlock.h:31

Definition at line 61 of file spinlock.h.

Referenced by blocked_reschedule(), buddy_alloc_n_exact(), buddy_free_n(), buddy_init(), buddy_reserve_n(), console_io_read(), console_io_write(), console_putc(), console_write(), console_write_color(), cow_allocate_zeroed_pages(), dentry_get_from_parent(), dentry_lookup_child(), dmabuf_free(), do_syslog(), dump_list(), futex_wait(), futex_wake(), hashmap_deinit(), hashmap_get(), hashmap_put(), hashmap_remove(), interrupt_handler_register(), ipc_connect_to_server(), ipc_dump_name_waitlist(), ipc_get_server(), ipc_server_accept(), ipc_server_close(), ipc_server_create(), ipc_sysfs_dump_name_waitlist(), kmemcache_alloc(), kmemcache_free(), mm_dump_pagetable(), mm_lock_ctx_pair(), mm_map_kernel_pages(), mm_map_user_pages(), mmstat_sysfs_pagetable_show(), mmstat_sysfs_vmaps_show(), MOS_STATIC_ASSERT(), munmap(), naive_sched_add_thread(), naive_sched_remove_thread(), naive_sched_select_next(), pipe_close_one_end(), pipe_read(), pipe_write(), process_destroy(), process_do_execveat(), process_do_fork(), process_exit(), recursive_spinlock_acquire(), riscv64_trap_handler(), scheduler_wake_thread(), signal_exit_to_user_prepare(), signal_exit_to_user_prepare_syscall(), signal_has_pending(), signal_send_to_thread(), thread_destroy(), thread_exit(), thread_new(), timer_msleep(), timer_tick(), vfs_find_filesystem(), vfs_io_ops_read(), vfs_io_ops_seek(), vfs_io_ops_write(), vfs_register_filesystem(), vm_protect(), vmap_create(), vmap_obtain(), waitlist_append(), waitlist_close(), waitlist_remove_me(), waitlist_wake(), x86_dump_stack_at(), and x86_pit_timer_handler().

◆ spinlock_release

#define spinlock_release ( lock)
Value:
#define _spinlock_real_release(lock)
Definition spinlock.h:39

Definition at line 62 of file spinlock.h.

Referenced by buddy_alloc_n_exact(), buddy_free_n(), buddy_init(), buddy_reserve_n(), console_io_read(), console_io_write(), console_putc(), console_write(), console_write_color(), cow_allocate_zeroed_pages(), dentry_get_from_parent(), dentry_lookup_child(), dmabuf_free(), do_syslog(), dump_list(), futex_wait(), futex_wake(), hashmap_deinit(), hashmap_get(), hashmap_put(), hashmap_remove(), interrupt_handler_register(), invalid_page_fault(), ipc_connect_to_server(), ipc_dump_name_waitlist(), ipc_get_server(), ipc_server_accept(), ipc_server_close(), ipc_server_create(), ipc_sysfs_dump_name_waitlist(), kmemcache_alloc(), kmemcache_free(), mm_dump_pagetable(), mm_handle_fault(), mm_map_kernel_pages(), mm_map_user_pages(), mm_unlock_ctx_pair(), mmstat_sysfs_pagetable_show(), mmstat_sysfs_vmaps_show(), munmap(), naive_sched_add_thread(), naive_sched_remove_thread(), naive_sched_select_next(), pipe_close_one_end(), pipe_read(), pipe_write(), process_do_execveat(), process_do_fork(), process_exit(), recursive_spinlock_release(), reschedule(), scheduler_wake_thread(), signal_exit_to_user_prepare(), signal_exit_to_user_prepare_syscall(), signal_has_pending(), signal_send_to_thread(), thread_destroy(), thread_new(), timer_msleep(), timer_tick(), vfs_find_filesystem(), vfs_io_ops_read(), vfs_io_ops_seek(), vfs_io_ops_write(), vfs_register_filesystem(), vm_protect(), vmap_finalise_init(), vmap_split_for_range(), waitlist_append(), waitlist_close(), waitlist_remove_me(), waitlist_wake(), and x86_dump_stack_at().

◆ spinlock_acquire_nodebug

#define spinlock_acquire_nodebug ( lock)
Value:

Definition at line 65 of file spinlock.h.

◆ spinlock_release_nodebug

#define spinlock_release_nodebug ( lock)
Value:

Definition at line 66 of file spinlock.h.

◆ RECURSIVE_SPINLOCK_INIT

#define RECURSIVE_SPINLOCK_INIT   { SPINLOCK_INIT, NULL, 0 }

Definition at line 81 of file spinlock.h.

Function Documentation

◆ spinlock_is_locked()

◆ recursive_spinlock_acquire()

should_inline void recursive_spinlock_acquire ( recursive_spinlock_t * lock,
void * owner )

Definition at line 84 of file spinlock.h.

◆ recursive_spinlock_release()

should_inline void recursive_spinlock_release ( recursive_spinlock_t * lock,
void * owner )

Definition at line 98 of file spinlock.h.

◆ recursive_spinlock_is_locked()

should_inline bool recursive_spinlock_is_locked ( recursive_spinlock_t * lock)

Definition at line 111 of file spinlock.h.