refactor (kernel): removed unused and unfinished modules system. The new drivers system performs the same task

This commit is contained in:
antifallobst 2023-06-06 22:05:14 +02:00
parent b00b57b180
commit 8c273f4dc7
5 changed files with 0 additions and 107 deletions

View File

@ -1,32 +0,0 @@
// This file is part of noxos and licensed under the MIT open source license
#ifndef NOXOS_MODULES_LOADER_H
#define NOXOS_MODULES_LOADER_H
#include <modules/module.h>
#include <utils/bitmap.h>
#define MODULE_MANAGER_CHUNK_SIZE 16
typedef struct module_manager_chunk_T module_manager_chunk_T;
struct module_manager_chunk_T {
module_T* modules [MODULE_MANAGER_CHUNK_SIZE];
bitmap_T modules_bitmap;
uint32_t num_modules;
module_manager_chunk_T* prev;
module_manager_chunk_T* next;
};
typedef struct {
module_manager_chunk_T* chunks;
} module_manager_T;
void module_manager_init ();
module_manager_chunk_T* module_manager_chunk_alloc (module_manager_chunk_T* prev);
module_T* module_load (string_t name, string_t path);
void module_unload (module_T* module);
#endif //NOXOS_MODULES_LOADER_H

View File

@ -1,16 +0,0 @@
// This file is part of noxos and licensed under the MIT open source license
#ifndef NOXOS_MODULE_H
#define NOXOS_MODULE_H
#include <utils/stdtypes.h>
#include <utils/string.h>
#include <drivers/builtin/elf/elf.h>
typedef struct {
string_t name;
string_t path;
elf_executable_T* executable;
} module_T;
#endif //NOXOS_MODULE_H

View File

@ -21,7 +21,6 @@
#include "drivers/builtin/tty.h"
#include "drivers/driver.h"
#include "proc/scheduler.h"
#include "modules/loader.h"
void limine_terminal_print(boot_info_T* boot_info, string_t string) {
boot_info->terminal->write(boot_info->terminal->terminals[0], string, string_length(string));
@ -55,8 +54,6 @@ void kernel_init(boot_info_T* boot_info) {
acpi_init(boot_info);
module_manager_init();
drive_manager_init();
pci_init();

View File

@ -1,53 +0,0 @@
// This file is part of noxos and licensed under the MIT open source license
#include <modules/loader.h>
#include <utils/memory.h>
#include <utils/logger.h>
#include <drivers/builtin/fs/vfs.h>
module_manager_T g_module_manager;
void module_manager_init() {
g_module_manager.chunks = module_manager_chunk_alloc(NULL);
}
module_manager_chunk_T* module_manager_chunk_alloc(module_manager_chunk_T* prev) {
module_manager_chunk_T* chunk = memory_allocate(sizeof(module_manager_chunk_T));
chunk->modules_bitmap = bitmap_init(MODULE_MANAGER_CHUNK_SIZE);
chunk->num_modules = 0;
chunk->next = NULL;
chunk->prev = prev;
if (prev != NULL) {
prev->next = chunk;
}
return chunk;
}
module_T* module_load(string_t name, string_t path) {
module_T* module = memory_allocate(sizeof(module_T));
module->name = name;
module->path = path;
vfs_node_T* node = vfs_resolve_path(&g_root_fs, path);
if (node == NULL || node->type != VFS_NODE_FILE) {
memory_free(module);
log(LOG_ERROR, "failed to load module '%s' from '%s' (file not found)", name, path);
return NULL;
}
void* buffer = memory_allocate(node->size);
vfs_file_read(node, 0, node->size, buffer);
module->executable = elf_executable_create(buffer);
log(LOG_INFO, "loaded module '%s' from '%s'", name, path);
return module;
}
void module_unload(module_T* module) {
}

View File

@ -1,3 +0,0 @@
// This file is part of noxos and licensed under the MIT open source license
#include <modules/module.h>