misc: Reuse buffers that hold the paths of module files for protocols
This commit is contained in:
parent
a8a079425a
commit
ed590257af
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
BIN
stage2.map
BIN
stage2.map
Binary file not shown.
@ -129,15 +129,14 @@ void linux_load(char *config, char *cmdline) {
|
||||
|
||||
size_t modules_mem_base = INITRD_LOAD_ADDR;
|
||||
for (size_t i = 0; ; i++) {
|
||||
char module_path[64];
|
||||
if (!config_get_value(config, module_path, i, 64, "MODULE_PATH"))
|
||||
if (!config_get_value(config, buf, i, 128, "MODULE_PATH"))
|
||||
break;
|
||||
|
||||
struct file_handle module;
|
||||
if (!uri_open(&module, module_path))
|
||||
panic("Could not open `%s`", module_path);
|
||||
if (!uri_open(&module, buf))
|
||||
panic("Could not open `%s`", buf);
|
||||
|
||||
print("Loading module `%s`...\n", module_path);
|
||||
print("Loading module `%s`...\n", buf);
|
||||
|
||||
memmap_alloc_range(modules_mem_base, module.size, 0);
|
||||
fread(&module, (void *)modules_mem_base, 0, module.size);
|
||||
|
@ -116,8 +116,7 @@ void stivale_load(char *config, char *cmdline) {
|
||||
stivale_struct.module_count = 0;
|
||||
uint64_t *prev_mod_ptr = &stivale_struct.modules;
|
||||
for (int i = 0; ; i++) {
|
||||
char module_file[64];
|
||||
if (!config_get_value(config, module_file, i, 64, "MODULE_PATH"))
|
||||
if (!config_get_value(config, buf, i, 128, "MODULE_PATH"))
|
||||
break;
|
||||
|
||||
stivale_struct.module_count++;
|
||||
@ -129,14 +128,14 @@ void stivale_load(char *config, char *cmdline) {
|
||||
}
|
||||
|
||||
struct file_handle f;
|
||||
if (!uri_open(&f, module_file))
|
||||
panic("Requested module with path \"%s\" not found!", module_file);
|
||||
if (!uri_open(&f, buf))
|
||||
panic("Requested module with path \"%s\" not found!", buf);
|
||||
|
||||
void *module_addr = (void *)(((uint32_t)top_used_addr & 0xfff) ?
|
||||
((uint32_t)top_used_addr & ~((uint32_t)0xfff)) + 0x1000 :
|
||||
(uint32_t)top_used_addr);
|
||||
|
||||
print("stivale: Loading module `%s`...\n", module_file);
|
||||
print("stivale: Loading module `%s`...\n", buf);
|
||||
|
||||
memmap_alloc_range((size_t)module_addr, f.size, 10);
|
||||
fread(&f, module_addr, 0, f.size);
|
||||
@ -151,7 +150,7 @@ void stivale_load(char *config, char *cmdline) {
|
||||
prev_mod_ptr = &m->next;
|
||||
|
||||
print("stivale: Requested module %u:\n", i);
|
||||
print(" Path: %s\n", module_file);
|
||||
print(" Path: %s\n", buf);
|
||||
print(" String: %s\n", m->string);
|
||||
print(" Begin: %X\n", m->begin);
|
||||
print(" End: %X\n", m->end);
|
||||
|
@ -170,8 +170,7 @@ void stivale2_load(char *config, char *cmdline) {
|
||||
tag->module_count = module_count;
|
||||
|
||||
for (int i = 0; ; i++) {
|
||||
char module_file[64];
|
||||
if (!config_get_value(config, module_file, i, 64, "MODULE_PATH"))
|
||||
if (!config_get_value(config, buf, i, 128, "MODULE_PATH"))
|
||||
break;
|
||||
|
||||
struct stivale2_module *m = &tag->modules[i];
|
||||
@ -181,14 +180,14 @@ void stivale2_load(char *config, char *cmdline) {
|
||||
}
|
||||
|
||||
struct file_handle f;
|
||||
if (!uri_open(&f, module_file))
|
||||
panic("Requested module with path \"%s\" not found!", module_file);
|
||||
if (!uri_open(&f, buf))
|
||||
panic("Requested module with path \"%s\" not found!", buf);
|
||||
|
||||
void *module_addr = (void *)(((uint32_t)top_used_addr & 0xfff) ?
|
||||
((uint32_t)top_used_addr & ~((uint32_t)0xfff)) + 0x1000 :
|
||||
(uint32_t)top_used_addr);
|
||||
|
||||
print("stivale2: Loading module `%s`...\n", module_file);
|
||||
print("stivale2: Loading module `%s`...\n", buf);
|
||||
|
||||
memmap_alloc_range((size_t)module_addr, f.size, 0x1001);
|
||||
fread(&f, module_addr, 0, f.size);
|
||||
@ -199,7 +198,7 @@ void stivale2_load(char *config, char *cmdline) {
|
||||
top_used_addr = (uint64_t)(size_t)m->end;
|
||||
|
||||
print("stivale2: Requested module %u:\n", i);
|
||||
print(" Path: %s\n", module_file);
|
||||
print(" Path: %s\n", buf);
|
||||
print(" String: %s\n", m->string);
|
||||
print(" Begin: %X\n", m->begin);
|
||||
print(" End: %X\n", m->end);
|
||||
|
Loading…
Reference in New Issue
Block a user