diff options
author | Marvin Borner | 2019-10-13 20:11:32 +0200 |
---|---|---|
committer | Marvin Borner | 2019-10-13 20:11:32 +0200 |
commit | 8754542ce074bef0984f91ce1b1cd8aff9b3d5e9 (patch) | |
tree | 66c6df9f2a2e9e4482ddfbce10490f706f78da33 | |
parent | 58804851fc49f6db1c87f791d39779766108efb0 (diff) |
Fixed all compiler warnings
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/kernel/graphics/graphics.h | 5 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.c | 8 | ||||
-rw-r--r-- | src/kernel/interact.asm | 3 | ||||
-rw-r--r-- | src/kernel/interrupts/isr.c | 2 | ||||
-rw-r--r-- | src/kernel/io/io.c | 2 | ||||
-rw-r--r-- | src/kernel/io/io.h | 2 | ||||
-rw-r--r-- | src/kernel/kernel.c | 5 | ||||
-rw-r--r-- | src/kernel/paging/kheap.c | 4 | ||||
-rw-r--r-- | src/kernel/paging/ordered_array.c | 2 | ||||
-rw-r--r-- | src/kernel/paging/paging.c | 12 | ||||
-rw-r--r-- | src/kernel/system.h | 2 |
12 files changed, 23 insertions, 26 deletions
@@ -75,7 +75,7 @@ debug: @rm -f qemu.log @echo "Starting simulation" @echo "[SERIAL OUTPUT]" - @qemu-system-x86_64 -soundhw pcspk -M accel=kvm:tcg -vga vmware -serial stdio -d cpu_reset -D qemu.log -m 512M -cdrom ./build/melvix.iso + @qemu-system-x86_64 -no-reboot -soundhw pcspk -M accel=kvm:tcg -vga vmware -serial stdio -d cpu_reset -D qemu.log -m 512M -cdrom ./build/melvix.iso @echo "[END OF CONNECTION]" .PHONY: build clean cross test debug
\ No newline at end of file diff --git a/src/kernel/graphics/graphics.h b/src/kernel/graphics/graphics.h index 118fe50..baa054a 100644 --- a/src/kernel/graphics/graphics.h +++ b/src/kernel/graphics/graphics.h @@ -1,9 +1,8 @@ -#ifndef MELVIX_VGA_H -#define MELVIX_VGA_H +#ifndef MELVIX_GRAPHICS_H +#define MELVIX_GRAPHICS_H #include <stddef.h> #include <stdint.h> -#include "vesa.h" /** * Linked table of colors and hardware color codes diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c index cc9dd97..d19e7d8 100644 --- a/src/kernel/graphics/vesa.c +++ b/src/kernel/graphics/vesa.c @@ -15,7 +15,7 @@ void switch_to_vga() { } struct edid_data get_edid() { - /*struct edid_data *edid = umalloc(sizeof(struct edid_data)); + struct edid_data *edid = (struct edid_data *) kmalloc(sizeof(struct edid_data)); regs16_t regs; regs.ax = 0x4F15; @@ -24,9 +24,9 @@ struct edid_data get_edid() { regs.di = get_offset(edid); int32(0x10, ®s); - ufree(edid); + kfree(edid); - return *edid;*/ + return *edid; } struct vbe_mode_info *vbe_set_mode(unsigned short mode) { @@ -81,7 +81,7 @@ void set_optimal_resolution() { regs16_t regs; regs.ax = 0x4F00; regs.es = 0; - regs.di = (unsigned short) info; + regs.di = 0x2000; int32(0x10, ®s); if (regs.ax != 0x004F || strcmp(info->signature, "VESA") != 0) { diff --git a/src/kernel/interact.asm b/src/kernel/interact.asm index eaad82e..a625f8e 100644 --- a/src/kernel/interact.asm +++ b/src/kernel/interact.asm @@ -32,9 +32,6 @@ endstruc section .text int32: use32 ; by Napalm - mov edx, cr0 - and edx, 0x7fffffff - mov cr0, edx _int32: cli ; disable interrupts pusha ; save register state to 32bit stack diff --git a/src/kernel/interrupts/isr.c b/src/kernel/interrupts/isr.c index 3567acf..d4f2e3d 100644 --- a/src/kernel/interrupts/isr.c +++ b/src/kernel/interrupts/isr.c @@ -1,6 +1,6 @@ -#include "../graphics/graphics.h" #include "interrupts.h" #include "../lib/lib.h" +#include "../system.h" // Defined in isr.asm extern void isr0(); diff --git a/src/kernel/io/io.c b/src/kernel/io/io.c index dc2d59a..5da4e0e 100644 --- a/src/kernel/io/io.c +++ b/src/kernel/io/io.c @@ -52,7 +52,7 @@ void serial_put(char ch) { send_b(0x3f8, ch); } -void serial_write(char *data) { +void serial_write(const char *data) { for (size_t i = 0; i < strlen(data); i++) { serial_put(data[i]); } diff --git a/src/kernel/io/io.h b/src/kernel/io/io.h index a34bd21..a145319 100644 --- a/src/kernel/io/io.h +++ b/src/kernel/io/io.h @@ -54,7 +54,7 @@ void init_serial(); * Write a string to the serial port (QEMU logging) * @param data The string that should get transmitted */ -void serial_write(char *data); +void serial_write(const char *data); /** * Write a hex number to the serial port (QEMU logging) diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index e028178..da0b18b 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -24,14 +24,13 @@ void kernel_main(void) { set_optimal_resolution(); init(); - /* TODO: Fix page fault exception - vesa_draw_string("This is a testing text!"); + // vesa_draw_string("This is a testing text!"); if (vesa_available) { serial_write("Loaded VESA!\n"); } else { serial_write("VESA loading failed!\n"); - }*/ + } // __asm__ ("div %0" :: "r"(0)); // Exception testing x/0 loop: diff --git a/src/kernel/paging/kheap.c b/src/kernel/paging/kheap.c index e4f3d20..9af33f7 100644 --- a/src/kernel/paging/kheap.c +++ b/src/kernel/paging/kheap.c @@ -160,7 +160,7 @@ void *alloc(uint32_t size, unsigned char page_align, heap_t *heap) { uint32_t idx = -1; uint32_t value = 0x0; - while (iterator < heap->index.size) { + while (iterator < (int) heap->index.size) { uint32_t tmp = (uint32_t) lookup_ordered_array(iterator, &heap->index); if (tmp > value) { value = tmp; @@ -169,7 +169,7 @@ void *alloc(uint32_t size, unsigned char page_align, heap_t *heap) { iterator++; } - if (idx == -1) { + if ((int) idx == -1) { header_t *header = (header_t *) old_end_address; header->magic = HEAP_MAGIC; header->size = new_length - old_length; diff --git a/src/kernel/paging/ordered_array.c b/src/kernel/paging/ordered_array.c index 563a936..688ff8f 100644 --- a/src/kernel/paging/ordered_array.c +++ b/src/kernel/paging/ordered_array.c @@ -33,7 +33,7 @@ void destroy_ordered_array(ordered_array_t *array) { } void insert_ordered_array(type_t item, ordered_array_t *array) { - assert(array->less_than); + assert((int) array->less_than); uint32_t iterator = 0; while (iterator < array->size && array->less_than(array->array[iterator], item)) iterator++; diff --git a/src/kernel/paging/paging.c b/src/kernel/paging/paging.c index 8f95bab..4bb69d0 100644 --- a/src/kernel/paging/paging.c +++ b/src/kernel/paging/paging.c @@ -1,7 +1,7 @@ #include "paging.h" #include "kheap.h" +#include "../system.h" #include "../lib/lib.h" -#include "../graphics/graphics.h" #include "../io/io.h" page_directory_t *kernel_directory = 0; @@ -29,12 +29,12 @@ static void clear_frame(uint32_t frame_addr) { frames[idx] &= ~(0x1 << off); } -static uint32_t test_frame(uint32_t frame_addr) { +/*static uint32_t test_frame(uint32_t frame_addr) { uint32_t frame = frame_addr / 0x1000; uint32_t idx = INDEX_FROM_BIT(frame); uint32_t off = OFFSET_FROM_BIT(frame); return (frames[idx] & (0x1 << off)); -} +}*/ static uint32_t first_frame() { uint32_t i, j; @@ -48,6 +48,7 @@ static uint32_t first_frame() { } } } + return -1; } void alloc_frame(page_t *page, int is_kernel, int is_writeable) { @@ -80,12 +81,11 @@ void initialise_paging() { frames = (uint32_t *) kmalloc(INDEX_FROM_BIT(nframes)); memory_set(frames, 0, INDEX_FROM_BIT(nframes)); - uint32_t phys; kernel_directory = (page_directory_t *) kmalloc_a(sizeof(page_directory_t)); memory_set(kernel_directory, 0, sizeof(page_directory_t)); kernel_directory->physicalAddr = (uint32_t) kernel_directory->tablesPhysical; - int i = 0; + unsigned int i = 0; for (i = KHEAP_START; i < KHEAP_START + KHEAP_INITIAL_SIZE; i += 0x1000) get_page(i, 1, kernel_directory); @@ -139,7 +139,7 @@ void page_fault(struct regs *r) { int rw = r->err_code & 0x2; int us = r->err_code & 0x4; int reserved = r->err_code & 0x8; - int id = r->err_code & 0x10; + // int id = r->err_code & 0x10; serial_write("Page fault! ( "); if (present) serial_write("present "); diff --git a/src/kernel/system.h b/src/kernel/system.h index 53e567d..8fe7296 100644 --- a/src/kernel/system.h +++ b/src/kernel/system.h @@ -4,6 +4,8 @@ #include <stdint.h> #include "timer/timer.h" #include "lib/lib.h" +#include "graphics/graphics.h" +#include "io/io.h" /** * Initialize the basic features of the OS |