Merge branch 'main' of git.disroot.org:dvonik/omos-tcnj2024

because we are working at the same time
This commit is contained in:
spikey 2024-02-18 07:59:01 -05:00
commit ec397c3b16
11 changed files with 38 additions and 18 deletions

View File

@ -1,17 +1,17 @@
#!/usr/bin/env sh
OBJ="obj"
INCLUDE="-Isys/drv/vga/include -Isys/include"
CFLAGS="-g -m32 -ffreestanding -Wall -Wextra -pedantic -nostdlib $INCLUDE"
INCLUDE="-Isys/include"
CFLAGS="-m32 -ffreestanding -Wall -Wextra -pedantic -nostdlib $INCLUDE"
ASFLAGS="-felf32"
LDFLAGS="-m elf_i386"
mkdir -p $OBJ
rm -rf $OBJ/*
. boot/Makescript
. sys/Makescript
. sys/drv/Makescript
ld $LDFLAGS -T boot/link.ld -o omos obj/boot.o obj/vga.o obj/sysinit.o
ld $LDFLAGS -T boot/link.ld -o omos $(for a in $OBJ/*; do printf "$a "; done)
echo "Build Success"

View File

@ -1,3 +1,5 @@
echo "Kernel Build"
cc $CFLAGS -c sys/lib.c -o $OBJ/lib.o
cc $CFLAGS -c sys/video.c -o $OBJ/video.o
cc $CFLAGS -c sys/sysinit.c -o $OBJ/sysinit.o

View File

@ -1,3 +0,0 @@
echo "Driver Build"
. sys/drv/vga/Makescript

View File

@ -1,3 +0,0 @@
echo "VGA Driver Build"
cc $CFLAGS -c sys/drv/vga/video.c -o $OBJ/vga.o

9
sys/include/fcntl.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef FCNTL_H
#define FCNTL_H
#define O_RDONLY 0x0000
#define O_WRONLY 0x0010
#define O_RDWR 0x0020
#define O_CREAT 0x0200
#endif

View File

@ -1,8 +1,11 @@
8 ifndef MEMORY_H
#ifndef MEMORY_H
#define MEMORY_H
#include <types.h>
#define EXTMEMBOT 0x100000
#define PHYSMEMTOP 0x0e000000
/*
* Each allocated memory is stored internally like this:

2
sys/include/param.h Normal file
View File

@ -0,0 +1,2 @@
#define NDEV 10
#define ROOTDEV 0

12
sys/lib.c Normal file
View File

@ -0,0 +1,12 @@
#include <types.h>
u32
strlen(const char *str)
{
size_t i;
for (i = 0; str[i] != NULL; i++)
;
return i;
}

View File

@ -3,12 +3,8 @@
void
sysinit(void)
{
char *howdy = "Om Smart";
vga_clearscreen();
vga_write("Om Smert.", 9, 0x0F);
vga_write("Om Smarter.", 11, 0x0F);
for (s16 i = 0; i < 99; i++) {
vga_write("Om Smart.", 9, 0x0F);
vga_write("Om Smarter.", 11, 0x0F);
}
vga_write("fish stick", 10, 0x07);
vga_write(howdy, strlen(howdy), 0x1f);
}

View File

@ -21,6 +21,8 @@ vga_write(s8 *sequence, s16 size, s8 flags)
for (s16 i = 0; i <= (unused = VGA_SIZE - needed_space); i++) {
vga_vidmem[i] = vga_vidmem[needed_space + i];
}
unused--;
unused--;
}
for (s16 i = 0; i < size; i++) {