diff --git a/src/Makefile.inc b/src/Makefile.inc index 935fc6c..8a14d34 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -2,8 +2,8 @@ # Global 'Source' Options # allow you to change your default compiler without affecting your other work -CC = gcc -CXX = g++ +CC = gcc295 +CXX = g++295 LD = ld AR = ar REMOVE = rm -rf diff --git a/src/bin/clock/main.c b/src/bin/clock/main.c index 9804603..55f8934 100644 --- a/src/bin/clock/main.c +++ b/src/bin/clock/main.c @@ -93,7 +93,8 @@ sec = sysTime; sprintf(time,"[%02d/%02d/%i, %02d:%02d.%02d]",month,day,year,hour,min,sec); - print2(time,offset,0xFA); + //print2(time,offset,0xFA); + printf(time); sysTime = gettime(); } return(0); diff --git a/src/sys/include/ubixos/spinlock.h b/src/sys/include/ubixos/spinlock.h new file mode 100644 index 0000000..7da67ff --- /dev/null +++ b/src/sys/include/ubixos/spinlock.h @@ -0,0 +1,44 @@ +/************************************************************************************** + Copyright (c) 2002 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$ + +**************************************************************************************/ + +#ifndef _SPINLOCK_H +#define _SPINLOCK_H + +#include + +#define SPIN_LOCK_INITIALIZER 0 + +typedef volatile int spinLock_t; + +extern inline void spinLockInit(spinLock_t *); +extern inline void spinUnlock(spinLock_t *); +extern inline int spinTryLock(spinLock_t *); +extern inline void spinLock(spinLock_t *); +extern inline int spinLockLocked(spinLock_t *); + +#endif + +/*** + END + ***/ + diff --git a/src/sys/kernel/Makefile b/src/sys/kernel/Makefile index f8a6af6..3d1063e 100644 --- a/src/sys/kernel/Makefile +++ b/src/sys/kernel/Makefile @@ -6,7 +6,7 @@ include ../Makefile.inc # Objects -OBJS = bioscall.o ld.o time.o fork.o syscall.o elf.o file.o idletask.o exec.o sched.o kpanic.o vitals.o ubthread.o +OBJS = spinlock.o bioscall.o ld.o time.o fork.o syscall.o elf.o file.o idletask.o exec.o sched.o kpanic.o vitals.o ubthread.o all: $(OBJS) diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 0ddfe77..78c575d 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.2 2004/04/30 14:16:04 reddawg + Fixed all the datatypes to be consistant uInt8,uInt16,uInt32,Int8,Int16,Int32 + Revision 1.1.1.1 2004/04/15 12:07:18 reddawg UbixOS v1.0 @@ -377,7 +380,8 @@ } _current->oInfo.shstrtab = (char *)kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize,_current->id); fseek(tmpFd,sectionHeader[binaryHeader->eShstrndx].shOffset,0); - fread(_current->oInfo.shstrtab,sectionHeader[binaryHeader->eShstrndx].shSize,0,tmpFd); + fread(_current->oInfo.shstrtab,sectionHeader[binaryHeader->eShstrndx].shSize,1,tmpFd); + kprintf("SIZE: [%i]\n",sectionHeader[binaryHeader->eShstrndx].shSize); for (i=0;i<12;i++) { if (elfDynamicS[i].dynVal == 0x3) { diff --git a/src/sys/kernel/ld.c b/src/sys/kernel/ld.c index 84e7fd9..88d2a27 100644 --- a/src/sys/kernel/ld.c +++ b/src/sys/kernel/ld.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.1.1.1 2004/04/15 12:07:19 reddawg + UbixOS v1.0 + Revision 1.2 2004/04/13 16:16:44 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -40,11 +43,16 @@ #include void ld(int first,int got2) { + int i = 0x0; uInt32 *tmp; kprintf("Kernel Linker\n"); kprintf("[0x%X][0x%X]\n",first,got2); tmp = (uInt32 *)got2; kprintf("[0x%X]\n",tmp[first]); + kprintf("[%s]\n",_current->oInfo.shstrtab[first]); + for (i=0;i<10;i++) { + kprintf("[%s][%i]\n",_current->oInfo.shstrtab[i],i); + } _current->state = DEAD; while (1); } diff --git a/src/sys/kernel/spinlock.c b/src/sys/kernel/spinlock.c new file mode 100644 index 0000000..6cf460f --- /dev/null +++ b/src/sys/kernel/spinlock.c @@ -0,0 +1,67 @@ +/***************************************************************************************** + Copyright (c) 2002 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. + + $Log$ + + $Id$ + +*****************************************************************************************/ + +#include + +inline void spinLockInit(spinLock_t *lock) { + *lock = SPIN_LOCK_INITIALIZER; + } + +inline void spin_unlock(spinLock_t *lock) { + register int unlocked; + __asm__ __volatile ( + "xchgl %0, %1" + : "=&r" (unlocked), "=m" (*lock) : "0" (0) + ); + } + +inline int spinTryLock(spinLock_t *lock) { + register int locked; + __asm__ __volatile ("xchgl %0, %1" + : "=&r" (locked), "=m" (*lock) : "0" (1) + ); + return(!locked); + } + +inline void spinLock(spinLock_t *lock) { + while (! spinTryLock(lock)) + while (*lock == 1); + } + +inline int spinLockLocked(spinLock_t *lock) { + return(*lock != 0); + } + + +/*** + END + ***/ + diff --git a/src/tools/Makefile b/src/tools/Makefile index 55cf61c..5e6263d 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -47,7 +47,7 @@ (cp ../bin/fdisk/fdisk ./) (cp ../bin/cp/cp ./) #(cp ../bin/format/format ./) - (./format 50 2000 /dev/fd0 ubix.elf 0 format 3754 fdisk 3754 ROM8X14.DPF 3754 init 3754 login 3754 shell 3754 userdb 3754 ls 3754 motd 3754 cp 3754) + (./format 50 2000 /dev/fd0 ubix.elf 0 format 3754 fdisk 3754 ROM8X14.DPF 3754 init 3754 login 3754 shell 3754 userdb 3754 ls 3754 motd 3754 cp 3754 clock 3754) #(./format 200 2000 /dev/md1 ubix.elf 0 format 3754 fdisk 3754 ROM8X14.DPF 3754 init 3754 login 3754 shell 3754 userdb 3754 ls 3754 motd 3754 cp 3754) (./format 1064 2000 /dev/fd0 shell 3754 clock 3754) #(./format 200 2000 /dev/md1 ubix.elf 0 shell 3754 motd 3754 libc.so 3754)