Minor changes to build system
This commit is contained in:
parent
f478f8d38b
commit
a7fd9ac224
16 changed files with 391 additions and 224 deletions
|
|
@ -5,6 +5,9 @@ typedef enum {
|
|||
/* Success */
|
||||
KERNEL_STATUS_SUCCESS,
|
||||
|
||||
KERNEL_MUTEX_ACQUIRED,
|
||||
KERNEL_MUTEX_LOCKED,
|
||||
|
||||
/* General error */
|
||||
KERNEL_STATUS_ERROR,
|
||||
} kstatus;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
3
include/sys/time.h
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#include <stdint.h>
|
||||
uint64_t get_timestamp_ns();
|
||||
void sleep(int ms);
|
||||
Loading…
Add table
Add a link
Reference in a new issue