Skip to content

Commit

Permalink
Remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamos82 committed Feb 11, 2025
1 parent 4cd95d5 commit 7b9c1b1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/kernel/loaders/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void load_elf(uintptr_t elf_start, uint64_t size) {
Elf64_Phdr *cur_phdr = read_phdr(elf_header, 0);
pretty_logf(Verbose, "\t[cur_phdr]: Type: 0x%x, Flags: 0x%x - Vaddr: 0x%x - aligned: 0x%x - p_align: 0x%x - p_memsz: 0%x - p_offset: 0x%x", cur_phdr->p_type, cur_phdr->p_flags, cur_phdr->p_vaddr, align_value_to_page(cur_phdr->p_vaddr), cur_phdr->p_align, cur_phdr->p_memsz, cur_phdr->p_offset);
cur_phdr = read_phdr(elf_header, 1);
//pretty_logf(Verbose, "\t[cur_phdr]: Type: 0x%x, Flags: 0x%x - Vaddr: 0x%x - aligned: 0x%x - p_align: 0x%x - p_memsz: 0%x - p_offset: 0x%x", cur_phdr->p_type, cur_phdr->p_flags, cur_phdr->p_vaddr, align_value_to_page(cur_phdr->p_vaddr), cur_phdr->p_align, cur_phdr->p_memsz, cur_phdr->p_offset);
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/kernel/mem/hh_direct_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ void hhdm_map_physical_memory() {

size_t current_pml4_entry = PML4_ENTRY((uint64_t) higherHalfDirectMapBase);

/*if (!(p4_table[current_pml4_entry] & 0b1) ) {
pretty_log(Fatal, "This shouldn't happen");
}*/

uint64_t upper_address_to_map = (mmap_entries[_mmap_last_available_item].addr + mmap_entries[_mmap_last_available_item].len);
pretty_logf(Verbose, "Last available item: %d - Last address to map: 0x%x", _mmap_last_available_item, upper_address_to_map);

Expand Down
2 changes: 0 additions & 2 deletions src/kernel/mem/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,9 @@ bool _mmap_is_address_in_available_space(uint64_t address, uint64_t upper_limit)
//pretty_logf(Verbose, "entry type: 0x%x - %d - 0x%x - address: 0x%x", current_entry->type, i, current_entry->addr, address);
if(current_entry->addr + current_entry->len > address + upper_limit) {
if(current_entry->type == _MMAP_AVAILABLE) {
//pretty_logf(Verbose, "Entry 0x%x is in an available space (with size: 0x%x", address, upper_limit );
// The address is in an available area, but we need to check if it is not overwriting something important.
bool multiboot_address =_is_address_in_multiboot(address);
if(multiboot_address != 0) {
//pretty_log(Verbose, " This address is reserved by multiboot");
return false;
}
return true;
Expand Down
18 changes: 0 additions & 18 deletions src/kernel/mem/pmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,14 @@ void *pmm_alloc_frame(){
void *pmm_prepare_new_pagetable() {
if ( !pmm_initialized) {
while((!_mmap_is_address_in_available_space(anon_physical_memory_loc, PAGE_DIR_SIZE)) && anon_physical_memory_loc < memory_size_in_bytes) {
//pretty_logf(Verbose, " Current address: 0x%x - phys: 0x%x not available trying next 0x%x", anon_memory_loc, anon_physical_memory_loc, memory_size_in_bytes);
anon_memory_loc += PAGE_DIR_SIZE;
anon_physical_memory_loc += PAGE_DIR_SIZE;
}
//pretty_logf(Verbose, "Preparing new page table at: 0x%x - phys: 0x%x", anon_memory_loc, anon_physical_memory_loc);
anon_memory_loc += PAGE_DIR_SIZE;
anon_physical_memory_loc += PAGE_DIR_SIZE;
return (void *) (anon_physical_memory_loc - PAGE_DIR_SIZE);
/*if( _mmap_is_address_in_available_space(anon_physical_memory_loc, PAGE_DIR_SIZE) ) {
// This space should be potentially safe
anon_memory_loc += PAGE_DIR_SIZE;
anon_physical_memory_loc += PAGE_DIR_SIZE;
return (void *) (anon_physical_memory_loc - PAGE_DIR_SIZE);
} else {
// i suppose this shouldn't happen
pretty_log(Fatal, " New location is not in available area, this most likely shouldn't happen");
}*/
/*} else {
// This is the tricky part, i need to map new memory. still in the anon area
// I need to check that it is not any of the reserved memory locations (i.e. faramebuffer)
// If yes it should probably panic
}*/
// Get the first available address and check if is in mapped area?
//return NULL;
}
//pretty_log(Verbose, "The pmm is initialized, using pmm_alloc_frame");
return (void *) pmm_alloc_frame();
}

Expand Down
1 change: 0 additions & 1 deletion src/utils/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ bool _is_address_in_multiboot(uint64_t address) {
if (tag->type == MULTIBOOT_TAG_TYPE_MODULE) {
struct multiboot_tag_module *loaded_module = (struct multiboot_tag_module *) tag;
if (address >= loaded_module->mod_start && address <= loaded_module->mod_end) {
//pretty_logf(Verbose, "This address: 0x%x is reserved by a multiboot module", address );
return true;
}
}
Expand Down

0 comments on commit 7b9c1b1

Please sign in to comment.