From 449bdfbb8949af032a77ffa8c81af49d635bdd2c Mon Sep 17 00:00:00 2001 From: Ivan Gualandri Date: Wed, 23 Oct 2024 00:14:38 +0100 Subject: [PATCH] Fix includes --- src/include/kernel/scheduling/scheduler.h | 2 +- src/include/kernel/scheduling/task.h | 1 + src/kernel/scheduling/scheduler.c | 1 - src/kernel/scheduling/task.c | 10 ++++++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/include/kernel/scheduling/scheduler.h b/src/include/kernel/scheduling/scheduler.h index 522c5c1c..b3a0d01c 100644 --- a/src/include/kernel/scheduling/scheduler.h +++ b/src/include/kernel/scheduling/scheduler.h @@ -1,10 +1,10 @@ #ifndef _SCHEDULER_H_ #define _SCHEDULER_H_ +#include #include #include #include -#include #define SCHEDULER_NUMBER_OF_TICKS 0x200 #define SCHEDULER_MAX_THREAD_NUMBER 0x10 diff --git a/src/include/kernel/scheduling/task.h b/src/include/kernel/scheduling/task.h index 9e546f67..ea0437bb 100644 --- a/src/include/kernel/scheduling/task.h +++ b/src/include/kernel/scheduling/task.h @@ -1,6 +1,7 @@ #ifndef _TASK_H #define _TASK_H +#include #include #include #include diff --git a/src/kernel/scheduling/scheduler.c b/src/kernel/scheduling/scheduler.c index 0c0a9563..5d50d9e8 100644 --- a/src/kernel/scheduling/scheduler.c +++ b/src/kernel/scheduling/scheduler.c @@ -1,4 +1,3 @@ - #include #include #include diff --git a/src/kernel/scheduling/task.c b/src/kernel/scheduling/task.c index de0785cf..18ac7492 100644 --- a/src/kernel/scheduling/task.c +++ b/src/kernel/scheduling/task.c @@ -45,11 +45,17 @@ task_t *create_task_from_elf(char *name, void *args, Elf64_Ehdr *elf_header){ pretty_logf(Verbose, " Number of PHDR entries: 0x%x", phdr_entries); pretty_logf(Verbose, " PHDR Entry Size: 0x%x", phdr_entsize ); pretty_logf(Verbose, " ELF Entry point: 0x%x", elf_header->e_entry); - /*for ( int i = 0; i < phdr_entries; i++) { + Elf64_Phdr *phdr_list = (Elf64_Phdr*) ((uintptr_t) elf_header + elf_header->e_phoff); + for ( int i = 0; i < phdr_entries; i++) { // I need first to compute the number of pages required for each phdr // clear all the memory not used // compute the entries for each page and insert them into the page tables. - }*/ + Elf64_Phdr phdr = phdr_list[i]; + pretty_logf(Verbose, "\t[%d]: Type: 0x%x, Flags: 0x%x - Vaddr: 0x%x - aligned: 0x%x ", i, phdr.p_type, phdr.p_flags, phdr.p_vaddr, align_value_to_page(phdr.p_vaddr)); + pretty_logf(Verbose, "\t\t - FileSz: 0x%x, Memsz: 0x%x ", phdr.p_filesz, phdr.p_memsz); + Elf64_Half mem_pages = (Elf64_Half) get_number_of_pages_from_size(phdr.p_memsz); + Elf64_Half filesz_pages = (Elf64_Half) get_number_of_pages_from_size(phdr.p_filesz); + } } // Create a new thread scheduler_add_task(new_task);