summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2021-07-24 21:32:03 +0200
committerdzwdz2021-07-24 21:32:03 +0200
commitef7ec09f68cf10e1f75630409c79ce573d979f1e (patch)
treed395fb4c0842a46b513da2f30f669f0bd4d99116 /src
parent986ff1e44ef800f56a5f20afb18c1ffdaf140a23 (diff)
fix some warnings
Diffstat (limited to 'src')
-rw-r--r--src/init/main.c6
-rw-r--r--src/kernel/arch/generic.h2
-rw-r--r--src/kernel/arch/i386/sysenter.c1
-rw-r--r--src/kernel/main.c2
-rw-r--r--src/kernel/proc.c4
-rw-r--r--src/kernel/proc.h2
6 files changed, 9 insertions, 8 deletions
diff --git a/src/init/main.c b/src/init/main.c
index 84475da..119984e 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -4,13 +4,13 @@
int _syscall(int, int, int, int);
-void exit(const char *msg, size_t len) {
- _syscall(SC_EXIT, (void*)msg, len, 0);
+_Noreturn void exit(const char *msg, size_t len) {
+ _syscall(SC_EXIT, (int)msg, len, 0);
__builtin_unreachable();
}
int debuglog(const char *msg, size_t len) {
- return _syscall(SC_DEBUGLOG, (void*)msg, len, 0);
+ return _syscall(SC_DEBUGLOG, (int)msg, len, 0);
}
diff --git a/src/kernel/arch/generic.h b/src/kernel/arch/generic.h
index d5f8b3c..3ab21b4 100644
--- a/src/kernel/arch/generic.h
+++ b/src/kernel/arch/generic.h
@@ -16,7 +16,7 @@ __attribute__((noreturn))
void halt_cpu();
// src/arch/i386/sysenter.s
-void sysexit(struct registers);
+_Noreturn void sysexit(struct registers);
int syscall_handler(int, int, int, int);
// all of those can allocate memory
diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c
index 9ba826b..b24c857 100644
--- a/src/kernel/arch/i386/sysenter.c
+++ b/src/kernel/arch/i386/sysenter.c
@@ -10,6 +10,7 @@ void sysexit(struct registers regs) {
_sysexit_regs.ecx = regs.esp;
_sysexit_regs.edx = regs.eip;
_sysexit_real();
+ __builtin_unreachable();
}
_Noreturn void sysenter_stage2() {
diff --git a/src/kernel/main.c b/src/kernel/main.c
index ce69bc2..1743a0c 100644
--- a/src/kernel/main.c
+++ b/src/kernel/main.c
@@ -14,7 +14,7 @@ static void run_init(struct kmain_info *info) {
for (uintptr_t off = 0; off < info->init.size; off += PAGE_SIZE)
pagedir_map(proc->pages, init_base + off, info->init.at + off,
true, true);
- proc->regs.eip = init_base;
+ proc->regs.eip = (int) init_base;
log_const("switching...");
process_switch(proc);
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index 0f2b91d..9c7e390 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -11,12 +11,12 @@ struct process *process_new() {
// map the stack to the last page in memory
pagedir_map(proc->pages, (void*)~PAGE_MASK, page_alloc(1), true, true);
- proc->stack_top = proc->regs.esp = (void*) ~0xF;
+ proc->stack_top = proc->regs.esp = ~0xF;
// map the kernel
// yup, .text is writeable too. the plan is to not map the kernel
// into user memory at all, but i'll implement that later. TODO
- for (size_t p = 0x100000; p < &_bss_end; p += PAGE_SIZE)
+ for (size_t p = 0x100000; p < (size_t)&_bss_end; p += PAGE_SIZE)
pagedir_map(proc->pages, (void*)p, (void*)p, false, true);
// the kernel still has to load the executable code and set EIP
diff --git a/src/kernel/proc.h b/src/kernel/proc.h
index a40d3ca..7ab8da8 100644
--- a/src/kernel/proc.h
+++ b/src/kernel/proc.h
@@ -10,4 +10,4 @@ struct process {
extern struct process *process_current;
struct process *process_new();
-void process_switch(struct process *proc);
+_Noreturn void process_switch(struct process *proc);