diff --git a/include/kernel.h b/include/kernel.h new file mode 100644 index 0000000..1ca0240 --- /dev/null +++ b/include/kernel.h @@ -0,0 +1,6 @@ +#pragma once + +struct kernel_t +{ + +}; \ No newline at end of file diff --git a/include/priorityqueue.h b/include/priorityqueue.h new file mode 100644 index 0000000..f080232 --- /dev/null +++ b/include/priorityqueue.h @@ -0,0 +1,55 @@ +#pragma once + +#include "process.h" +#include + +/** + * @brief + * + */ +struct priority_queue_t +{ + /** + * @brief A pointer to the heap described by this structure. + * + */ + struct process_t **heap; + + /** + * @brief The current number of elements stored in the heap. + * + */ + size_t size; + + /** + * @brief The maximum number of elements that the heap can currently hold. + * + */ + size_t capacity; +}; + +/** + * @brief + * + * @param queue + * @return struct process_t* + */ +struct process_t *extract_min(struct priority_queue_t *queue); + +/** + * @brief + * + * @param queue + * @param process + * @return int + */ +int insert(struct priority_queue_t *queue, struct process_t *process); + +/** + * @brief + * + * @param queue + * @param process + * @return int + */ +int remove(struct priority_queue_t *queue, struct process_t *process); \ No newline at end of file diff --git a/include/process.h b/include/process.h new file mode 100644 index 0000000..be2bdbf --- /dev/null +++ b/include/process.h @@ -0,0 +1,12 @@ +#pragma once + +#include + +struct process_state_t; + +struct process_t +{ + size_t priority; + + struct process_state_t *state; +}; \ No newline at end of file diff --git a/include/types/physaddr.h b/include/types/physaddr.h new file mode 100644 index 0000000..9cf0725 --- /dev/null +++ b/include/types/physaddr.h @@ -0,0 +1,9 @@ +#pragma once + +#if defined __i386__ || __arm__ +typedef uint32_t physaddr_t; +#elif defined __x86_64__ || __aarch64__ +typedef uint64_t physaddr_t; +#else +typedef uint64_t physaddr_t; +#endif \ No newline at end of file diff --git a/include/types/status.h b/include/types/status.h new file mode 100644 index 0000000..3366c8d --- /dev/null +++ b/include/types/status.h @@ -0,0 +1,8 @@ +#pragma once + +enum status_t +{ + S_OK = 0, + S_BAD_SYSCALL, + S_OUT_OF_MEMORY +}; \ No newline at end of file