Started implementing debugging facilities

This commit is contained in:
2022-12-14 21:45:24 +00:00
parent 51e065faaf
commit 72bf6faadd
11 changed files with 124 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
QEMU := qemu-system-x86_64
QEMU_FLAGS := -m 64M -smp 4
ARCH_TEMP_FILES := $(BUILDDIR)/$(KERNEL_EXEC).elf32
@@ -16,8 +17,13 @@ run: $(BUILDDIR)/$(KERNEL_EXEC) $(BUILDDIR)/$(KERNEL_EXEC).elf32
@$(QEMU) -kernel $(BUILDDIR)/$(KERNEL_EXEC).elf32
debug: $(BUILDDIR)/$(KERNEL_EXEC) $(BUILDDIR)/$(KERNEL_EXEC).elf32
@echo " \033[1;93mBOOT\033[0m $<"
@echo " \033[1;93mDEBUG\033[0m $<"
@./tools/kernel-debug/debug_session.sh \
tools/kernel-debug/gdb_session_init \
tools/kernel-debug/lldb_session_init \
$(QEMU) \
-kernel $(BUILDDIR)/$(KERNEL_EXEC).elf32 -S -s \
-curses -serial file:socks.log $(QEMU_FLAGS)
@$(QEMU) \
-kernel $(BUILDDIR)/$(KERNEL_EXEC).elf32 -S -s \
-monitor stdio

View File

@@ -55,7 +55,7 @@ bootstrap_pdpt: # a single PDPT
bootstrap_pdir_buf: # a buffer of page directories. each pdir entry can be used to map 2MB of virtual memory.
.skip BOOTSTRAP_PDIR_SIZE
bootstrap_stack_bottom:
.skip 0x1000
.skip 0x4000
bootstrap_stack_top:
/*******
@@ -260,7 +260,8 @@ long_mode_switch:
_start:
mov $bootstrap_stack_top, %esp
push %ebx # store the pointer to the multiboot info block.
push %ebx # store the pointer to the multiboot info block as a 64-bit value.
push $0x00 # store the pointer to the multiboot info block as a 64-bit value.
# check if long mode is supported
movl $0x80000000, %eax # Extended-function 80000000h.

View File

@@ -1,5 +1,7 @@
.code64
.extern kernel_init # defined in core/main.c
.section .boot.rodata, "a", @progbits
/*******
@@ -63,7 +65,11 @@ print_kernel_identifier:
.type start_64, @function
start_64:
call vga_clear
pop %rax
call print_kernel_identifier
call kernel_init
cli
hlt