summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2021-09-21 18:37:01 +0200
committerdzwdz2021-09-21 18:37:01 +0200
commitd9ec06192725bb6bf023120e99cbe8da33756628 (patch)
tree847ff37279af11932891e70f7f14f9071182940f /src
parentdc7a432b877222253fe02a332fba69d077eea8fe (diff)
start using sparse's `-Wdecl`
Diffstat (limited to 'src')
-rw-r--r--src/kernel/arch/i386/boot.c1
-rw-r--r--src/kernel/arch/i386/boot.h4
-rw-r--r--src/kernel/arch/i386/interrupts/isr.h2
-rw-r--r--src/kernel/arch/i386/sysenter.c5
-rw-r--r--src/kernel/arch/i386/sysenter.h8
-rw-r--r--src/kernel/arch/i386/tty/serial.c4
-rw-r--r--src/kernel/proc.c4
-rw-r--r--src/kernel/tests/util.c1
-rw-r--r--src/kernel/tests/vfs.c1
9 files changed, 23 insertions, 7 deletions
diff --git a/src/kernel/arch/i386/boot.c b/src/kernel/arch/i386/boot.c
index 94eefd6..bd2a00b 100644
--- a/src/kernel/arch/i386/boot.c
+++ b/src/kernel/arch/i386/boot.c
@@ -1,4 +1,5 @@
#include <kernel/arch/generic.h>
+#include <kernel/arch/i386/boot.h>
#include <kernel/arch/i386/gdt.h>
#include <kernel/arch/i386/interrupts/idt.h>
#include <kernel/arch/i386/multiboot.h>
diff --git a/src/kernel/arch/i386/boot.h b/src/kernel/arch/i386/boot.h
new file mode 100644
index 0000000..544f02d
--- /dev/null
+++ b/src/kernel/arch/i386/boot.h
@@ -0,0 +1,4 @@
+#pragma once
+#include <kernel/arch/i386/multiboot.h>
+
+void kmain_early(struct multiboot_info *multiboot);
diff --git a/src/kernel/arch/i386/interrupts/isr.h b/src/kernel/arch/i386/interrupts/isr.h
index 09d4328..3189538 100644
--- a/src/kernel/arch/i386/interrupts/isr.h
+++ b/src/kernel/arch/i386/interrupts/isr.h
@@ -3,3 +3,5 @@
extern bool isr_test_interrupt_called; // used in the self-test in idt.c
extern const char _isr_stubs;
+
+void isr_stage3(int interrupt);
diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c
index a0d4f73..cda4f15 100644
--- a/src/kernel/arch/i386/sysenter.c
+++ b/src/kernel/arch/i386/sysenter.c
@@ -1,10 +1,9 @@
#include <kernel/arch/generic.h>
+#include <kernel/arch/i386/sysenter.h>
#include <kernel/proc.h>
#include <shared/syscalls.h>
-struct registers _sysexit_regs; // a hack
-
-extern void _sysexit_real(void);
+struct registers _sysexit_regs;
void sysexit(struct registers regs) {
_sysexit_regs = regs;
diff --git a/src/kernel/arch/i386/sysenter.h b/src/kernel/arch/i386/sysenter.h
new file mode 100644
index 0000000..b88c186
--- /dev/null
+++ b/src/kernel/arch/i386/sysenter.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// sysenter.c
+extern struct registers _sysexit_regs;
+_Noreturn void sysenter_stage2(void);
+
+// sysenter.s
+void _sysexit_real(void);
diff --git a/src/kernel/arch/i386/tty/serial.c b/src/kernel/arch/i386/tty/serial.c
index a259750..b3f1d9d 100644
--- a/src/kernel/arch/i386/tty/serial.c
+++ b/src/kernel/arch/i386/tty/serial.c
@@ -2,7 +2,7 @@
#include <kernel/arch/i386/port_io.h>
#include <stdint.h>
-const int COM1 = 0x3f8;
+static const int COM1 = 0x3f8;
void serial_init(void) {
// see https://www.sci.muni.cz/docs/pc/serport.txt
@@ -23,7 +23,7 @@ void serial_init(void) {
* if i start using serial for input, TODO selftest */
}
-void serial_putchar(char c) {
+static void serial_putchar(char c) {
while ((port_inb(COM1 + 5) & 0x20) == 0); // wait for THRE
port_outb(COM1, c);
}
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 13ce759..b9f96c8 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -9,7 +9,7 @@
struct process *process_first;
struct process *process_current;
-uint32_t next_pid = 0;
+static uint32_t next_pid = 0;
struct process *process_seed(void) {
struct process *proc = kmalloc(sizeof *proc);
@@ -72,7 +72,7 @@ _Noreturn void process_switch_any(void) {
}
// TODO there's no check for going past the stack - VULN
-struct process *_process_find_recursive(
+static struct process *_process_find_recursive(
enum process_state target, struct process *iter) {
struct process *in;
while (iter) {
diff --git a/src/kernel/tests/util.c b/src/kernel/tests/util.c
index b5fa4dd..3efbee8 100644
--- a/src/kernel/tests/util.c
+++ b/src/kernel/tests/util.c
@@ -1,4 +1,5 @@
#include <kernel/tests/base.h>
+#include <kernel/tests/tests.h>
#include <kernel/util.h>
TEST(memcmp) {
diff --git a/src/kernel/tests/vfs.c b/src/kernel/tests/vfs.c
index 3f0685e..751192b 100644
--- a/src/kernel/tests/vfs.c
+++ b/src/kernel/tests/vfs.c
@@ -1,5 +1,6 @@
#include <kernel/mem/alloc.h>
#include <kernel/tests/base.h>
+#include <kernel/tests/tests.h>
#include <kernel/util.h>
#include <kernel/vfs/mount.h>
#include <kernel/vfs/path.h>