diff --git a/Makefile b/Makefile index a2b0681..294a3b2 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ ASM = nasm ASMFLAGS = -fbin CC = gcc -CFLAGS = -m32 -ffreestanding -fno-pic -w -Os -I ./src/include/ +CFLAGS = -m32 -ffreestanding -fno-pic -w -Os -I ./src/include/ -fno-stack-protector LD = ld LDFLAGS = -nostdlib -static -T scripts/linker.ld diff --git a/src/chipset/cpu/cpuid.c b/src/chipset/cpu/cpuid.c index f8656bc..f6d1d3d 100644 --- a/src/chipset/cpu/cpuid.c +++ b/src/chipset/cpu/cpuid.c @@ -17,7 +17,7 @@ void cpuid(uint32_t reg, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t * /* Get CPU brand name */ char *cpu_get_brand(void) { - char *name = CPUIDBrandVar; + char *name = (char*)CPUIDBrandVar; cpuid(0x80000002, (uint32_t *)(name + 0), (uint32_t *)(name + 4), (uint32_t *)(name + 8), (uint32_t *)(name + 12)); cpuid(0x80000003, (uint32_t *)(name + 16), (uint32_t *)(name + 20), (uint32_t *)(name + 24), (uint32_t *)(name + 28)); cpuid(0x80000004, (uint32_t *)(name + 32), (uint32_t *)(name + 36), (uint32_t *)(name + 40), (uint32_t *)(name + 44)); diff --git a/src/drivers/block/ahci.c b/src/drivers/block/ahci.c index 3600594..2e1be12 100644 --- a/src/drivers/block/ahci.c +++ b/src/drivers/block/ahci.c @@ -7,6 +7,7 @@ */ #include "ahci.h" +#include "pci.h" /* Is AHCI controller present */ uint8_t ahci_detect_controller(void) diff --git a/src/drivers/block/atapio.c b/src/drivers/block/atapio.c index 0063973..5aac4d1 100644 --- a/src/drivers/block/atapio.c +++ b/src/drivers/block/atapio.c @@ -21,7 +21,7 @@ char *ata_read_lba(uint32_t lba, void *buffer) while (inb(ATA_MASTER + 7) & 128); for (int i = 0; i < 256; i++) { *((uint16_t *)ATA_BUFFER + i) = inw(ATA_MASTER); } - memcpy(buffer, ATA_BUFFER, 512); + memcpy(buffer, (void*)ATA_BUFFER, 512); return buffer; } diff --git a/src/drivers/block/floppy.c b/src/drivers/block/floppy.c index cd51850..c729267 100644 --- a/src/drivers/block/floppy.c +++ b/src/drivers/block/floppy.c @@ -43,7 +43,7 @@ uint8_t floppy_read_fifo(void) } /* Handling floppy drive interrupts */ -void floppy_sense_intrerrupt(uint8_t *cylinler, uint8_t *status) +void floppy_sense_intrerrupt(int *cylinler, int *status) { floppy_do_command(FLOPPY_SENSE_COMMAND); *status = floppy_read_fifo(); diff --git a/src/drivers/block/ramfb.c b/src/drivers/block/ramfb.c index 24d8bad..71f8a75 100644 --- a/src/drivers/block/ramfb.c +++ b/src/drivers/block/ramfb.c @@ -86,7 +86,7 @@ void RAMFB_put_rect(int x, int y, int w, int h, uint32_t clr) /* Draw a character at the specified position */ void RAMFB_put_char(int x, int y, char chr) { - uint32_t *screen = VideoMemory; + uint32_t *screen = (uint32_t*)VideoMemory; uint8_t *font = BitmapFont; font += chr * 16; @@ -148,7 +148,7 @@ void RAMFB_init(int width, int height) ScreenH = height; Color = 0xFFFFFF; - memset(VideoMemory, 0, (width * height) * (32 / 8)); + memset((void*)VideoMemory, 0, (width * height) * (32 / 8)); } else { __asm__ volatile("hlt"); } diff --git a/src/include/floppy.h b/src/include/floppy.h index 8e2a7b3..11a07f9 100644 --- a/src/include/floppy.h +++ b/src/include/floppy.h @@ -45,7 +45,7 @@ void floppy_do_command(uint8_t command); uint8_t floppy_read_fifo(void); /* Handling floppy drive interrupts */ -void floppy_sense_intrerrupt(uint8_t *cylinler, uint8_t *status); +void floppy_sense_intrerrupt(int *cylinler, int *status); /* Start the floppy drive motor */ void floppy_start_motor(void); diff --git a/src/include/memory.h b/src/include/memory.h index 380e077..4c041d5 100644 --- a/src/include/memory.h +++ b/src/include/memory.h @@ -21,6 +21,6 @@ uint32_t ram_detect(void); void *memcpy(void *dest, const void *src, uint32_t len); /* Set the value of the memory area */ -void memset(void *dest, int val, uint32_t len); +void *memset(void *dest, int val, uint32_t len); #endif // INCLUDE_MEMORY_H_ diff --git a/src/mem/memory.c b/src/mem/memory.c index 5ad7924..98d7576 100644 --- a/src/mem/memory.c +++ b/src/mem/memory.c @@ -33,7 +33,7 @@ void *memcpy(void *dest, const void *src, uint32_t len) } /* Set the value of a memory area */ -void memset(void *dest, int val, uint32_t len) +void *memset(void *dest, int val, uint32_t len) { while (len-- > 0) *((uint8_t *)dest++) = val; return dest; diff --git a/src/protectedmode.c b/src/protectedmode.c index 34098ea..e408ede 100644 --- a/src/protectedmode.c +++ b/src/protectedmode.c @@ -15,12 +15,18 @@ #include "floppy.h" #include "logo.lib.h" #include "memory.h" -#include "pci.h" +#include "pic.h" #include "ps2.h" #include "ramfb.h" #include "serial.h" #include "speaker.h" +/* I tried to solve it by including + * 'cstring.h', but it didn't seem + * to work + */ +int inttostr(uint32_t num); + /* BIOS protected mode entry */ extern void C_ENTRY(void) { @@ -74,7 +80,7 @@ extern void C_ENTRY(void) RAMFB_put_str("\n"); RAMFB_put_str("Memory: "); - RAMFB_put_str(inttostr(ram_detect())); + RAMFB_put_str((char*)inttostr(ram_detect())); RAMFB_put_str("K\n\n"); RAMFB_put_str("Detecting AHCI ... "); @@ -92,7 +98,7 @@ extern void C_ENTRY(void) RAMFB_put_str("Detecting Floppy ... "); if (floppy_get_drives()) { RAMFB_put_str("Floppy Number: "); - RAMFB_put_str(inttostr(floppy_get_drives())); + RAMFB_put_str((char*)inttostr(floppy_get_drives())); RAMFB_put_str("\n\n"); } else { RAMFB_put_str("Floppy Not present.\n\n"); @@ -102,7 +108,7 @@ extern void C_ENTRY(void) if (ata_controller_detect() && ata_driver_detect()) { RAMFB_put_str("Booting from Hard Disk...\n"); memset((void *)0x7C00, 0, 512); - ata_read_lba(0, 0x7c00); + ata_read_lba(0, (void*)0x7c00); if (*((uint16_t *)0x7dfe) == 0xAA55) { void (*boot)(void) = (void (*)(void))(0x7c00); boot();