diff --git a/src/Makefile b/src/Makefile index 08c31e9..07150ab 100644 --- a/src/Makefile +++ b/src/Makefile @@ -70,6 +70,7 @@ @echo "Step 2: Copy Libraries" @echo "***************************************************************" cp -pr build/lib/* ${ROOT}/lib/ + cp -pr build/libexec/* ${ROOT}/libexec/ sync @echo @echo "***************************************************************" diff --git a/src/bin/ld/Makefile b/src/bin/ld/Makefile index c9a6ba4..db85020 100644 --- a/src/bin/ld/Makefile +++ b/src/bin/ld/Makefile @@ -19,7 +19,7 @@ # Link The Binary $(OUTPUT) : $(OBJS) - $(CC) -m32 -nostdlib -shared -Wl,-soname,$(OUTPUT) -Wl,-m,elf_i386_fbsd -e _ld -o ../../build/bin/$(OUTPUT) $(OBJS) $(LIBRARIES) $(SUBS) + $(CC) -m32 -nostdlib -shared -Wl,-soname,$(OUTPUT) -Wl,-m,elf_i386_fbsd -e _ld -o ../../build/libexec/$(OUTPUT) $(OBJS) $(LIBRARIES) $(SUBS) # strip $(OUTPUT) # Compile the source files diff --git a/src/build/libexec/.gitignore b/src/build/libexec/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/src/build/libexec/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/src/sys/i386/i386_exec.c b/src/sys/i386/i386_exec.c index c5e3a84..78230d2 100644 --- a/src/sys/i386/i386_exec.c +++ b/src/sys/i386/i386_exec.c @@ -380,6 +380,7 @@ int i = 0x0; int x = 0x0; int argc = 0x0; + u_int32_t cr3 = 0x0; unsigned int *tmp = 0x0; //u_int32_t memAddr = 0x0; @@ -408,6 +409,8 @@ Elf_Auxargs *auxargs = 0x0; + asm("movl %%cr3, %0;" : "=r" (cr3)); + fd = fopen( file, "r" ); /* If the file doesn't exist fail */ @@ -617,7 +620,8 @@ */ //! Clean the virtual of COW pages left over from the fork - vmm_cleanVirtualSpace( (u_int32_t) _current->td.vm_daddr + (_current->td.vm_dsize << PAGE_SHIFT) ); +//MrOlsen 2017-12-15 - FIX! - This should be done before it was causing a lot of problems why did I free space after loading binary???? + //vmm_cleanVirtualSpace( (u_int32_t) _current->td.vm_daddr + (_current->td.vm_dsize << PAGE_SHIFT) ); //! Adjust iframe // iFrame = (struct i386_frame *) (_current->tss.esp0 - sizeof(struct i386_frame)); @@ -722,7 +726,10 @@ "ljmp $0x20,$0\n" ); */ - kprintf( "EBP-4(%i): [0x%X], EBP: [0x%X], EIP: [0x%X], ESP: [0x%X]\n", _current->id, _current->oInfo.vmStart, iFrame->ebp, iFrame->eip, iFrame->user_esp ); + tmp = (char *)iFrame->eip; + + kprintf("N:[0x%X]\n", tmp[0]); + kprintf( "EBP-4(%i): [0x%X], EBP: [0x%X], EIP: [0x%X], ESP: [0x%X], CR3: [0x%X-0x%X]\n", _current->id, _current->oInfo.vmStart, iFrame->ebp, iFrame->eip, iFrame->user_esp, cr3, kernelPageDirectory ); return (0x0); } diff --git a/src/sys/kernel/ld.c b/src/sys/kernel/ld.c index d3df83b..a320370 100644 --- a/src/sys/kernel/ld.c +++ b/src/sys/kernel/ld.c @@ -55,7 +55,7 @@ elfPltInfo *elfRel = 0x0; /* Open our dynamic linker */ - ldFd = fopen("sys:/lib/ld.so","rb"); + ldFd = fopen("sys:/libexec/ld.so","rb"); if (ldFd == 0x0) { kprintf("Can not open ld.so\n");