Minor changes to build system

This commit is contained in:
ssimnb 2026-02-17 10:50:52 +01:00
parent f478f8d38b
commit a7fd9ac224
16 changed files with 391 additions and 224 deletions

View file

@ -5,6 +5,9 @@ typedef enum {
/* Success */
KERNEL_STATUS_SUCCESS,
KERNEL_MUTEX_ACQUIRED,
KERNEL_MUTEX_LOCKED,
/* General error */
KERNEL_STATUS_ERROR,
} kstatus;

View file

@ -1,9 +1,23 @@
#include <error.h>
#include <stdatomic.h>
#include <stdbool.h>
#ifndef SPINLOCK_H
#define SPINLOCK_H
struct mutex {
atomic_flag lock;
bool locked;
struct thread *holder;
};
void acquire_spinlock(atomic_flag *lock);
void free_spinlock(atomic_flag *lock);
struct mutex *init_mutex();
kstatus acquire_mutex(struct mutex *mut);
void free_mutex(struct mutex *mut);
kstatus try_mutex(struct mutex *mut);
#endif

View file

@ -3,6 +3,7 @@
#pragma once
typedef enum proc_state {
ZOMBIE = 4,
RUNNING = 3,
READY = 2,
SLEEPING = 1,

3
include/sys/time.h Normal file
View file

@ -0,0 +1,3 @@
#include <stdint.h>
uint64_t get_timestamp_ns();
void sleep(int ms);