Skip to content

Commit

Permalink
start to use pretty_logf in various part of the kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamos82 committed Dec 5, 2023
1 parent 3232978 commit ac30ed4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/kernel/mem/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ void _initialize_bitmap ( unsigned long end_of_reserved_area ) {
//memory_map = memory_map_phys_addr;
uint64_t end_of_mapped_physical_memory = end_of_mapped_memory - _HIGHER_HALF_KERNEL_MEM_START;
if(memory_map_phys_addr > end_of_mapped_physical_memory) {
loglinef(Verbose, "(%s): The address 0x%x is above the initally mapped memory: 0x%x", __FUNCTION__, memory_map_phys_addr, end_of_mapped_physical_memory);
pretty_logf(Verbose, "The address 0x%x is above the initially mapped memory: 0x%x", memory_map_phys_addr, end_of_mapped_physical_memory);
//TODO: This need to be fixed map_phys_to_virt_addr can't be used here since it relies on the bitmap, and it is not initialized yet.
map_phys_to_virt_addr((void*)ALIGN_PHYSADDRESS(memory_map_phys_addr), (void*)(memory_map_phys_addr + _HIGHER_HALF_KERNEL_MEM_START), VMM_FLAGS_PRESENT | VMM_FLAGS_WRITE_ENABLE);
} else {
loglinef(Verbose, "(%s): The address 0x%x is not above the initially mapped memory: 0x%x", __FUNCTION__, memory_map_phys_addr, end_of_mapped_physical_memory);
pretty_logf(Verbose, "The address 0x%x is not above the initially mapped memory: 0x%x", memory_map_phys_addr, end_of_mapped_physical_memory);
}
memory_map = (uint64_t *) (memory_map_phys_addr + _HIGHER_HALF_KERNEL_MEM_START);

Expand Down
16 changes: 8 additions & 8 deletions src/kernel/mem/mmap.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <mmap.h>
#include <bitmap.h>
#include <logging.h>
#include <mmap.h>
#include <multiboot.h>
#include <pmm.h>
#include <stdint.h>
#include <multiboot.h>
#include <video.h>
#include <logging.h>

extern uint32_t used_frames;
extern struct multiboot_tag_basic_meminfo *tagmem;
Expand All @@ -30,11 +30,11 @@ void _mmap_parse(struct multiboot_tag_mmap *mmap_root){

#ifndef _TEST_
while(i<mmap_number_of_entries){
loglinef(Verbose, "(_mmap_parse): \t[%d] Address: 0x%x - Len: 0x%x Type: (%d) %s", i, mmap_entries[i].addr, mmap_entries[i].len, mmap_entries[i].type, (char *) mmap_types[mmap_entries[i].type]);
pretty_logf(Verbose, "\t[%d] Address: 0x%x - Len: 0x%x Type: (%d) %s", i, mmap_entries[i].addr, mmap_entries[i].len, mmap_entries[i].type, (char *) mmap_types[mmap_entries[i].type]);
total_entries++;
i++;
}
loglinef(Verbose, "(_mmap_parse): Total entries: %d", total_entries);
pretty_logf(Verbose, "Total entries: %d", total_entries);
#endif
}

Expand All @@ -46,7 +46,7 @@ void _mmap_setup(){
while(counter < mmap_number_of_entries){
if(mmap_entries[counter].addr < mem_limit &&
mmap_entries[counter].type > 1){
loglinef(Verbose, "(_mmap_setup): Found unusable entry at addr: %x", mmap_entries[counter].addr);
pretty_logf(Verbose, "Found unusable entry at addr: %x", mmap_entries[counter].addr);
pmm_reserve_area(mmap_entries[counter].addr, mmap_entries[counter].len);
count_physical_reserved++;
}
Expand Down Expand Up @@ -74,12 +74,12 @@ uintptr_t _mmap_determine_bitmap_region(uint64_t lower_limit, size_t bytes_neede

if (actual_available_space >= bytes_needed)
{
loglinef(Verbose, "(_mmap_determine_bitmap_region): Found space for bitmap at address: 0x%x", current_entry->addr + entry_offset);
pretty_logf(Verbose, "Found space for bitmap at address: 0x%x", current_entry->addr + entry_offset);
return current_entry->addr + entry_offset;
}
}

//BOOM! D:
logline(Verbose, "(_mmap_determine_bitmap_region): Could not find a space big enough to hold the pmm bitmap! This should not happen.");
pretty_log(Verbose, "Could not find a space big enough to hold the pmm bitmap! This should not happen.");
return 0;
}
2 changes: 1 addition & 1 deletion src/kernel/mem/pmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void *pmm_alloc_frame(){
void *pmm_alloc_area(size_t size) {
size_t requested_frames = get_number_of_pages_from_size(size);

loglinef(Verbose, "(%s): requested_frames: %x\n", __FUNCTION__, requested_frames);
pretty_logf(Verbose, "requested_frames: %x\n", requested_frames);
spinlock_acquire(&memory_spinlock);
uint64_t frames = _bitmap_request_frames(requested_frames);

Expand Down

0 comments on commit ac30ed4

Please sign in to comment.