diff --git a/src/bin/edit/main.c b/src/bin/edit/main.c index 1b9a3eb..15b0426 100644 --- a/src/bin/edit/main.c +++ b/src/bin/edit/main.c @@ -32,8 +32,6 @@ int main(int argc,char **argv) { FILE *out; - int offset; - extern char **environ; printf("UbixOS Text Editor\n"); printf("V1.0\n"); @@ -42,13 +40,6 @@ while (!feof(out)) { printf("%c",fgetc(out)); } - printf("[0x%X:0x%X]\n",environ,offset); - __findenv("term",&offset); - printf("[0x%X:0x%X]\n",environ,offset); - putenv("bryce=good"); - printf("[%s]\n",getenv("bryce")); - printf("[0x%X:0x%X]\n",environ,offset); - printf("The End\n"); return(0); } diff --git a/src/bin/ld/addlibrary.c b/src/bin/ld/addlibrary.c index 07884d6..409a9c8 100644 --- a/src/bin/ld/addlibrary.c +++ b/src/bin/ld/addlibrary.c @@ -34,7 +34,9 @@ } sprintf(tmpLib->name,lib); } + #ifdef DEBUG printf("Base: {0x%X}\n",tmpLib->output); + #endif if (tmpLib->linkerHeader == 0x0) { fseek(linkerFd,0x0,0x0); if ((tmpLib->linkerHeader = (elfHeader *)malloc(sizeof(elfHeader))) == 0x0) { @@ -150,13 +152,34 @@ } } } -printf("Looking For Environ: [%i]\n\n",tmpLib->linkerSectionHeader[tmpLib->sym].shSize/sizeof(elfDynSym)); +//printf("Looking For Environ: [%i]\n\n",tmpLib->linkerSectionHeader[tmpLib->sym].shSize/sizeof(elfDynSym)); /* Sync environ __progname */ for (i=0x0;ilinkerSectionHeader[tmpLib->sym].shSize/sizeof(elfDynSym);i++) { if (!strcmp("environ",(tmpLib->linkerDynStr + tmpLib->linkerRelSymTab[i].dynName))) { funcPtr = (uInt32 *)((uInt32)(tmpLib->linkerRelSymTab[i].dynValue) + (uInt32)tmpLib->output); - *funcPtr = 0x0; - printf("[envion:0x%X:0x%X]\n",funcPtr,*funcPtr); + //printf("[envion:0x%X:0x%X]\n",funcPtr,*funcPtr); + for (x = 0x0;x < binarySectionHeader[binarySym].shSize/sizeof(elfDynSym);x++) { + if (!strcmp("environ",(binaryDynStr + binaryRelSymTab[x].dynName))) { + *funcPtr = (uInt32 *)((uInt32)(binaryRelSymTab[x].dynValue));// + (uInt32)tmpLib->output); + //printf("[envion:0x%X:0x%X]\n",funcPtr,*funcPtr); + } + } + //break; + } + } + +//printf("Looking For __progname: [%i]\n\n",tmpLib->linkerSectionHeader[tmpLib->sym].shSize/sizeof(elfDynSym)); + /* Sync environ __progname */ + for (i=0x0;ilinkerSectionHeader[tmpLib->sym].shSize/sizeof(elfDynSym);i++) { + if (!strcmp("__progname",(tmpLib->linkerDynStr + tmpLib->linkerRelSymTab[i].dynName))) { + funcPtr = (uInt32 *)((uInt32)(tmpLib->linkerRelSymTab[i].dynValue) + (uInt32)tmpLib->output); + //printf("[__progname:0x%X:0x%X]\n",funcPtr,*funcPtr); + for (x = 0x0;x < binarySectionHeader[binarySym].shSize/sizeof(elfDynSym);x++) { + if (!strcmp("__progname",(binaryDynStr + binaryRelSymTab[x].dynName))) { + *funcPtr = (uInt32 *)((uInt32)(binaryRelSymTab[x].dynValue));// + (uInt32)tmpLib->output); + //printf("[__progname:0x%X:0x%X]\n",funcPtr,*funcPtr); + } + } //break; } } diff --git a/src/bin/ld/findfunc.c b/src/bin/ld/findfunc.c index f68d521..314cf8c 100644 --- a/src/bin/ld/findfunc.c +++ b/src/bin/ld/findfunc.c @@ -7,7 +7,7 @@ int x = 0x0; uInt32 *funcPtr = 0x0; ldLibrary *libPtr = 0x0; - + for (x = 0; x < lib_c;x++) { libPtr = ldFindLibrary(lib + lib_s[x]); if (libPtr == 0x0) { diff --git a/src/bin/ld/ld.h b/src/bin/ld/ld.h index 0255e4d..9159bbf 100644 --- a/src/bin/ld/ld.h +++ b/src/bin/ld/ld.h @@ -20,6 +20,10 @@ extern ldLibrary *libs; extern int lib_c; extern int lib_s[10]; +extern int binarySym; +extern elfSectionHeader *binarySectionHeader; +extern char *binaryDynStr; +extern elfDynSym *binaryRelSymTab; uInt32 ldFindFunc(const char *,const char *); ldLibrary *ldFindLibrary(const char *); diff --git a/src/bin/ld/main.c b/src/bin/ld/main.c index de1980b..276588d 100644 --- a/src/bin/ld/main.c +++ b/src/bin/ld/main.c @@ -35,12 +35,13 @@ ldLibrary *libs = 0x0; int lib_c = 0x0; int lib_s[10]; +int binarySym = 0x0; static elfHeader *binaryHeader = 0x0; -static elfSectionHeader *binarySectionHeader = 0x0; +elfSectionHeader *binarySectionHeader = 0x0; static char *binaryShStr = 0x0; -static char *binaryDynStr = 0x0; -static elfDynSym *binaryRelSymTab = 0x0; +char *binaryDynStr = 0x0; +elfDynSym *binaryRelSymTab = 0x0; static Elf32_Dyn *binaryElf32_Dyn = 0x0; static elfPltInfo *binaryElfRelDyn = 0x0; static elfPltInfo *binaryElfRel = 0x0; @@ -106,6 +107,7 @@ binaryRelSymTab = (elfDynSym *)malloc(binarySectionHeader[i].shSize); fseek(binaryFd,binarySectionHeader[i].shOffset,0); fread(binaryRelSymTab,binarySectionHeader[i].shSize,1,binaryFd); + binarySym = i; } break; } diff --git a/src/bin/shell/commands.c b/src/bin/shell/commands.c index 9e24fd2..63a1480 100644 --- a/src/bin/shell/commands.c +++ b/src/bin/shell/commands.c @@ -44,7 +44,9 @@ mpi_message_t cmdMsg; +#ifdef DEBUG printf("WEST\n\n"); +#endif if (data == NULL) return 1; if (data->args->arg == NULL) return 1; diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 2d8e8ec..0c2fb11 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -101,9 +101,11 @@ /* Do A Clear Screen Just To Make The TEXT Buffer Nice And Empty */ clearScreen(); + #ifdef DEBUG kprint("AAA"); kprint("BBB"); -kprintf("TEST"); + kprintf("TEST"); + #endif /* Modify src/sys/include/ubixos/init.h to add a startup routine */ for (i=0x0;iid > 4) kprintf("argv[0]: [%s]\n",argv[0]); kprintf("argv: [0x%X]\n",argv); + */ tmp[0] = (u_int32_t)argv; tmp[1] = (u_int32_t)argv; @@ -448,7 +451,9 @@ kpanic("Error: vmm_setPageAttributes failed, File: %s,Line: %i\n",__FILE__,__LINE__); } } + #ifdef DEBUG kprintf("setting daddr\n"); + #endif if (binaryHeader->eEntry >= programHeader[i].phVaddr && binaryHeader->eEntry < (programHeader[i].phVaddr + programHeader[i].phMemsz)) { /* We're suposed to do something here? */ } @@ -469,7 +474,9 @@ interp = (char *)kmalloc(programHeader[i].phFilesz); fseek(tmpFd,programHeader[i].phOffset,0); fread((void *)interp,programHeader[i].phFilesz,1,tmpFd); + #ifdef DEBUG kprintf("Interp: [%s]\n",interp); + #endif ldAddr = ldEnable(); break; default: @@ -504,7 +511,8 @@ if (argv[1] != 0x0) { argc = argv[0]; args = (char *)vmmGetFreeVirtualPage(_current->id,1,VM_TASK); -memset(args,0x0,0x1000); + //! do we need this? + memset(args,0x0,0x1000); x = 0x0; argvNew = (char **)kmalloc(sizeof(char *) * argc); for (i = 0x0;i < argc;i++) { @@ -644,7 +652,9 @@ fseek(_current->imageFd,programHeader[i].phOffset,0); fread((void *)interp,programHeader[i].phFilesz,1,_current->imageFd); + #ifdef DEBUG kprintf("Interp: [%s]\n",interp); + #endif //ldAddr = ldEnable(); break; case PT_PHDR: @@ -696,7 +706,9 @@ //if (_current->id > 3) { iFrame->user_esp = ((u_int32_t)STACK_ADDR) - (sizeof(u_int32_t) * (argc + 4 + (sizeof(Elf_Auxargs) * 2))); + #ifdef DEBUG kprintf("\n\n\nuser_esp: [0x%X]\n",iFrame->user_esp); + #endif tmp = iFrame->user_esp; //! build argc and argv[] @@ -710,9 +722,13 @@ strcpy(args,"LIBRARY_PATH=/lib"); tmp[argc + 2] = args; + #ifdef DEBUG kprintf("env: [0x%X][0x%X]\n",(uInt32)tmp + argc + 2,tmp[argc + 2]); + #endif tmp[argc + 3] = 0x0; + #ifdef DEBUG kprintf("env: [0x%X][0x%X]\n",(uInt32)tmp + argc + 2,tmp[argc + 2]); + #endif tmp = iFrame->user_esp; tmp += argc + 4; @@ -737,7 +753,9 @@ AUXARGS_ENTRY(tmp, AT_BASE, auxargs->base); AUXARGS_ENTRY(tmp, AT_NULL, 0); + #ifdef DEBUG kprintf("AT_BASE: [0x%X]\n",auxargs->base); + #endif return; } diff --git a/src/sys/kernel/gen_calls.c b/src/sys/kernel/gen_calls.c index 69f28d1..c9228ec 100644 --- a/src/sys/kernel/gen_calls.c +++ b/src/sys/kernel/gen_calls.c @@ -104,7 +104,8 @@ } int issetugid(register struct thread *td, struct issetugid_args *uap) { - #ifdef DEBUG + #ifdef NOTIMP + kprintf("Not Implimented: issetugid\n"); kprintf("[%s:%i]",__FILE__,__LINE__); #endif td->td_retval[0] = 0; @@ -112,17 +113,18 @@ } int readlink(struct thread *td,struct readlink_args *uap) { - #ifdef DEBUG + #ifdef NOTIMP kprintf("[%s:%i]",__FILE__,__LINE__); - #endif kprintf("readlink: [%s:%i]\n",uap->path,uap->count); + #endif td->td_retval[0] = -1; td->td_retval[1] = 0x0; return(0x0); } int gettimeofday_new(struct thread *td, struct gettimeofday_args *uap) { - #ifdef DEBUG + #ifdef NOTIMP + kprintf("Not Implimented: gettimeofday\n"); kprintf("[%s:%i]",__FILE__,__LINE__); #endif return(0x0); @@ -143,7 +145,9 @@ return(error); count = fread(uap->buf,uap->nbyte,0x1,fd->fd); + #ifdef DEBUG kprintf("count: %i\n",count); + #endif td->td_retval[0] = count; return(error); @@ -155,17 +159,34 @@ int setitimer(struct thread *td, struct setitimer_args *uap) { int error = 0x0; + #ifdef NOTIMP + kprintf("Not Implimented: setitimer\n"); + kprintf("[%s:%i]",__FILE__,__LINE__); + #endif + return(error); } int access(struct thread *td, struct access_args *uap) { int error = 0x0; + + #ifdef NOTIMP + kprintf("Not Implimented: access\n"); kprintf("name: [%s]\n",uap->path); + kprintf("[%s:%i]",__FILE__,__LINE__); + #endif + return(error); } int mprotect(struct thread *td, struct mprotect_args *uap) { int error = 0x0; + + #ifdef NOTIMP + kprintf("Not Implimented: mprotect\n"); + kprintf("[%s:%i]",__FILE__,__LINE__); + #endif + return(error); } diff --git a/src/sys/kernel/kern_descrip.c b/src/sys/kernel/kern_descrip.c index 1e69259..8c35d03 100644 --- a/src/sys/kernel/kern_descrip.c +++ b/src/sys/kernel/kern_descrip.c @@ -120,7 +120,9 @@ fp = (struct file *)_current->td.o_files[uap->fd]; uap->sb->st_mode = 0x2180; uap->sb->st_blksize = 0x1000; + #ifdef DEBUG kprintf("fstat: %i",uap->fd); + #endif return(0x0); } diff --git a/src/sys/vmm/getfreevirtualpage.c b/src/sys/vmm/getfreevirtualpage.c index b540059..f2dd047 100644 --- a/src/sys/vmm/getfreevirtualpage.c +++ b/src/sys/vmm/getfreevirtualpage.c @@ -62,8 +62,10 @@ if (type == VM_THRD) { start_page = (u_int32_t)(_current->td.vm_daddr + ctob(_current->td.vm_dsize)); -kprintf(".%i.",count); - //count--; + #ifdef DEBUG + kprintf(".%i.",count); + #endif + //count--; } else if (type == VM_TASK) { //kprintf("vmStart"); @@ -97,7 +99,9 @@ for (y = 0; y < 1024; y++) { /* Loop Through The Page Table Find An UnAllocated Page */ if ((pageTableSrc[y] & PAGE_COW) == PAGE_COW) { - kprintf("PAGE_COW"); + #ifdef DEBUG + kprintf("PAGE_COW-1"); + #endif //_current->td.vm_dsize += btoc(0x1000); /* HACK MEMORY LEAK */ //pageTableSrc[y] = 0x0; @@ -107,7 +111,9 @@ for (c = 0; c < count; c++) { if (y + c < 1024) { if ((pageTableSrc[y + c] & PAGE_COW) == PAGE_COW) { - kprintf("PAGE-COW"); + #ifdef DEBUG + kprintf("PAGE-COW-2"); + #endif //_current->td.vm_dsize += btoc(0x1000); /* HACK MEMORY LEAK */ //pageTableSrc[y + c] = 0x0; @@ -146,7 +152,9 @@ /* Return The Address Of The Newly Allocate Page */ if (type == VM_THRD) { _current->td.vm_dsize += btoc(count * 0x1000); + #ifdef DEBUG kprintf("vm_dsize: [0x%X]][0x%X]\n",ctob(_current->td.vm_dsize),_current->td.vm_dsize); + #endif } //kprintf("(0x%X:0x%X)",_current->td.vm_dsize,vmm_getPhysicalAddr(((x * (1024 * 4096)) + (y * 4096)))); // kprintf("(0x%X:0x%X)",_current->td.vm_dsize + _current->td.vm_daddr,((x * (1024 * 4096)) + (y * 4096))); @@ -262,7 +270,9 @@ /* Return The Address Of The Newly Allocate Page */ if (type == VM_THRD) { _current->td.vm_dsize += btoc(count * 0x1000); + #ifdef DEBUG kprintf("vm_dsize: [0x%X]][0x%X]\n",ctob(_current->td.vm_dsize),_current->td.vm_dsize); + #endif } //kprintf("(0x%X:0x%X)",_current->td.vm_dsize,vmm_getPhysicalAddr(((x * (1024 * 4096)) + (y * 4096)))); // kprintf("(0x%X:0x%X)",_current->td.vm_dsize + _current->td.vm_daddr,((x * (1024 * 4096)) + (y * 4096))); diff --git a/ubixos.kdevelop.filelist b/ubixos.kdevelop.filelist index 769a39c..9acda16 100644 --- a/ubixos.kdevelop.filelist +++ b/ubixos.kdevelop.filelist @@ -5,3 +5,5 @@ src/sys/lib/memset.c src/sys/vmm/paging.c src/sys/kernel/tty.c +src/sys/vmm/getfreevirtualpage.c +src/sys/kernel/exec.c diff --git a/ubixos.tag b/ubixos.tag new file mode 100644 index 0000000..75f8002 --- /dev/null +++ b/ubixos.tag @@ -0,0 +1,33 @@ + + + + source/ + /usr/home/reddawg/source/ + dir_2f6833183e11a676862fac1de6cae150.html + source/ubixos/ + + + source/ubixos/src/ + /usr/home/reddawg/source/ubixos/src/ + dir_3d6d6841ce8ac3bad8c136748e65d69e.html + source/ubixos/src/sys/ + + + source/ubixos/src/sys/ + /usr/home/reddawg/source/ubixos/src/sys/ + dir_0e1e38b6fa1863b2b041948ecf01aa5c.html + source/ubixos/src/sys/vmm/ + + + source/ubixos/ + /usr/home/reddawg/source/ubixos/ + dir_56b279d85c3afe0b8d71255a6e897a08.html + source/ubixos/src/ + + + source/ubixos/src/sys/vmm/ + /usr/home/reddawg/source/ubixos/src/sys/vmm/ + dir_96d0e72ad2cc1282ac64c105d7bb813a.html + paging.c + +