diff --git a/src/sys/Makefile b/src/sys/Makefile index 8d494d6..e19d5f3 100755 --- a/src/sys/Makefile +++ b/src/sys/Makefile @@ -1,7 +1,7 @@ # $Id$ # Kernel Makefile (C) 2002 The UbixOS Project -all: boot-code init-code +all: boot-code init-code kernel-code driver-code kernel boot-code: boot (cd boot;make) @@ -9,5 +9,18 @@ init-code: init (cd init;make) +kernel-code: kernel + (cd kernel;make) + +driver-code: drivers + (cd drivers;make) + +kernel: compile + (cd compile;make) + clean: (cd boot;make clean) + (cd init;make clean) + (cd drivers;make clean) + (cd kernel;make clean) + (cd compile;make clean) \ No newline at end of file diff --git a/src/sys/compile/Makefile b/src/sys/compile/Makefile new file mode 100755 index 0000000..2423d3c --- /dev/null +++ b/src/sys/compile/Makefile @@ -0,0 +1,43 @@ +# $Id$ +# Kernel Makefile (C) 2002 The UbixOS Project + + +#Compiler +GCC = gcc +G++ = gcc + +#Linker +LD = ld + +#Kernel File Name +KERNEL = ubix.elf + +#Delete Program +REMOVE = rm -f + +#Objects +OBJS = + +# Link the kernel statically with fixed text+data address @1M +$(KERNEL) : $(OBJS) + $(LD) -o $@ $(OBJS) ../init/*.o ../kernel/*.o ../drivers/*.o -Ttext 0x10000 + +# Compile the source files +.cc.o: + $(G++) -Wall -fomit-frame-pointer -O -I../include -c -o $@ $< + +.cc.s: + $(G++) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< + +.c.o: + $(GCC) -Wall -O -I../include -c -o $@ $< + +.c.s: + $(GCC) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< + +.S.o: + $(GCC) -Wall -fomit-frame-pointer -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) $(KERNEL) \ No newline at end of file diff --git a/src/sys/drivers/Makefile b/src/sys/drivers/Makefile new file mode 100755 index 0000000..cc4410a --- /dev/null +++ b/src/sys/drivers/Makefile @@ -0,0 +1,35 @@ +# (C) 2002 The UbixOS Project +# $Id$ + + +# Compiler +CC = gcc +CPP = g++ + + +# Linker +LINKER = ld + +# Remove +REMOVE = rm -fr + +# Objects +OBJS = video.o + +all: $(OBJS) + +# Compile Types +.cc.o: + $(CPP) -Wall -fomit-frame-pointer -O -I../include -c -o $@ $< +.cc.s: + $(CPP) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< +.c.o: + $(CC) -Wall -fomit-frame-pointer -O -I../include -c -o $@ $< +.c.s: + $(CC) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< +.S.o: + $(CC) -Wall -fomit-frame-pointer -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) diff --git a/src/sys/drivers/video.c b/src/sys/drivers/video.c new file mode 100755 index 0000000..d183a28 --- /dev/null +++ b/src/sys/drivers/video.c @@ -0,0 +1,11 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +#include + +unsigned char *VIDEO_MEMORY = (char *)0xB8000; +int printColor = 0x07; \ No newline at end of file diff --git a/src/sys/include/ubixos/io.h b/src/sys/include/ubixos/io.h new file mode 100755 index 0000000..064ae68 --- /dev/null +++ b/src/sys/include/ubixos/io.h @@ -0,0 +1,11 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +inline unsigned char inportByte(unsigned int port); +inline unsigned char inportWord(unsigned int port); +inline void outportByte(unsigned int port,unsigned char value); +inline void outportWord(unsigned int port,unsigned int value); \ No newline at end of file diff --git a/src/sys/include/version/version.h b/src/sys/include/version/version.h new file mode 100755 index 0000000..9bf8945 --- /dev/null +++ b/src/sys/include/version/version.h @@ -0,0 +1,10 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +#define ubixVersion "0.01a" + +void outputVersion(); \ No newline at end of file diff --git a/src/sys/init/main.c b/src/sys/init/main.c index f022292..5594c03 100755 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -7,6 +7,9 @@ #include #include +#include + +int main(); descriptorTable(gdt,4) { {dummy:0}, @@ -17,7 +20,13 @@ void _start() { asm( - "lgdt (loadGdt) \n" + "lgdt (gdt)\n" ); + main(); while (1); + } + +int main() { + outputVersion(); //Display Version Info + return(0); } \ No newline at end of file diff --git a/src/sys/kernel/Makefile b/src/sys/kernel/Makefile new file mode 100755 index 0000000..ca6065c --- /dev/null +++ b/src/sys/kernel/Makefile @@ -0,0 +1,35 @@ +# (C) 2002 The UbixOS Project +# $Id$ + + +# Compiler +CC = gcc +CPP = g++ + + +# Linker +LINKER = ld + +# Remove +REMOVE = rm -fr + +# Objects +OBJS = io.o version.o + +all: $(OBJS) + +# Compile Types +.cc.o: + $(CPP) -Wall -fomit-frame-pointer -O -I../include -c -o $@ $< +.cc.s: + $(CPP) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< +.c.o: + $(CC) -Wall -fomit-frame-pointer -O -I../include -c -o $@ $< +.c.s: + $(CC) -Wall -fomit-frame-pointer -O -I../include -S -o $@ $< +.S.o: + $(CC) -Wall -fomit-frame-pointer -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) diff --git a/src/sys/kernel/io.c b/src/sys/kernel/io.c new file mode 100755 index 0000000..67a9b75 --- /dev/null +++ b/src/sys/kernel/io.c @@ -0,0 +1,46 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +/* Input One Byte From A Port */ +inline unsigned char inportByte(unsigned int port) { + unsigned char retVal; + asm volatile( + "inb %%dx,%%al" + : "=a" (retVal) + : "d" (port) + ); + return(retVal); + } + +/* Input One Word From A Port */ +inline unsigned char inportWord(unsigned int port) { + unsigned char retVal; + asm volatile( + "inw %%dx,%%ax" + : "=a" (retVal) + : "d" (port) + ); + return(retVal); + } + +/* Output One Byte To A Port */ +inline void outportByte(unsigned int port,unsigned char value) { + asm volatile( + "outb %%al,%%dx" + : + : "d" (port), "a" (value) + ); + } + +/* Output On Word To A Port */ +inline void outportWord(unsigned int port,unsigned int value) { + asm volatile( + "outw %%ax,%%dx" + : + : "d" (port), "a" (value) + ); + } \ No newline at end of file diff --git a/src/sys/kernel/version.c b/src/sys/kernel/version.c new file mode 100755 index 0000000..9031d74 --- /dev/null +++ b/src/sys/kernel/version.c @@ -0,0 +1,11 @@ +/************************************************************************************** + Copyright (c) 2002 + The UbixOS Project + + $Id$ +**************************************************************************************/ + +#include + +void outputeVersion() { + } \ No newline at end of file diff --git a/ubixos.kdevprj b/ubixos.kdevprj index 2275855..9438921 100755 --- a/ubixos.kdevprj +++ b/ubixos.kdevprj @@ -32,7 +32,7 @@ kdevprj_version=1.3 lfv_open_groups=Others make_options=\s-j1 clean all -makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am +makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am,src/sys/drivers/Makefile.am,src/sys/kernel/Makefile.am,src/sys/compile/Makefile.am,src/sys/include/version/Makefile.am modifyMakefiles=true project_name=UbixOS project_type=normal_empty @@ -101,7 +101,7 @@ [src/sys/Makefile.am] files=src/sys/Makefile -sub_dirs=include,boot,init +sub_dirs=include,boot,init,drivers,kernel,compile type=normal [src/sys/boot/Makefile] @@ -121,12 +121,40 @@ install_location= type=SOURCE +[src/sys/compile/Makefile] +dist=true +install=false +install_location= +type=DATA + +[src/sys/compile/Makefile.am] +files=src/sys/compile/Makefile +sub_dirs= +type=normal + +[src/sys/drivers/Makefile] +dist=true +install=false +install_location= +type=DATA + +[src/sys/drivers/Makefile.am] +files=src/sys/drivers/Makefile,src/sys/drivers/video.c +sub_dirs= +type=static_library + +[src/sys/drivers/video.c] +dist=true +install=false +install_location= +type=SOURCE + [src/sys/include/Makefile.am] -sub_dirs=ubixos +sub_dirs=ubixos,version type=normal [src/sys/include/ubixos/Makefile.am] -files=src/sys/include/ubixos/gdt.h,src/sys/include/ubixos/scheduler.h +files=src/sys/include/ubixos/gdt.h,src/sys/include/ubixos/scheduler.h,src/sys/include/ubixos/io.h sub_dirs= type=normal @@ -136,12 +164,29 @@ install_location= type=HEADER +[src/sys/include/ubixos/io.h] +dist=true +install=false +install_location= +type=HEADER + [src/sys/include/ubixos/scheduler.h] dist=true install=false install_location= type=HEADER +[src/sys/include/version/Makefile.am] +files=src/sys/include/version/version.h +sub_dirs= +type=normal + +[src/sys/include/version/version.h] +dist=true +install=false +install_location= +type=HEADER + [src/sys/init/Makefile] dist=true install=false @@ -160,3 +205,26 @@ install=false install_location= type=SOURCE + +[src/sys/kernel/Makefile] +dist=true +install=false +install_location= +type=DATA + +[src/sys/kernel/Makefile.am] +files=src/sys/kernel/Makefile,src/sys/kernel/io.c,src/sys/kernel/version.c +sub_dirs= +type=static_library + +[src/sys/kernel/io.c] +dist=true +install=false +install_location= +type=SOURCE + +[src/sys/kernel/version.c] +dist=true +install=false +install_location= +type=SOURCE