Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CONFIG_DEBUG option #251

Merged
merged 2 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .config
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
CONFIG_EARLY_VIRT_MEM=8
CONFIG_LIBPFM=n
CONFIG_ACPICA=y
CONFIG_DEBUG=n
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ endif

COMMON_FLAGS := $(COMMON_INCLUDES) -pipe -MP -MMD -m64 -D__x86_64__ -D__KTF__ -DEARLY_VIRT_MEM=$(CONFIG_EARLY_VIRT_MEM)

ifeq ($(CONFIG_DEBUG),y)
COMMON_FLAGS += -DKTF_DEBUG
endif

ifeq ($(CONFIG_LIBPFM),y)
COMMON_FLAGS += -DKTF_PMU
endif
Expand Down
4 changes: 4 additions & 0 deletions common/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
#include <mm/regions.h>
#include <string.h>

#ifdef KTF_DEBUG
bool opt_debug = true;
#else
bool opt_debug = false;
#endif
bool_cmd("debug", opt_debug);

bool opt_keyboard = true;
Expand Down
11 changes: 5 additions & 6 deletions common/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ static void __noreturn echo_loop(void) {
}

void kernel_main(void) {
printk("\nKTF - Kernel Test Framework!\n\n");

if (kernel_cmdline)
printk("Command line: %s\n", kernel_cmdline);
printk("\nKTF - Kernel Test Framework!\n");

zap_boot_mappings();
display_memory_map();
display_multiboot_mmap();
if (opt_debug) {
display_memory_map();
display_multiboot_mmap();
}

test_main();

Expand Down
2 changes: 2 additions & 0 deletions common/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic,

/* Parse commandline parameters */
cmdline_parse(kernel_cmdline);
if (!string_empty(kernel_cmdline))
printk("Command line: %s\n", kernel_cmdline);

/* Initialize console early */
init_console();
Expand Down
2 changes: 2 additions & 0 deletions drivers/acpi/acpica/acktf.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@

/* Kernel specific ACPICA configuration */

#ifdef KTF_DEBUG
#define ACPI_DEBUG_OUTPUT
#endif

#include <spinlock.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static keyboard_state_t keyboard_state;

void init_keyboard(uint8_t dst_cpus) {
if (!boot_flags.i8042) {
printk("No i8042 microcontroller detected\n");
dprintk("No i8042 microcontroller detected\n");
return;
}

Expand Down