Started separating important structs from kernel.c

This commit is contained in:
2023-11-08 14:13:03 -06:00
parent 108e04a8f0
commit c5ef8c53a7
6 changed files with 160 additions and 0 deletions

16
include/addressspace.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef QUARK_ADDRESSSPACE_H
#define QUARK_ADDRESSSPACE_H
#include "types/physaddr.h"
typedef struct addressspace_t
{
physaddr_t page_table;
int refcount;
} addressspace_t;
addressspace_t *addressspace_construct();
#endif

33
include/process.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef QUARK_PROCESS_H
#define QUARK_PROCESS_H
#include "types/pid.h"
#include "types/physaddr.h"
#include "types/status.h"
#include "queue.h"
typedef enum process_state_t
{
PROCESS_ACTIVE,
PROCESS_REQUESTING,
PROCESS_SENDING
} process_state_t;
typedef struct process_t
{
pid_t pid;
int priority;
physaddr_t page_table;
struct avltree_t *shared_objects;
process_state_t state;
struct queue_t sending_queue;
struct queue_t message_queue;
struct message_t *message_buffer;
struct process_context_t *ctx;
} process_t;
process_t *process_construct(pid_t pid, void *entry, void *stack, int priority, physaddr_t address_space);
error_t process_call_func(process_t *process, void *func, void *ret, int argc, ...);
#endif

20
include/sharedobject.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef QUARK_SHARED_OBJECT_H
#define QUARK_SHARED_OBJECT_H
#include "types/physaddr.h"
#include <stddef.h>
struct shared_object_t
{
physaddr_t phys_addr;
size_t size;
unsigned long access_flags;
unsigned long refcount;
struct avltree_t *users;
};
struct shared_object *create_shared_object(size_t size, unsigned long flags);
void destroy_shared_object(struct shared_object_t *obj);
#endif