diff --git a/src/Makefile.inc b/src/Makefile.inc new file mode 100644 index 0000000..3bd5131 --- /dev/null +++ b/src/Makefile.inc @@ -0,0 +1,11 @@ +# $Id$ +# Global 'Source' Options + +# allow you to change your default compiler without affecting your other work +CC = gcc +CXX = g++ +LD = ld +AR = ar +REMOVE = rm -rf + +FD_DEVICE = /dev/md0 diff --git a/src/sys/Makefile.inc b/src/sys/Makefile.inc new file mode 100644 index 0000000..1deafc3 --- /dev/null +++ b/src/sys/Makefile.inc @@ -0,0 +1,6 @@ +# $Id: +# global 'sys' options + +INCLUDES = -I../include +CFLAGS = -Wall -nostdlib -nostdinc -fno-builtin -fno-exceptions -O +KERNEL = ubix.elf diff --git a/src/sys/init/Makefile b/src/sys/init/Makefile new file mode 100644 index 0000000..c3c2d99 --- /dev/null +++ b/src/sys/init/Makefile @@ -0,0 +1,27 @@ +# (C) 2002-2004 The UbixOS Project +# $Id$ + +# Include Global 'Source' Options +include ../../Makefile.inc +include ../Makefile.inc + +# Objects +OBJS = start.o main.o static.o + +all: $(OBJS) + +# Compile Types +.cc.o: + $(CXX) $(CFLAGS) $(INCLUDES) -c -o $@ $< +.cc.s: + $(CXX) $(CFLAGS) $(INCLUDES) -S -o $@ $< +.c.o: + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< +.c.s: + $(CC) $(CFLAGS) $(INCLUDES) -S -o $@ $< +.S.o: + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) diff --git a/src/sys/init/main.c b/src/sys/init/main.c new file mode 100644 index 0000000..15d6652 --- /dev/null +++ b/src/sys/init/main.c @@ -0,0 +1,3 @@ +void main() { + while (1); + } diff --git a/src/sys/init/start.S b/src/sys/init/start.S new file mode 100644 index 0000000..121010d --- /dev/null +++ b/src/sys/init/start.S @@ -0,0 +1,5 @@ +#init file for ubixos uhm stuff to follow? + + +_start: + xor %eax,%eax diff --git a/src/sys/init/static.c b/src/sys/init/static.c new file mode 100644 index 0000000..5196c74 --- /dev/null +++ b/src/sys/init/static.c @@ -0,0 +1,50 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +*****************************************************************************************/ + +#include + +int static_constructors(void) { + extern void (* __ctor_list)(); + void (** l_ctor)() = &__ctor_list; + int l_ctorCount = *(int *)l_ctor; + + kprintf("Calling static constructors\n"); + + l_ctor++; + while(l_ctorCount) { + (*l_ctor)(); + l_ctorCount--; + l_ctor++; + } + return(0x0); + } + +/*** + END + ***/