From 0526e493cd3bba0487c9dffd8976713bc9825ff1 Mon Sep 17 00:00:00 2001 From: Joshua Phillips Date: Thu, 4 Dec 2008 13:22:36 +0000 Subject: [PATCH] Put 'void' in all function parameters for functions which take no parameters: this is because without this, the compiler doesn't even seem to notice mismatched function pointer types! Also returned nothing from kb_install - there was nothing to return. --- include/critical.h | 24 ++++++++++++------------ include/general.h | 6 +++--- include/keyboard.h | 5 ++--- kernel/critical.c | 10 +++++----- kernel/interrupt.c | 2 +- kernel/keyboard.c | 7 +++---- kernel/kmain.c | 6 ++++-- kernel/math.c | 4 ++-- 8 files changed, 32 insertions(+), 32 deletions(-) rewrite include/critical.h (73%) diff --git a/include/critical.h b/include/critical.h dissimilarity index 73% index 869d958..e3d58c5 100644 --- a/include/critical.h +++ b/include/critical.h @@ -1,12 +1,12 @@ -#ifndef CRITICAL_H -#define CRITICAL_H - -// Code for critical sections and SMP synchronization - -void critical_enter(); // enter a critical section (turns off interrupts) -void critical_exit(); // leave a critical section (turns interrupts back on) -void memory_barrier(); /* memory barrier */ -void smp_lock(); /* spinlock enter */ -void smp_unlock(); /* spinlock exit */ - -#endif +#ifndef CRITICAL_H +#define CRITICAL_H + +// Code for critical sections and SMP synchronization + +void critical_enter(void); // enter a critical section (turns off interrupts) +void critical_exit(void); // leave a critical section (turns interrupts back on) +void memory_barrier(void); /* memory barrier */ +void smp_lock(void); /* spinlock enter */ +void smp_unlock(void); /* spinlock exit */ + +#endif diff --git a/include/general.h b/include/general.h index f779bec..e71b972 100644 --- a/include/general.h +++ b/include/general.h @@ -40,11 +40,11 @@ int vsprintf(char *str, const char *fmt, va_list ap); int sprintf(char *str, const char *fmt, ...); // these are defined in math.c -void init_sse(); -void init_fpu(); +void init_sse(void); +void init_fpu(void); // these are defined in mp_tables.c -void parse_mp_tables(); +void parse_mp_tables(void); static inline void outb(int port, uint8_t value) { diff --git a/include/keyboard.h b/include/keyboard.h index 61bf030..c23b07c 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -1,9 +1,8 @@ #ifndef CPUID_H #define CPUID_H - // these are defined in keyboard.c -unsigned char getch(); -long kb_install(); +char getch(void); +void kb_install(void); #endif diff --git a/kernel/critical.c b/kernel/critical.c index 3aa4b6f..8618c69 100644 --- a/kernel/critical.c +++ b/kernel/critical.c @@ -3,23 +3,23 @@ static volatile uint32_t spinlock = 0; /* volatile to not optimize the smp_lock loop away */ -void critical_enter() +void critical_enter(void) { cli(); } -void critical_exit() +void critical_exit(void) { sti(); } /* mb = memory barrier, used for code synchronization */ -void memory_barrier() +void memory_barrier(void) { asm volatile("mfence"); } -void smp_lock() +void smp_lock(void) { critical_enter(); /* disable interrupt */ memory_barrier(); /* syncronize */ @@ -31,7 +31,7 @@ void smp_lock() ::"m"(spinlock)); } -void smp_unlock() +void smp_unlock(void) { spinlock = 0; /* unlock */ critical_exit(); /* re-enable interrupts */ diff --git a/kernel/interrupt.c b/kernel/interrupt.c index bd63c74..d0fc546 100644 --- a/kernel/interrupt.c +++ b/kernel/interrupt.c @@ -53,7 +53,7 @@ static void load_idt_addr(uint16_t *idt) } // small busy-wait loop for configuring the PIC -static void io_wait() +static void io_wait(void) { int i; for (i=0; i<16; i++) diff --git a/kernel/keyboard.c b/kernel/keyboard.c index 808a0fa..4a60122 100644 --- a/kernel/keyboard.c +++ b/kernel/keyboard.c @@ -113,7 +113,7 @@ static const unsigned char kbduss[] = int int01_flag=0; int is_shift=0; -char getch() +char getch(void) { unsigned char scan_code, ch; int01_flag=0; @@ -237,7 +237,7 @@ unsigned convert(unsigned key) return temp; } /* Handles the keyboard interrupt */ -void kb_int_handler() +static void kb_int_handler(void) { unsigned char scancode; int01_flag=1; @@ -272,8 +272,7 @@ void kb_int_handler() ack_irq(1); } -long kb_install() { +void kb_install(void) { interrupt_set_handler(irq_to_int(1), &kb_int_handler); unmask_irq(1); - return 0; } diff --git a/kernel/kmain.c b/kernel/kmain.c index e96b7b3..e82c13e 100644 --- a/kernel/kmain.c +++ b/kernel/kmain.c @@ -6,7 +6,7 @@ #include "keyboard.h" #include "timer.h" #include "multiboot.h" -long kb_install(); + static void read_mmap_info(struct mb_info *mbi) { struct mb_mmap *region; // current memory region @@ -82,5 +82,7 @@ void kmain(uint32_t freemem_base, struct mb_info *mbi, unsigned int magic) console_reset_color(); //panic("Test Panic"); // enter an idle loop, so we can see the effects of interrupts - for(;;){hlt();} + for(;;){ + hlt(); + } } diff --git a/kernel/math.c b/kernel/math.c index e54bc40..e78c89b 100644 --- a/kernel/math.c +++ b/kernel/math.c @@ -9,7 +9,7 @@ struct cpuid_s cpuid; -void init_fpu() +void init_fpu(void) { /* FINIT = FPU INIT. This allows for the use of Float/Double/Long Double data types */ if(cpuid.features_edx & 0x01) /* checks for the FPU flag */ @@ -18,7 +18,7 @@ void init_fpu() } } -void init_sse() +void init_sse(void) { uint32_t cr0, cr4; -- 2.11.4.GIT