Skip to content

Commit

Permalink
Fix includes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamos82 committed Oct 22, 2024
1 parent fe32c20 commit 449bdfb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/include/kernel/scheduling/scheduler.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef _SCHEDULER_H_
#define _SCHEDULER_H_

#include <cpu.h>
#include <stdint.h>
#include <thread.h>
#include <task.h>
#include <cpu.h>

#define SCHEDULER_NUMBER_OF_TICKS 0x200
#define SCHEDULER_MAX_THREAD_NUMBER 0x10
Expand Down
1 change: 1 addition & 0 deletions src/include/kernel/scheduling/task.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _TASK_H
#define _TASK_H

#include <elf.h>
#include <stddef.h>
#include <stdbool.h>
#include <thread.h>
Expand Down
1 change: 0 additions & 1 deletion src/kernel/scheduling/scheduler.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#include <framebuffer.h>
#include <scheduler.h>
#include <string.h>
Expand Down
10 changes: 8 additions & 2 deletions src/kernel/scheduling/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 449bdfb

Please sign in to comment.