From 3431a7a70b8d06038660ad9ec566dfe0994520e5 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Duje=20Mihanovi=C4=87?= <duje.mihanovic@skole.hr>
Date: Sat, 18 Jun 2022 10:55:25 +0200
Subject: [PATCH] Fix various warnings

---
 Makefile                 | 2 +-
 boot/x86/stage3/loader.s | 5 ++---
 boot/x86/vbr-fat32.s     | 4 ++--
 include/arch/x86/tty.h   | 1 +
 kernel/kernel.c          | 3 +++
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index c823fc4..bff97e5 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ QEMU = qemu-system-i386 -monitor stdio
 
 export GIT_REV = $(shell git describe --long HEAD)
 
-CFLAGS = -g -Iinclude/arch/x86 -ffreestanding -DGIT_COMMIT=\"$(GIT_REV)\"
+CFLAGS = -g -fgnu89-inline -Iinclude/arch/x86 -ffreestanding -DGIT_COMMIT=\"$(GIT_REV)\"
 
 KERNEL_OBJ = kernel/entry.o kernel/arch/x86/tty/tty.o kernel/drivers/irq/i8259a.o kernel/arch/x86/irq/idt.o kernel/arch/x86/irq/sample_handler.o kernel/kernel.o
 
diff --git a/boot/x86/stage3/loader.s b/boot/x86/stage3/loader.s
index 0ca0ea6..747905d 100644
--- a/boot/x86/stage3/loader.s
+++ b/boot/x86/stage3/loader.s
@@ -167,9 +167,8 @@ bits 32
 	call load_paging_structs
 	call enable_paging
 
-	call 0xc0000000
-	hlt
-	jmp $-1
+	jmp 0x8:0xc0000000
+	nop
 
 kernel_name: db "KERNEL  BIN"
 begin: db "Nameless Bootloader revision ", GIT_REVISION, 0xd, 0xa, 0
diff --git a/boot/x86/vbr-fat32.s b/boot/x86/vbr-fat32.s
index 439157f..7af1156 100644
--- a/boot/x86/vbr-fat32.s
+++ b/boot/x86/vbr-fat32.s
@@ -72,8 +72,8 @@ real_start:
 	mov di, STAGE3_OFFSET
 	call read_cluster_chain ; read stage 3
 	mov dl, [BOOT_DRIVE]
-	call STAGE3_ADDRESS ; call stage 3
-	jmp .halt ; halt in case we return, which should never happen
+	jmp 0:STAGE3_ADDRESS ; call stage 3
+	nop
 
 .stage3_missing:
 	print stage3_missing
diff --git a/include/arch/x86/tty.h b/include/arch/x86/tty.h
index ce49da9..3ddd6b5 100644
--- a/include/arch/x86/tty.h
+++ b/include/arch/x86/tty.h
@@ -22,6 +22,7 @@
 
 extern void screen_clear(void);
 extern void kprint(const char *string, uint8_t color);
+extern void kprintc(const char character, uint8_t color);
 extern void kprintb(const uint8_t byte);
 extern void kprintw(const uint16_t word);
 extern void kprintd(const uint32_t dword);
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 0aa8fc2..9257a0e 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -5,6 +5,9 @@
 #include <stdint.h>
 #include <mm/paging.h>
 
+struct abort_frame;
+struct interrupt_frame;
+struct fault_frame;
 extern void double_fault(struct abort_frame *frame);
 extern void keyb_handler(struct interrupt_frame *frame);
 extern void pf_handler(struct fault_frame *frame);
-- 
2.39.5