diff --git a/.gitignore b/.gitignore index 56c2602b..68cb16f7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /bin/ DragonOS.iso .idea/ +kernel/kernel *.o *.s \ No newline at end of file diff --git a/Makefile b/Makefile index cdaa5dd5..b00ac762 100644 --- a/Makefile +++ b/Makefile @@ -16,4 +16,7 @@ clean: echo "Clean in dir: $$subdir";\ cd $$subdir && make clean;\ cd .. ;\ - done \ No newline at end of file + done + +gdb: + gdb -n -x tools/.gdbinit \ No newline at end of file diff --git a/kernel/Makefile b/kernel/Makefile index 0babca39..0480116b 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -7,7 +7,7 @@ DIR_LIB=lib lib_patterns := *.a LIB_FILES := $(foreach DIR,$(DIR_LIB),$(addprefix $(DIR)/,$(lib_patterns))) -CFLAGS := -mcmodel=large -fno-builtin -m64 +CFLAGS := -mcmodel=large -fno-builtin -m64 -g # 控制操作系统使用的中断控制器 _INTR_8259A_ _INTR_APIC_ PIC := _INTR_APIC_ @@ -16,8 +16,8 @@ CFLAGS += -D $(PIC) ASFLAGS := --64 all: kernel - objcopy -I elf64-x86-64 -S -R ".comment" -R ".eh_frame" -O elf64-x86-64 kernel ../bin/kernel/kernel.elf - + objcopy -I elf64-x86-64 -O elf64-x86-64 -R ".comment" -R ".eh_frame" kernel ../bin/kernel/kernel.elf +# kernel: head.o entry.o main.o printk.o trap.o mm.o slab.o irq.o pic.o process.o syscall.o multiboot2.o cpu.o acpi.o ps2_keyboard.o ps2_mouse.o ata.o pci.o ahci.o ld -b elf64-x86-64 -z muldefs -o kernel head.o exception/entry.o main.o common/printk.o exception/trap.o exception/irq.o mm/mm.o mm/slab.o process/process.o syscall/syscall.o driver/multiboot2/multiboot2.o \ diff --git a/run.sh b/run.sh index 3842fd3a..e8b3d61f 100644 --- a/run.sh +++ b/run.sh @@ -92,8 +92,8 @@ if [ $flag_can_run -eq 1 ]; then if [ ${IA32_USE_QEMU} == 0 ]; then bochs -q -f ${bochsrc} -rc ./tools/bochsinit else - qemu-system-x86_64 -cdrom ${iso} -m 512M \ - -monitor telnet::2333,server,nowait -serial stdio -s -cpu IvyBridge --enable-kvm \ + qemu-system-x86_64 -cdrom ${iso} -m 512M -smp 2,cores=2,threads=1,sockets=1 \ + -monitor telnet::2333,server,nowait -serial stdio -s -S -cpu IvyBridge --enable-kvm \ -drive id=disk,file=bin/disk.img,if=none \ -device ahci,id=ahci \ -device ide-hd,drive=disk,bus=ahci.0 \ diff --git a/tools/.gdbinit b/tools/.gdbinit new file mode 100644 index 00000000..d086b355 --- /dev/null +++ b/tools/.gdbinit @@ -0,0 +1,4 @@ +target remote localhost:1234 +file bin/kernel/kernel.elf +set follow-fork-mode child +b Start_Kernel \ No newline at end of file