Turnstone Operating System
Loading...
Searching...
No Matches
sync.64.c File Reference

Synchronization primitives. More...

#include <cpu.h>
#include <cpu/sync.h>
#include <cpu/task.h>
#include <apic.h>
#include <logging.h>

Classes

struct  lock_t
 
struct  semaphore_t
 

Typedefs

typedef struct lock_t lock_t
 
typedef uint32_t(* lock_get_local_apic_id_getter_f) (void)
 
typedef task_t *(* lock_current_task_getter_f) (void)
 
typedef void(* lock_task_yielder_f) (void)
 
typedef struct semaphore_t semaphore_t
 

Functions

 MODULE ("turnstone.kernel.cpu.sync")
 
void video_text_print (const char *str)
 
void future_task_wait_toggler (uint64_t task_id)
 
static uint32_t lock_get_local_apic_id (void)
 
static task_tlock_get_current_task (void)
 
static void lock_task_yield (void)
 
static int8_t sync_test_set_get (volatile uint64_t *value, uint64_t offset)
 
lock_tlock_create_with_heap_for_future (memory_heap_t *heap, boolean_t for_future, uint64_t task_id)
 creates lock More...
 
int8_t lock_destroy (lock_t *lock)
 destroys lock More...
 
void lock_acquire (lock_t *lock)
 acquires lock More...
 
void lock_release (lock_t *lock)
 relaases lock More...
 
semaphore_tsemaphore_create_with_heap (memory_heap_t *heap, uint64_t count)
 create semaphore More...
 
int8_t semaphore_destroy (semaphore_t *semaphore)
 destroys semaphore More...
 
int8_t semaphore_acquire_with_count (semaphore_t *semaphore, uint64_t count)
 acquires slots at semaphore More...
 
int8_t semaphore_release_with_count (semaphore_t *semaphore, uint64_t count)
 releases slots at semaphore More...
 

Variables

boolean_t KERNEL_PANIC_DISABLE_LOCKS = false
 
lock_get_local_apic_id_getter_f lock_get_local_apic_id_getter = NULL
 
lock_current_task_getter_f lock_get_current_task_getter = NULL
 
lock_task_yielder_f lock_task_yielder = NULL
 

Detailed Description

Synchronization primitives.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Function Documentation

◆ lock_acquire()

void lock_acquire ( lock_t lock)

acquires lock

Parameters
[in]locklock to acquire

◆ lock_create_with_heap_for_future()

lock_t * lock_create_with_heap_for_future ( memory_heap_t heap,
boolean_t  for_future,
uint64_t  task_id 
)

creates lock

Parameters
[in]heapheap for lock
[in]for_futureis lock for future
Returns
lock

◆ lock_destroy()

int8_t lock_destroy ( lock_t lock)

destroys lock

Parameters
[in]locklock to destroy
Returns
0 if succeed

◆ lock_release()

void lock_release ( lock_t lock)

relaases lock

Parameters
[in]locklock to release

◆ semaphore_acquire_with_count()

int8_t semaphore_acquire_with_count ( semaphore_t semaphore,
uint64_t  count 
)

acquires slots at semaphore

Parameters
[in]semaphoresemaphore to acquire
[in]countsemaphore decrease value
Returns
0 if succeed, or waits

◆ semaphore_create_with_heap()

semaphore_t * semaphore_create_with_heap ( memory_heap_t heap,
uint64_t  count 
)

create semaphore

Parameters
[in]heapheap where semaphore resides
[in]countsemaphore count value
Returns
semaphore

◆ semaphore_destroy()

int8_t semaphore_destroy ( semaphore_t semaphore)

destroys semaphore

Parameters
[in]semaphoresemaphore to destroy

◆ semaphore_release_with_count()

int8_t semaphore_release_with_count ( semaphore_t semaphore,
uint64_t  count 
)

releases slots at semaphore

Parameters
[in]semaphoresemaphore to release
[in]countsemaphore increase value
Returns
0 if succeed