From b11e529d2115691098e26d5fe95f015b757278d0 Mon Sep 17 00:00:00 2001 From: Akshaylal Date: Mon, 24 May 2021 19:48:56 +0530 Subject: [PATCH 1/3] Added -S flag to qemu so that qemu waits till gdb loads --- 18-interrupts/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/18-interrupts/Makefile b/18-interrupts/Makefile index 8a68aa0..6575ba6 100644 --- a/18-interrupts/Makefile +++ b/18-interrupts/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin -d guest_errors,int & + qemu-system-i386 -s -S -fda os-image.bin -d guest_errors,int & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards From b760753912489b06b6cb7ad38571175ad0af6421 Mon Sep 17 00:00:00 2001 From: Akshaylal Date: Mon, 24 May 2021 19:51:58 +0530 Subject: [PATCH 2/3] Added -S flag to qemu so that qemu waits till gdb loads --- 14-checkpoint/Makefile | 2 +- 15-video-ports/Makefile | 2 +- 16-video-driver/Makefile | 2 +- 17-video-scroll/Makefile | 2 +- 19-interrupts-irqs/Makefile | 2 +- 20-interrupts-timer/Makefile | 2 +- 21-shell/Makefile | 2 +- 22-malloc/Makefile | 2 +- 23-fixes/Makefile | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/14-checkpoint/Makefile b/14-checkpoint/Makefile index b611257..7d43bc3 100644 --- a/14-checkpoint/Makefile +++ b/14-checkpoint/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin & + qemu-system-i386 -s -S -fda os-image.bin & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/15-video-ports/Makefile b/15-video-ports/Makefile index b611257..7d43bc3 100644 --- a/15-video-ports/Makefile +++ b/15-video-ports/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin & + qemu-system-i386 -s -S -fda os-image.bin & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/16-video-driver/Makefile b/16-video-driver/Makefile index b611257..7d43bc3 100644 --- a/16-video-driver/Makefile +++ b/16-video-driver/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin & + qemu-system-i386 -s -S -fda os-image.bin & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/17-video-scroll/Makefile b/17-video-scroll/Makefile index b611257..7d43bc3 100644 --- a/17-video-scroll/Makefile +++ b/17-video-scroll/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin & + qemu-system-i386 -s -S -fda os-image.bin & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/19-interrupts-irqs/Makefile b/19-interrupts-irqs/Makefile index 8a68aa0..6575ba6 100644 --- a/19-interrupts-irqs/Makefile +++ b/19-interrupts-irqs/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin -d guest_errors,int & + qemu-system-i386 -s -S -fda os-image.bin -d guest_errors,int & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/20-interrupts-timer/Makefile b/20-interrupts-timer/Makefile index 4d6da94..c80e4ed 100644 --- a/20-interrupts-timer/Makefile +++ b/20-interrupts-timer/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin -d guest_errors,int & + qemu-system-i386 -s -S -fda os-image.bin -d guest_errors,int & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/21-shell/Makefile b/21-shell/Makefile index 1478294..8a89a50 100644 --- a/21-shell/Makefile +++ b/21-shell/Makefile @@ -28,7 +28,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin -d guest_errors,int & + qemu-system-i386 -s -S -fda os-image.bin -d guest_errors,int & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/22-malloc/Makefile b/22-malloc/Makefile index 1478294..8a89a50 100644 --- a/22-malloc/Makefile +++ b/22-malloc/Makefile @@ -28,7 +28,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin -d guest_errors,int & + qemu-system-i386 -s -S -fda os-image.bin -d guest_errors,int & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards diff --git a/23-fixes/Makefile b/23-fixes/Makefile index 65e577b..19ed088 100644 --- a/23-fixes/Makefile +++ b/23-fixes/Makefile @@ -27,7 +27,7 @@ run: os-image.bin # Open the connection to qemu and load our kernel-object file with symbols debug: os-image.bin kernel.elf - qemu-system-i386 -s -fda os-image.bin -d guest_errors,int & + qemu-system-i386 -s -S -fda os-image.bin -d guest_errors,int & ${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf" # Generic rules for wildcards From 68308271988a4c18d2dae526300ce67a4f4045cb Mon Sep 17 00:00:00 2001 From: Akshaylal Date: Mon, 24 May 2021 20:12:12 +0530 Subject: [PATCH 3/3] moved idt and idt_reg from idt.h to idt.c --- 18-interrupts/cpu/idt.c | 3 +++ 18-interrupts/cpu/idt.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/18-interrupts/cpu/idt.c b/18-interrupts/cpu/idt.c index 999d0c9..cdb7e99 100644 --- a/18-interrupts/cpu/idt.c +++ b/18-interrupts/cpu/idt.c @@ -1,6 +1,9 @@ #include "idt.h" #include "../kernel/util.h" +idt_gate_t idt[IDT_ENTRIES]; +idt_register_t idt_reg; + void set_idt_gate(int n, u32 handler) { idt[n].low_offset = low_16(handler); idt[n].sel = KERNEL_CS; diff --git a/18-interrupts/cpu/idt.h b/18-interrupts/cpu/idt.h index 27bfac5..b31f3e3 100644 --- a/18-interrupts/cpu/idt.h +++ b/18-interrupts/cpu/idt.h @@ -28,8 +28,6 @@ typedef struct { } __attribute__((packed)) idt_register_t; #define IDT_ENTRIES 256 -idt_gate_t idt[IDT_ENTRIES]; -idt_register_t idt_reg; /* Functions implemented in idt.c */