summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/init/main.c2
-rw-r--r--src/init/syscalls.c2
-rw-r--r--src/kernel/arch/generic.h4
-rw-r--r--src/kernel/arch/i386/gdt.h2
-rw-r--r--src/kernel/arch/i386/gdt/gdt.c10
-rw-r--r--src/kernel/arch/i386/interrupts/idt.c14
-rw-r--r--src/kernel/arch/i386/interrupts/idt.h2
-rw-r--r--src/kernel/arch/i386/pagedir.c2
-rw-r--r--src/kernel/arch/i386/sysenter.c4
-rw-r--r--src/kernel/arch/i386/sysenter.h2
-rw-r--r--src/kernel/arch/i386/tty/serial.c2
-rw-r--r--src/kernel/arch/i386/tty/serial.h2
-rw-r--r--src/kernel/arch/i386/tty/tty.c2
-rw-r--r--src/kernel/arch/i386/tty/vga.c4
-rw-r--r--src/kernel/arch/i386/tty/vga.h2
-rw-r--r--src/kernel/arch/log.h2
-rw-r--r--src/kernel/proc.c4
-rw-r--r--src/kernel/proc.h4
-rw-r--r--src/kernel/syscalls.c2
-rw-r--r--src/kernel/tests/base.h2
-rw-r--r--src/kernel/tests/main.c2
-rw-r--r--src/kernel/tests/tests.h6
-rw-r--r--src/kernel/tests/util.c2
-rw-r--r--src/kernel/tests/vfs.c2
-rw-r--r--src/shared/syscalls.h2
-rw-r--r--todo.txt1
27 files changed, 43 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index d9078f0..4ecac81 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ PATH := $(shell pwd)/toolchain/bin/:$(PATH)
AS = i686-elf-as
CC = i686-elf-gcc
-CFLAGS = -std=gnu99 -ffreestanding -O2 -Wall -Wextra
+CFLAGS = -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wold-style-declaration -Wold-style-definition
CFLAGS += -mgeneral-regs-only
CFLAGS += -Isrc/
LFLAGS = -ffreestanding -O2 -nostdlib -lgcc
diff --git a/src/init/main.c b/src/init/main.c
index 06ac3a2..d24dda0 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -16,7 +16,7 @@ const char *multipageify(const char *str) {
#define mount(path) _syscall_mount(path, sizeof(path)-1, 0)
-int main() {
+int main(void) {
mount("/");
mount("/some/where");
mount("/some");
diff --git a/src/init/syscalls.c b/src/init/syscalls.c
index 8d87beb..01dda51 100644
--- a/src/init/syscalls.c
+++ b/src/init/syscalls.c
@@ -8,7 +8,7 @@ _Noreturn void _syscall_exit(const char *msg, size_t len) {
__builtin_unreachable();
}
-int _syscall_fork() {
+int _syscall_fork(void) {
return _syscall(_SYSCALL_FORK, 0, 0, 0);
}
diff --git a/src/kernel/arch/generic.h b/src/kernel/arch/generic.h
index 1427658..1fa716b 100644
--- a/src/kernel/arch/generic.h
+++ b/src/kernel/arch/generic.h
@@ -13,14 +13,14 @@
extern char _bss_end;
__attribute__((noreturn))
-void halt_cpu();
+void halt_cpu(void);
// src/arch/i386/sysenter.s
_Noreturn void sysexit(struct registers);
int syscall_handler(int, int, int, int);
// all of those can allocate memory
-struct pagedir *pagedir_new();
+struct pagedir *pagedir_new(void);
struct pagedir *pagedir_copy(const struct pagedir *orig);
void pagedir_map(struct pagedir *dir, void *virt, void *phys,
bool user, bool writeable);
diff --git a/src/kernel/arch/i386/gdt.h b/src/kernel/arch/i386/gdt.h
index bcb9870..5e40cd7 100644
--- a/src/kernel/arch/i386/gdt.h
+++ b/src/kernel/arch/i386/gdt.h
@@ -12,5 +12,5 @@ enum {
SEG_end
};
-void gdt_init();
+void gdt_init(void);
void gdt_farjump(int segment);
diff --git a/src/kernel/arch/i386/gdt/gdt.c b/src/kernel/arch/i386/gdt/gdt.c
index e4cd3ef..6958bb5 100644
--- a/src/kernel/arch/i386/gdt/gdt.c
+++ b/src/kernel/arch/i386/gdt/gdt.c
@@ -42,8 +42,8 @@ static struct tss_entry TSS;
static struct lgdt_arg lgdt_arg; // probably doesn't need to be global
static void gdt_fillout(struct gdt_entry* entry, uint8_t ring, bool code);
-static void gdt_prepare();
-static void gdt_load();
+static void gdt_prepare(void);
+static void gdt_load(void);
static void gdt_fillout(struct gdt_entry* entry, uint8_t ring, bool code) {
@@ -69,7 +69,7 @@ static void gdt_fillout(struct gdt_entry* entry, uint8_t ring, bool code) {
};
}
-static void gdt_prepare() {
+static void gdt_prepare(void) {
GDT[SEG_null].present = 0;
gdt_fillout(&GDT[SEG_r0code], 0, true);
@@ -102,7 +102,7 @@ static void gdt_prepare() {
};
}
-static void gdt_load() {
+static void gdt_load(void) {
lgdt_arg.limit = sizeof(GDT) - 1;
lgdt_arg.base = (uintptr_t) &GDT;
asm("lgdt (%0)"
@@ -121,7 +121,7 @@ static void gdt_load() {
: : "r" (SEG_r0data << 3) : "memory");
}
-void gdt_init() {
+void gdt_init(void) {
gdt_prepare();
gdt_load();
}
diff --git a/src/kernel/arch/i386/interrupts/idt.c b/src/kernel/arch/i386/interrupts/idt.c
index 75c221f..d27bc61 100644
--- a/src/kernel/arch/i386/interrupts/idt.c
+++ b/src/kernel/arch/i386/interrupts/idt.c
@@ -27,12 +27,12 @@ struct lidt_arg {
static struct idt_entry IDT[256];
static struct lidt_arg lidt_arg;
-static void idt_prepare();
-static void idt_load();
-static void idt_test();
+static void idt_prepare(void);
+static void idt_load(void);
+static void idt_test(void);
-static void idt_prepare() {
+static void idt_prepare(void) {
uintptr_t offset;
for (int i = 0; i < 256; i++) {
offset = (uintptr_t) &_isr_stubs + i * 8;
@@ -50,18 +50,18 @@ static void idt_prepare() {
}
}
-static void idt_load() {
+static void idt_load(void) {
lidt_arg.limit = sizeof(IDT) - 1;
lidt_arg.base = (uintptr_t) &IDT;
asm("lidt (%0)" : : "r" (&lidt_arg) : "memory");
}
-static void idt_test() {
+static void idt_test(void) {
asm("int $0x34" : : : "memory");
assert(isr_test_interrupt_called);
}
-void idt_init() {
+void idt_init(void) {
idt_prepare();
idt_load();
idt_test();
diff --git a/src/kernel/arch/i386/interrupts/idt.h b/src/kernel/arch/i386/interrupts/idt.h
index 5627657..6576cf9 100644
--- a/src/kernel/arch/i386/interrupts/idt.h
+++ b/src/kernel/arch/i386/interrupts/idt.h
@@ -1,3 +1,3 @@
#pragma once
-void idt_init();
+void idt_init(void);
diff --git a/src/kernel/arch/i386/pagedir.c b/src/kernel/arch/i386/pagedir.c
index 61ad170..486d2a2 100644
--- a/src/kernel/arch/i386/pagedir.c
+++ b/src/kernel/arch/i386/pagedir.c
@@ -39,7 +39,7 @@ struct pagedir {
} __attribute__((packed));
-struct pagedir *pagedir_new() {
+struct pagedir *pagedir_new(void) {
struct pagedir *dir = page_alloc(1);
for (int i = 0; i < 1024; i++)
dir->e[i].present = 0;
diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c
index b24c857..2470979 100644
--- a/src/kernel/arch/i386/sysenter.c
+++ b/src/kernel/arch/i386/sysenter.c
@@ -3,7 +3,7 @@
struct registers _sysexit_regs; // a hack
-extern void _sysexit_real();
+extern void _sysexit_real(void);
void sysexit(struct registers regs) {
_sysexit_regs = regs;
@@ -13,7 +13,7 @@ void sysexit(struct registers regs) {
__builtin_unreachable();
}
-_Noreturn void sysenter_stage2() {
+_Noreturn void sysenter_stage2(void) {
uint64_t val;
struct registers *regs = &process_current->regs;
diff --git a/src/kernel/arch/i386/sysenter.h b/src/kernel/arch/i386/sysenter.h
index b531fe8..b731c67 100644
--- a/src/kernel/arch/i386/sysenter.h
+++ b/src/kernel/arch/i386/sysenter.h
@@ -1,2 +1,2 @@
#pragma once
-void sysenter_setup();
+void sysenter_setup(void);
diff --git a/src/kernel/arch/i386/tty/serial.c b/src/kernel/arch/i386/tty/serial.c
index 6bfe212..a259750 100644
--- a/src/kernel/arch/i386/tty/serial.c
+++ b/src/kernel/arch/i386/tty/serial.c
@@ -4,7 +4,7 @@
const int COM1 = 0x3f8;
-void serial_init() {
+void serial_init(void) {
// see https://www.sci.muni.cz/docs/pc/serport.txt
port_outb(COM1 + 1, 0x00); // disable interrupts, we won't be using them
diff --git a/src/kernel/arch/i386/tty/serial.h b/src/kernel/arch/i386/tty/serial.h
index ac7131b..2332113 100644
--- a/src/kernel/arch/i386/tty/serial.h
+++ b/src/kernel/arch/i386/tty/serial.h
@@ -2,4 +2,4 @@
#include <stddef.h>
void serial_write(const char *buf, size_t len);
-void serial_init();
+void serial_init(void);
diff --git a/src/kernel/arch/i386/tty/tty.c b/src/kernel/arch/i386/tty/tty.c
index 89a8602..b469285 100644
--- a/src/kernel/arch/i386/tty/tty.c
+++ b/src/kernel/arch/i386/tty/tty.c
@@ -2,7 +2,7 @@
#include <kernel/arch/i386/tty/vga.h>
#include <kernel/arch/log.h>
-void tty_init() {
+void tty_init(void) {
vga_clear();
serial_init();
diff --git a/src/kernel/arch/i386/tty/vga.c b/src/kernel/arch/i386/tty/vga.c
index 3cd1034..24bbf98 100644
--- a/src/kernel/arch/i386/tty/vga.c
+++ b/src/kernel/arch/i386/tty/vga.c
@@ -9,7 +9,7 @@ static const size_t vga_len = 80 * 25;
static struct vga_cell *vga = (void*) 0xB8000;
static size_t vga_pos = 0;
-static void vga_scroll() {
+static void vga_scroll(void) {
for (size_t i = 0; i < vga_len - 80; i++)
vga[i] = vga[i + 80];
vga_pos -= 80;
@@ -26,7 +26,7 @@ void vga_write(const char *buf, size_t len) {
vga_putchar(buf[i]);
}
-void vga_clear() {
+void vga_clear(void) {
for (size_t i = 0; i < vga_len; i++)
vga[i].c = ' ';
vga_pos = 0;
diff --git a/src/kernel/arch/i386/tty/vga.h b/src/kernel/arch/i386/tty/vga.h
index c8747c7..69b1ab7 100644
--- a/src/kernel/arch/i386/tty/vga.h
+++ b/src/kernel/arch/i386/tty/vga.h
@@ -2,4 +2,4 @@
#include <stddef.h>
void vga_write(const char *buf, size_t len);
-void vga_clear();
+void vga_clear(void);
diff --git a/src/kernel/arch/log.h b/src/kernel/arch/log.h
index ea76292..ef8cb17 100644
--- a/src/kernel/arch/log.h
+++ b/src/kernel/arch/log.h
@@ -1,7 +1,7 @@
#pragma once
#include <stddef.h>
-void tty_init();
+void tty_init(void);
void tty_write(const char *buf, size_t len);
static inline void _tty_hex(const char *buf, size_t len) {
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 15e1ef9..cc6e599 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -10,7 +10,7 @@ struct process *process_first;
struct process *process_current;
uint32_t next_pid = 0;
-struct process *process_seed() {
+struct process *process_seed(void) {
struct process *proc = kmalloc(sizeof(struct process));
proc->pages = pagedir_new();
proc->state = PS_RUNNING;
@@ -61,7 +61,7 @@ void process_switch(struct process *proc) {
sysexit(proc->regs);
}
-_Noreturn void process_switch_any() {
+_Noreturn void process_switch_any(void) {
struct process *found = process_find(PS_RUNNING);
if (found)
process_switch(found);
diff --git a/src/kernel/proc.h b/src/kernel/proc.h
index 0a1a42c..87fed14 100644
--- a/src/kernel/proc.h
+++ b/src/kernel/proc.h
@@ -37,9 +37,9 @@ extern struct process *process_first;
extern struct process *process_current;
// creates the root process
-struct process *process_seed();
+struct process *process_seed(void);
struct process *process_fork(struct process *parent);
_Noreturn void process_switch(struct process *proc);
-_Noreturn void process_switch_any(); // switches to any running process
+_Noreturn void process_switch_any(void); // switches to any running process
struct process *process_find(enum process_state);
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 7544174..3383a13 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -59,7 +59,7 @@ int _syscall_await(char *buf, int len) {
process_switch_any();
}
-int _syscall_fork() {
+int _syscall_fork(void) {
struct process *child = process_fork(process_current);
regs_savereturn(&child->regs, 0);
return 1;
diff --git a/src/kernel/tests/base.h b/src/kernel/tests/base.h
index e08e59a..0788c39 100644
--- a/src/kernel/tests/base.h
+++ b/src/kernel/tests/base.h
@@ -9,7 +9,7 @@ extern bool _did_tests_fail;
#pragma GCC diagnostic error "-Wunused-function"
#define TEST(name) \
- static void __test_##name()
+ static void __test_##name(void)
#define TEST_RUN(name) \
__test_##name();
diff --git a/src/kernel/tests/main.c b/src/kernel/tests/main.c
index db4363f..aed7d6a 100644
--- a/src/kernel/tests/main.c
+++ b/src/kernel/tests/main.c
@@ -4,7 +4,7 @@
bool _did_tests_fail;
-void tests_all() {
+void tests_all(void) {
_did_tests_fail = false;
tests_utils();
diff --git a/src/kernel/tests/tests.h b/src/kernel/tests/tests.h
index 5b9697c..aa8597b 100644
--- a/src/kernel/tests/tests.h
+++ b/src/kernel/tests/tests.h
@@ -1,6 +1,6 @@
#pragma once
-void tests_all();
+void tests_all(void);
-void tests_utils();
-void tests_vfs();
+void tests_utils(void);
+void tests_vfs(void);
diff --git a/src/kernel/tests/util.c b/src/kernel/tests/util.c
index 3bc2124..67ff1c4 100644
--- a/src/kernel/tests/util.c
+++ b/src/kernel/tests/util.c
@@ -33,7 +33,7 @@ TEST(static_strcmp) {
TEST_COND(0 < static_strcmp("654", "555"));
}
-void tests_utils() {
+void tests_utils(void) {
TEST_RUN(memcmp);
TEST_RUN(static_strcmp);
}
diff --git a/src/kernel/tests/vfs.c b/src/kernel/tests/vfs.c
index b982098..bc95541 100644
--- a/src/kernel/tests/vfs.c
+++ b/src/kernel/tests/vfs.c
@@ -57,6 +57,6 @@ TEST(path_simplify) {
#undef TEST_WRAPPER
}
-void tests_vfs() {
+void tests_vfs(void) {
TEST_RUN(path_simplify);
}
diff --git a/src/shared/syscalls.h b/src/shared/syscalls.h
index 89907ae..9eb3fa5 100644
--- a/src/shared/syscalls.h
+++ b/src/shared/syscalls.h
@@ -32,7 +32,7 @@ int _syscall_await(char *buf, int len);
* All user memory pages get copied too.
* @return 0 in the child, a meaningless positive value in the parent.
*/
-int _syscall_fork();
+int _syscall_fork(void);
fd_t _syscall_fs_open(const char *path, int len);
int _syscall_mount(const char *path, int len, fd_t fd);
diff --git a/todo.txt b/todo.txt
index 90f0376..b0280d5 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,2 +1 @@
don't use pointer types for useland pointers
-replace () with (void)