diff --git a/src/bin/init/Makefile b/src/bin/init/Makefile index 87eaa45..c7b32a8 100644 --- a/src/bin/init/Makefile +++ b/src/bin/init/Makefile @@ -20,6 +20,8 @@ #Startup File STARTUP = ../../lib/ubix/startup.o +#LIBRARIES = ../../lib/libc/libc.so + # Link The Binary $(BINARY) : $(OBJS) $(CC) $(CFLAGS) -o $@ $(STARTUP) $(LIBRARIES) $(OBJS) diff --git a/src/bin/login/Makefile b/src/bin/login/Makefile index fba87bb..205f68f 100644 --- a/src/bin/login/Makefile +++ b/src/bin/login/Makefile @@ -20,6 +20,8 @@ #Startup File STARTUP = ../../lib/ubix/startup.o +#LIBRARIES = ../../lib/libc/libc.so + # Link The Binary $(BINARY) : $(OBJS) $(CC) $(CFLAGS) -o $@ $(STARTUP) $(LIBRARIES) $(OBJS) diff --git a/src/bin/ls/Makefile b/src/bin/ls/Makefile index 3cfde47..154fbe4 100644 --- a/src/bin/ls/Makefile +++ b/src/bin/ls/Makefile @@ -20,6 +20,8 @@ #Startup File STARTUP = ../../lib/ubix/startup.o +LIBRARIES = ../../lib/libc/libc.so + # Link The Binary $(BINARY) : $(OBJS) $(CC) $(CFLAGS) -o $@ $(STARTUP) $(LIBRARIES) $(OBJS) diff --git a/src/bin/ls/main.c b/src/bin/ls/main.c index c0f9111..826a790 100644 --- a/src/bin/ls/main.c +++ b/src/bin/ls/main.c @@ -50,10 +50,14 @@ int main(int argc,char **argv) { int i = 0x0,x = 0x0,tmpPerms = 0x0; - char *pwd = (char *)malloc(256); - char *permsData = (char *)malloc(13); + char *pwd = 0x0; + char *permsData = 0x0; FILE *fd; struct directoryEntry *dirEntry = 0x0; + + pwd = (char *)malloc(256); + permsData = (char *)malloc(13); + if (argv[1] == 0x0) { if ((fd = fopen(":","rb")) == 0x0) { printf("Error: Reading Directory\n"); diff --git a/src/bin/shell/Makefile b/src/bin/shell/Makefile index 955a664..8137793 100644 --- a/src/bin/shell/Makefile +++ b/src/bin/shell/Makefile @@ -20,6 +20,8 @@ #Startup File STARTUP = ../../lib/ubix/startup.o +#LIBRARIES = ../../lib/libc/libc.so + # Link The Binary $(BINARY) : $(OBJS) $(CC) $(CFLAGS) -o $@ $(STARTUP) $(LIBRARIES) $(OBJS) diff --git a/src/lib/libc_old/stdio/printf.c b/src/lib/libc_old/stdio/printf.c index 4db8494..0fa944a 100644 --- a/src/lib/libc_old/stdio/printf.c +++ b/src/lib/libc_old/stdio/printf.c @@ -28,7 +28,7 @@ int retVal; vaList ap; vaStart(ap, fmt); - retVal = vfprintf(stdin, fmt, ap); + retVal = vfprintf(0x0, fmt, ap); vaEnd(ap); return(retVal); } diff --git a/src/lib/libc_old/sys/getpage.c b/src/lib/libc_old/sys/getpage.c index 73cdae0..aa70388 100644 --- a/src/lib/libc_old/sys/getpage.c +++ b/src/lib/libc_old/sys/getpage.c @@ -21,8 +21,10 @@ **************************************************************************************/ +#include + void *getPage(int count) { - long pageAddr = 0x0; + uInt32 pageAddr = 0x0; asm( "int %0\n" : : "i" (0x80),"a" (7),"b" (&pageAddr),"c" (count) diff --git a/src/sys/Makefile.inc b/src/sys/Makefile.inc index 3f2deb2..935481a 100644 --- a/src/sys/Makefile.inc +++ b/src/sys/Makefile.inc @@ -2,5 +2,5 @@ # global 'sys' options INCLUDES = -I../include -CFLAGS = -fno-builtin -nostdlib -nostdinc -fno-rtti -fno-exceptions -fomit-frame-pointer +CFLAGS = -nostdlib -fno-builtin -fno-exceptions -fomit-frame-pointer KERNEL = ubix.elf diff --git a/src/sys/include/ubixos/elf.h b/src/sys/include/ubixos/elf.h index 3e8792d..07b31e6 100644 --- a/src/sys/include/ubixos/elf.h +++ b/src/sys/include/ubixos/elf.h @@ -35,6 +35,18 @@ #define elfExecutable 0x002 #define elfLibrary 0x003 +#define R_386_NONE 0 /* none none */ +#define R_386_32 1 /* word32 S + A */ +#define R_386_PC32 2 /* word32 S + A - P */ +#define R_386_GOT32 3 /* word32 G + A - P */ +#define R_386_PLT32 4 /* word32 L + A - P */ +#define R_386_COPY 5 /* none none */ +#define R_386_GLOB_DAT 6 /* word32 S */ +#define R_386_JMP_SLOT 7 /* word32 S */ +#define R_386_RELATIVE 8 /* word32 B + A */ +#define R_386_GOTOFF 9 /* word32 S + A - GOT */ +#define R_386_GOTPC 10 /* word32 GOT + A - P */ + /* Elf Types */ #define ET_NONE 0 // No file type @@ -138,6 +150,9 @@ /*** $Log$ + Revision 1.4 2004/06/12 01:27:26 reddawg + shared objects: yes we almost fully support shared objects + Revision 1.3 2004/05/21 15:20:00 reddawg Cleaned up diff --git a/src/sys/include/ubixos/sched.h b/src/sys/include/ubixos/sched.h index 00945e5..06496a6 100644 --- a/src/sys/include/ubixos/sched.h +++ b/src/sys/include/ubixos/sched.h @@ -96,9 +96,13 @@ /*** $Log$ + Revision 1.3 2004/05/21 15:49:13 reddawg + The os does better housekeeping now when a task is exited + Revision 1.2 2004/05/21 15:20:00 reddawg Cleaned up END - ***/ \ No newline at end of file + ***/ + diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 40cb6f6..6f1bee8 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -437,7 +437,7 @@ if (elfDynamicS[i].dynVal == 0x3) { tmp = (uInt32 *)elfDynamicS[i].dynPtr; tmp[2] = (uInt32) &_ld; - tmp[1] = tmpFd;//0xDEADBEEF;//elfDynamicS[i].dynPtr; + tmp[1] = (uInt32)tmpFd;//0xDEADBEEF;//elfDynamicS[i].dynPtr; // kprintf("[0x%X][0x%X]\n",argv,argc); } } @@ -465,6 +465,9 @@ /*** $Log$ + Revision 1.17 2004/06/12 01:27:26 reddawg + shared objects: yes we almost fully support shared objects + Revision 1.16 2004/06/10 13:08:00 reddawg Minor Bug Fixes diff --git a/src/sys/kernel/ld.c b/src/sys/kernel/ld.c index 2ceb6fb..0c3de77 100644 --- a/src/sys/kernel/ld.c +++ b/src/sys/kernel/ld.c @@ -54,77 +54,62 @@ char *shStr = 0x0; char *dynStr = 0x0; fileDescriptor *tmpFd = (fileDescriptor *)got2; - elfHeader *binaryHeader = 0x0; elfSectionheader *sectionHeader = 0x0; - elfPltInfo *elfRel = 0x0; elfDynSym *relSymTab = 0x0; + elfPltInfo *elfRel = 0x0; + elfHeader *binaryHeader = 0x0; - fseek(tmpFd,0x0,0x0); + if (binaryHeader == 0x0) { + fseek(tmpFd,0x0,0x0); + binaryHeader = (elfHeader *)kmalloc(sizeof(elfHeader)); + fread(binaryHeader,sizeof(elfHeader),1,tmpFd); + } - binaryHeader = (elfHeader *)kmalloc(sizeof(elfHeader)); - fread(binaryHeader,sizeof(elfHeader),1,tmpFd); + if (sectionHeader == 0x0) { + sectionHeader = (elfSectionheader *)kmalloc(sizeof(elfSectionheader)*binaryHeader->eShnum); + fseek(tmpFd,binaryHeader->eShoff,0); + fread(sectionHeader,sizeof(elfSectionheader),binaryHeader->eShnum,tmpFd); + } + if (shStr == 0x0) { + shStr = (char *)kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize); + fseek(tmpFd,sectionHeader[binaryHeader->eShstrndx].shOffset,0); + fread(shStr,sectionHeader[binaryHeader->eShstrndx].shSize,1,tmpFd); + } - //kprintf("[0x%X][0x%X]\n",got2,entry); - - //kprintf("binaryHeader->eType: [%i]\n",binaryHeader->eType); - //kprintf("binaryHeader->eEntry: [0x%X]\n",binaryHeader->eEntry); - - sectionHeader = (elfSectionheader *)kmalloc(sizeof(elfSectionheader)*binaryHeader->eShnum); - fseek(tmpFd,binaryHeader->eShoff,0); - fread(sectionHeader,sizeof(elfSectionheader),binaryHeader->eShnum,tmpFd); - - shStr = (char *)kmalloc(sectionHeader[binaryHeader->eShstrndx].shSize); - fseek(tmpFd,sectionHeader[binaryHeader->eShstrndx].shOffset,0); - fread(shStr,sectionHeader[binaryHeader->eShstrndx].shSize,1,tmpFd); - - //kprintf("1"); for (i=0x0;ieShnum;i++) { switch (sectionHeader[i].shType) { case 3: if (!kstrcmp((shStr + sectionHeader[i].shName),".dynstr")) { - dynStr = (char *)kmalloc(sectionHeader[i].shSize); - fseek(tmpFd,sectionHeader[i].shOffset,0); - fread(dynStr,sectionHeader[i].shSize,1,tmpFd); + if (dynStr == 0x0) { + dynStr = (char *)kmalloc(sectionHeader[i].shSize); + fseek(tmpFd,sectionHeader[i].shOffset,0); + fread(dynStr,sectionHeader[i].shSize,1,tmpFd); + } } break; case 9: rel = i; break; case 11: - //kprintf("Dynamic Sym\n"); - relSymTab = (elfDynSym *)kmalloc(sectionHeader[i].shSize); - fseek(tmpFd,sectionHeader[i].shOffset,0); - fread(relSymTab,sectionHeader[i].shSize,1,tmpFd); + if (relSymTab == 0x0) { + relSymTab = (elfDynSym *)kmalloc(sectionHeader[i].shSize); + fseek(tmpFd,sectionHeader[i].shOffset,0); + fread(relSymTab,sectionHeader[i].shSize,1,tmpFd); + } break; } } - //kprintf(".rel.plt: (%i)\n",rel); - fseek(tmpFd,sectionHeader[rel].shOffset,0x0); - elfRel = (elfPltInfo *)kmalloc(sectionHeader[rel].shSize); - fread(elfRel,sectionHeader[rel].shSize,1,tmpFd); + if (elfRel == 0x0) { + fseek(tmpFd,sectionHeader[rel].shOffset,0x0); + elfRel = (elfPltInfo *)kmalloc(sectionHeader[rel].shSize); + fread(elfRel,sectionHeader[rel].shSize,1,tmpFd); + } i = (entry/sizeof(elfPltInfo)); - - //for (i=0x0;istate = DEAD; - //schedYield(); return(i); } @@ -138,6 +123,7 @@ char *shStr = 0x0; char *dynStr = 0x0; char *binary = 0x0; + char *output = 0x0; elfHeader *binaryHeader = 0x0; elfProgramheader *programHeader = 0x0; elfSectionheader *sectionHeader = 0x0; @@ -150,6 +136,7 @@ tmpFd = fopen("libc.so","rb"); binary = (char *)kmalloc(tmpFd->size); + output = (char *)kmalloc((tmpFd->size+0x4000)); fread(binary,tmpFd->size,1,tmpFd); fclose(tmpFd); @@ -159,6 +146,18 @@ shStr = (char *)(binary + sectionHeader[binaryHeader->eShstrndx].shOffset); + for (i=0;iePhnum;i++) { + switch (programHeader[i].phType) { + case 1: + case 2: + kmemcpy((output+programHeader[i].phVaddr),(binary + programHeader[i].phOffset),programHeader[i].phFilesz); + break; + default: + kprintf("Unhandled Header\n"); + break; + } + } + for (i=0x0;ieShnum;i++) { switch (sectionHeader[i].shType) { case 3: @@ -181,16 +180,16 @@ for (i=0x0;i #include #include +#include #define FP_TO_LINEAR(seg, off) ((void*) ((((uInt16) (seg)) << 4) + ((uInt16) (off)))) @@ -465,6 +466,9 @@ /*** $Log$ + Revision 1.9 2004/06/04 10:19:42 reddawg + notes: we compile again, thank g-d anyways i was about to cry + Revision 1.8 2004/05/21 16:04:32 reddawg Typo i hate working in windows then test compiling later diff --git a/src/sys/vfs/file.c b/src/sys/vfs/file.c index c2c2e26..97e4131 100644 --- a/src/sys/vfs/file.c +++ b/src/sys/vfs/file.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.3 2004/06/01 00:04:53 reddawg + Try now mark + Revision 1.2 2004/05/19 04:07:43 reddawg kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been @@ -47,6 +50,7 @@ #include #include #include +#include diff --git a/src/sys/vmm/memory.c b/src/sys/vmm/memory.c index df4595f..ca479f1 100644 --- a/src/sys/vmm/memory.c +++ b/src/sys/vmm/memory.c @@ -135,7 +135,7 @@ if (memCount == -1) memCount = 0; memCount += 1024 * 1024; - mem = (unsigned long *)memCount; + mem = (uInt32 *)memCount; tempMemory = *mem; *mem = 0x55AA55AA; asm("": : :"memory"); @@ -321,6 +321,9 @@ /*** $Log$ + Revision 1.5 2004/05/21 15:34:23 reddawg + Fixed a couple of typo + Revision 1.4 2004/05/21 14:50:10 reddawg Cleaned up diff --git a/src/tools/Makefile b/src/tools/Makefile index bb653ed..d5b4d18 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -49,7 +49,7 @@ #(cp ../bin/format/format ./) (cp ../bin/ubistry/ubistry ./) (cp ../sys/boot/mbr/mbr ./) - (./format 50 2000 /dev/fd0 ubix.elf 0 login 3754 ROM8X14.DPF 3754 init 3754 ubistry 3754 shell 3754 userdb 3754 ls 3754 motd 3754 fdisk 3754 mbr 3754 cp 3754 clock 3754) + (./format 50 2000 /dev/fd0 ubix.elf 0 login 3754 ROM8X14.DPF 3754 init 3754 ubistry 3754 shell 3754 userdb 3754 ls 3754 motd 3754 fdisk 3754 mbr 3754 cp 3754 clock 3754 libc.so 3754) #(./format 263 204361 /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)