Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/chipset/cpu/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions src/drivers/block/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "ahci.h"
#include "pci.h"

/* Is AHCI controller present */
uint8_t ahci_detect_controller(void)
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/block/atapio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/block/ramfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion src/include/floppy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/include/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
2 changes: 1 addition & 1 deletion src/mem/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 10 additions & 4 deletions src/protectedmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 ... ");
Expand All @@ -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");
Expand All @@ -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();
Expand Down