Add missing comments. Unify setup of debugging in memory files.

This commit is contained in:
Enrico Fraccaroli
2023-01-19 09:55:24 -05:00
parent 6e48298534
commit b5eccd40cf
9 changed files with 51 additions and 60 deletions
+1 -4
View File
@@ -116,7 +116,4 @@ src/initscp/initfscp
files/bin/**
# ISO creation files.
iso/boot/*.bin
# Visual Studio Code
.vscode
iso/boot/*.bin
+6
View File
@@ -0,0 +1,6 @@
{
"files.associations": {
"*.h": "c",
"*.c": "c"
},
}
+1 -2
View File
@@ -1,4 +1,3 @@
/// MentOS, The Mentoring Operating system project
/// @file boot.c
/// @brief Bootloader.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
@@ -42,7 +41,7 @@ static page_directory_t boot_pgdir;
/// @brief Boot page tables.
static page_table_t boot_pgtables[1024];
/// @brief Use this to write to I/O ports to send bytes to devices.
/// @brief Use this to write to I/O ports to send bytes to devices.
/// @param port The output port.
/// @param data The data to write.
static inline void __outportb(uint16_t port, uint8_t data)
+8 -10
View File
@@ -3,18 +3,16 @@
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
// Include the kernel log levels.
#include "sys/kernel_levels.h"
/// Change the header.
#define __DEBUG_HEADER__ "[BUDDY ]"
/// Set the log level.
#define __DEBUG_LEVEL__ LOGLEVEL_DEBUG
// Setup the logging for this file (do this before any other include).
#include "sys/kernel_levels.h" // Include kernel log levels.
#define __DEBUG_HEADER__ "[BUDDY ]" ///< Change header.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level.
#include "io/debug.h" // Include debugging functions.
#include "mem/buddysystem.h"
#include "mem/paging.h"
#include "assert.h"
#include "io/debug.h"
#include "system/panic.h"
#include "assert.h"
/// @brief Cache level low limit after which allocation starts.
#define LOW_WATERMARK_LEVEL 10
@@ -114,8 +112,8 @@ static inline bb_free_area_t *__get_area_of_order(bb_instance_t *instance, unsig
/// @brief Checks if the page is FREE and has the same order.
/// @param page the page to check.
/// @param order the oder to check.
/// @return true if the page is buddy, false otherwise.
static inline bool_t __page_is_buddy(bb_page_t *page, unsigned int order)
/// @return 1 if the page is buddy, 0 otherwise.
static inline int __page_is_buddy(bb_page_t *page, unsigned int order)
{
return __bb_test_flag(page, FREE_PAGE) && (page->order == order);
}
+11 -13
View File
@@ -3,20 +3,18 @@
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
// Include the kernel log levels.
#include "sys/kernel_levels.h"
/// Change the header.
#define __DEBUG_HEADER__ "[KHEAP ]"
/// Set the log level.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE
// Setup the logging for this file (do this before any other include).
#include "sys/kernel_levels.h" // Include kernel log levels.
#define __DEBUG_HEADER__ "[KHEAP ]" ///< Change header.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level.
#include "io/debug.h" // Include debugging functions.
#include "mem/kheap.h"
#include "math.h"
#include "io/debug.h"
#include "string.h"
#include "mem/paging.h"
#include "assert.h"
#include "klib/list_head.h"
#include "string.h"
#include "assert.h"
#include "math.h"
/// Overhead given by the block_t itself.
#define OVERHEAD sizeof(block_t)
@@ -785,8 +783,8 @@ void *sys_brk(void *addr)
task_struct *current_task = scheduler_get_current_process();
mm_struct_t *current_mm = current_task->mm;
current_mm->start_brk = create_vm_area(current_mm,
0x40000000 /*FIXME! stabilize this*/,
UHEAP_INITIAL_SIZE, MM_RW | MM_PRESENT | MM_USER | MM_UPDADDR, GFP_HIGHUSER);
0x40000000 /*FIXME! stabilize this*/,
UHEAP_INITIAL_SIZE, MM_RW | MM_PRESENT | MM_USER | MM_UPDADDR, GFP_HIGHUSER);
current_mm->brk = current_mm->start_brk;
// Reserved space for:
// 1) First memory block.
@@ -856,5 +854,5 @@ void kheap_dump()
pr_debug("(%p)->", it);
}
pr_debug("\n\n");
(void) total, (void) total_overhead;
(void)total, (void)total_overhead;
}
+7 -9
View File
@@ -3,22 +3,20 @@
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
// Include the kernel log levels.
#include "sys/kernel_levels.h"
/// Change the header.
#define __DEBUG_HEADER__ "[PAGING]"
/// Set the log level.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE
// Setup the logging for this file (do this before any other include).
#include "sys/kernel_levels.h" // Include kernel log levels.
#define __DEBUG_HEADER__ "[PAGING]" ///< Change header.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level.
#include "io/debug.h" // Include debugging functions.
#include "mem/paging.h"
#include "descriptor_tables/isr.h"
#include "mem/vmem_map.h"
#include "mem/zone_allocator.h"
#include "mem/kheap.h"
#include "io/debug.h"
#include "descriptor_tables/isr.h"
#include "system/panic.h"
#include "assert.h"
#include "string.h"
#include "system/panic.h"
/// Cache for storing mm_struct.
kmem_cache_t *mm_cache;
+6 -8
View File
@@ -3,18 +3,16 @@
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
// Include the kernel log levels.
#include "sys/kernel_levels.h"
/// Change the header.
#define __DEBUG_HEADER__ "[SLAB ]"
/// Set the log level.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE
// Setup the logging for this file (do this before any other include).
#include "sys/kernel_levels.h" // Include kernel log levels.
#define __DEBUG_HEADER__ "[SLAB ]" ///< Change header.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level.
#include "io/debug.h" // Include debugging functions.
#include "mem/zone_allocator.h"
#include "mem/paging.h"
#include "assert.h"
#include "io/debug.h"
#include "mem/slab.h"
#include "assert.h"
/// @brief Use it to manage cached pages.
typedef struct kmem_obj {
+6 -7
View File
@@ -3,16 +3,15 @@
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
// Include the kernel log levels.
#include "sys/kernel_levels.h"
/// Change the header.
#define __DEBUG_HEADER__ "[VMEM ]"
/// Set the log level.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE
// Setup the logging for this file (do this before any other include).
#include "sys/kernel_levels.h" // Include kernel log levels.
#define __DEBUG_HEADER__ "[VMEM ]" ///< Change header.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level.
#include "io/debug.h" // Include debugging functions.
#include "mem/vmem_map.h"
#include "string.h"
#include "system/panic.h"
#include "string.h"
/// Virtual addresses manager.
static virt_map_page_manager_t virt_default_mapping;
+5 -7
View File
@@ -3,12 +3,11 @@
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
// Include the kernel log levels.
#include "sys/kernel_levels.h"
/// Change the header.
#define __DEBUG_HEADER__ "[PMM ]"
/// Set the log level.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE
// Setup the logging for this file (do this before any other include).
#include "sys/kernel_levels.h" // Include kernel log levels.
#define __DEBUG_HEADER__ "[PMM ]" ///< Change header.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE ///< Set log level.
#include "io/debug.h" // Include debugging functions.
#include "mem/zone_allocator.h"
#include "mem/buddysystem.h"
@@ -17,7 +16,6 @@
#include "assert.h"
#include "mem/paging.h"
#include "string.h"
#include "io/debug.h"
/// TODO: Comment.
#define MIN_PAGE_ALIGN(addr) ((addr) & (~(PAGE_SIZE - 1)))