should be right?

This commit is contained in:
2026-05-06 11:26:33 +02:00
parent 935564c4b2
commit 63e9a761a3
8 changed files with 166 additions and 64 deletions
+4
View File
@@ -63,4 +63,8 @@
/* ssp */
#define STACK_CHK_GUARD 0x7ABA5C007ABA5C00
/* fs */
#define FDT_MAX 8 // Maximum amount of file descriptors per process
#endif
+2
View File
@@ -11,5 +11,7 @@
int initfs_init(struct limine_file* tar_file);
int tar_lookup(unsigned char* archive, char* filename, char** out);
int tar_read(char* filename, char** buf);
int tar_exists(const char* filename);
#endif
+6 -3
View File
@@ -8,10 +8,13 @@
#define KERNEL_H
#include "limine.h"
enum ErrorCodes {
ENOMEM,
EIO,
ENOENT
ENOMEM, // No memory
EIO, // Input/output error
ENOENT, // No entry
EBADFD, // Bad file descriptor
EMFILE // Too many open files
};
#define CLEAR_INTERRUPTS __asm__ volatile("cli")
+13 -1
View File
@@ -11,6 +11,7 @@
#include <config.h>
#include <stdint.h>
#include <limine.h>
#include <stdbool.h>
typedef enum {
READY,
@@ -18,6 +19,13 @@ typedef enum {
DEAD
} status_t;
struct fd {
int fd;
char filename[PROCESS_NAME_MAX]; // File opened
uint64_t cursor; // Cursor position in file
bool open;
};
struct process {
size_t pid;
char name[PROCESS_NAME_MAX];
@@ -26,6 +34,10 @@ struct process {
struct cpu_status* context;
void* root_page_table; // Process PML4 (should contain kernel PML4 in higher half [256-511]
void* kernel_stack; // Used for interrupts (syscall: int 0x80), defines the TSS RSP0
struct fd fdt[FDT_MAX]; // File Descriptor Table
size_t next_free_fd;
struct process* next;
};
@@ -38,7 +50,7 @@ void process_exit(void);
void process_display_list(struct process* processes_list);
void process_create_user(struct limine_file* file, char* name);
void process_create_user_raw(char* file, int size, char* name);
#endif