Add mutex syscalls
This commit is contained in:
@@ -4,14 +4,18 @@
|
||||
#include <alloc/liballoc.h>
|
||||
#include <m/system.h>
|
||||
|
||||
#define LIBALLOC_MUTEX 500
|
||||
|
||||
static uintptr_t liballoc_map_base = PROC_MAP_BASE;
|
||||
static int mem_rid_base = 1000000;
|
||||
|
||||
void liballoc_init (void) {}
|
||||
void liballoc_init (void) { create_mutex (LIBALLOC_MUTEX, RV_PRIVATE); }
|
||||
|
||||
int liballoc_lock (void) { return 0; }
|
||||
void liballoc_deinit (void) { unlink_mutex (LIBALLOC_MUTEX, RV_PRIVATE); }
|
||||
|
||||
int liballoc_unlock (void) { return 0; }
|
||||
int liballoc_lock (void) { return lock_mutex (LIBALLOC_MUTEX, RV_PRIVATE); }
|
||||
|
||||
int liballoc_unlock (void) { return unlock_mutex (LIBALLOC_MUTEX, RV_PRIVATE); }
|
||||
|
||||
void* liballoc_alloc (int pages, int* mem_rid) {
|
||||
uintptr_t current_base = liballoc_map_base;
|
||||
|
||||
@@ -87,6 +87,7 @@ void* calloc (size_t, size_t); //< The standard function.
|
||||
void free (void*); //< The standard function.
|
||||
|
||||
void liballoc_init (void);
|
||||
void liballoc_deinit (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user