diff options
| author | Miguel <m.i@gmx.at> | 2018-09-12 16:04:15 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-12 16:04:15 +0200 |
| commit | bcd07d2b3161364fbffa42d0d9752a1f6581b713 (patch) | |
| tree | 47b8ef39c5c3962cd849493737adb3a8c5b095c3 | |
| parent | c72944b5646863ffaaaff94dc03b939a08566203 (diff) | |
added support for .S
| -rw-r--r-- | Makefile | 13 | ||||
| -rw-r--r-- | asm/asm_usermode.S | 5 | ||||
| -rw-r--r-- | kernel/exceptions.c | 2 | ||||
| -rw-r--r-- | kernel/kernel.h | 9 | ||||
| -rw-r--r-- | kernel/vmem.c | 10 | ||||
| -rw-r--r-- | userspace/init.c | 6 |
6 files changed, 30 insertions, 15 deletions
@@ -89,9 +89,17 @@ DEPS=$(patsubst %.c, %.d, $(SOURCES)) ASM_SOURCES=$(wildcard ./asm/*.asm) ASM_OBJECTS=$(patsubst %.asm, %.o, $(ASM_SOURCES)) + ASM_MULTIBOOT=$(wildcard ./asm/*.s) ASM_MULTIBOOT_OBJ=$(patsubst %.s, %.o, $(ASM_MULTIBOOT)) +ASM_MULTIBOOT2=$(wildcard ./asm/*.S) +ASM_MULTIBOOT_OBJ2=$(patsubst %.S, %.o, $(ASM_MULTIBOOT2)) + +ASM_OBJECTS+=$(ASM_MULTIBOOT_OBJ) +ASM_OBJECTS+=$(ASM_MULTIBOOT_OBJ2) + + #### BINARIES AND SUBMODULES ######## FOOLOS_ISO=FoolOS.iso @@ -136,7 +144,8 @@ $(CLEANDIRS): ############ linking kernel binary ############ -$(KERNEL_IMG): $(ASM_MULTIBOOT_OBJ) $(ASM_OBJECTS) $(OBJECTS) +$(KERNEL_IMG): $(ASM_OBJECTS) $(OBJECTS) + @echo "linking kernel..." $(CC) $(CFLAGS) $(LDFLAGS) -T linker.ld -o $@ $^ $(LDLIBS) ############ assembling of final image ############ @@ -196,7 +205,7 @@ stop-qemu: ############ cleanup ############ clean: $(CLEANDIRS) - @echo "Cleaning..."; rm -f *.bin $(FOOLOS) $(FOOLOS_ISO) $(FOOLOS_VDI) $(KERNEL_ENTRY) $(ASM_MULTIBOOT_OBJ) $(KERNEL_IMG) $(ASM_OBJECTS) $(OBJECTS) $(IMG_FILLUP) $(BIN_MBR) $(BIN_MP) $(BIN_STAGE2) $(DEPS) bochs.out bochs.log ne2k-tx.log ne2k-txdump.txt tags grubiso/boot/foolos.bin grubiso/boot/ext2.img + @echo "Cleaning..."; rm -f *.bin $(FOOLOS) $(FOOLOS_ISO) $(FOOLOS_VDI) $(KERNEL_ENTRY) $(KERNEL_IMG) $(ASM_OBJECTS) $(OBJECTS) $(IMG_FILLUP) $(BIN_MBR) $(BIN_MP) $(BIN_STAGE2) $(DEPS) bochs.out bochs.log ne2k-tx.log ne2k-txdump.txt tags grubiso/boot/foolos.bin grubiso/boot/ext2.img @echo "Cleaning Documentation..."; rm -f ./doc/ -r tags: diff --git a/asm/asm_usermode.S b/asm/asm_usermode.S index a07f480..72f80dc 100644 --- a/asm/asm_usermode.S +++ b/asm/asm_usermode.S @@ -1,3 +1,5 @@ +#include "../kernel/kernel.h" + .global asm_usermode asm_usermode: @@ -20,8 +22,7 @@ asm_usermode: mov %esp, %eax pushl $0x23 // user data segment - //pushl $0x8fff000-3*32 //%eax // current stack - pushl $0xe0000000-3*32 //%eax // current stack (3 values will be poped) we subst 4 to align + pushl $VMEM_USER_STACK_TOP-4*32 //(3 values will be poped on _start) we subst 4 to align pushf // // http://x86.renejeschke.de/html/file_module_x86_id_145.html diff --git a/kernel/exceptions.c b/kernel/exceptions.c index f56536b..bcb5c40 100644 --- a/kernel/exceptions.c +++ b/kernel/exceptions.c @@ -1,5 +1,6 @@ #include "kernel.h" #include "exceptions.h" +#include "scheduler.h" #include "log.h" #include "asm_x86.h" @@ -39,6 +40,7 @@ void exception_handle(uint32_t esp, uint32_t irq) uint32_t error_code=0; klog("EXCEPTION: apicID: 0x%08X",apic_id()); + klog("EXCEPTION: task: %d",task_get_current_pid()); klog("EXCEPTION: vector nr.: %d",irq); switch(irq){ //this interrupts push also an error_code diff --git a/kernel/kernel.h b/kernel/kernel.h index 1da1209..df8432a 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -54,18 +54,15 @@ REFERENCES #define VMEM_USER_ENV 0x07000000 // ? pages / per user process #define VMEM_USER_PROG 0x08048000 // ? pages / per user process (usual entry: 0x8048080) -#define VMEM_USER_STACK_PAGES 0xF0000000 // 4 pages / per thread -#define VMEM_USER_STACK_BOT 0xEFFFC000 // 4 pages / per thread +#define VMEM_USER_STACK_PAGES 4 // 4 pages / per thread #define VMEM_USER_STACK_TOP 0xF0000000 // 4 pages / per thread #define VMEM_LAPIC 0xF0005000 // 1 pages / identity mapped #define VMEM_IOAPIC 0xF0006000 // 1 pages / identity mapped #define VMEM_CPU_PRIVATE 0xF000A000 // 4 pages / per cpu -#define VMEM_CPU_STACK_PAGES 0xF0000000 // 4 pages / per thread -#define VMEM_CPU_STACK_BOT 0xF0050000 // 4 pages / per cpu -#define VMEM_CPU_STACK_TOP 0xF0054000 // 4 pages / per cpu - +#define VMEM_CPU_STACK_PAGES 4 // 4 pages / per thread +#define VMEM_CPU_STACK_TOP 0xF4000000 // 4 pages / per cpu #define VMEM_COPY_PAGE 0xF5000000 // 1 page / temporery map-in tables for copying #define VMEM_FRAMEBUFFER 0xF6000000 // 8192 pages (32megs) / identity mapped diff --git a/kernel/vmem.c b/kernel/vmem.c index 10c2401..ffa9099 100644 --- a/kernel/vmem.c +++ b/kernel/vmem.c @@ -303,10 +303,10 @@ pdirectory* vmem_kernel_dir() vmem_add_remap(dir,mod_start,VMEM_EXT2_RAMIMAGE,1024*8,false);//32megs for ramimage: TODO: check if enough? vmem_add_alloc(dir,VMEM_CPU_PRIVATE,4,false); - vmem_add_alloc(dir,VMEM_CPU_STACK_BOT,4,false); + vmem_add_alloc(dir,VMEM_CPU_STACK_TOP-4096*VMEM_CPU_STACK_PAGES,VMEM_CPU_STACK_PAGES,false); - vmem_add_alloc(dir,VMEM_USER_PROG,1024*2,true); - vmem_add_alloc(dir,VMEM_USER_STACK_TOP-4096*10,10,true); + vmem_add_alloc(dir,VMEM_USER_PROG,1024*4,true); + vmem_add_alloc(dir,VMEM_USER_STACK_TOP-4096*VMEM_USER_STACK_PAGES,VMEM_USER_STACK_PAGES,true); return dir; } @@ -321,8 +321,8 @@ pdirectory* vmem_new_space_dir(pdirectory *copy_dir,bool stack_only) if(!pt_entry_is_user(src_pt))dir->m_entries [i]=src_pt; } - vmem_add_alloc(dir,VMEM_USER_PROG,1024*2,true); - vmem_add_alloc(dir,VMEM_USER_STACK_TOP-4096*4,4,true); + vmem_add_alloc(dir,VMEM_USER_PROG,1024*4,true); + vmem_add_alloc(dir,VMEM_USER_STACK_TOP-4096*VMEM_USER_STACK_PAGES,VMEM_USER_STACK_PAGES,true); x86_cli(); // plese dear timer, do not schedule us away pdirectory* orig=x86_get_page_directory(); diff --git a/userspace/init.c b/userspace/init.c index bd72ecf..7e58589 100644 --- a/userspace/init.c +++ b/userspace/init.c @@ -21,8 +21,13 @@ int main(int argc, char **argv) printf("fool-init: pid: %i\n",pid); int status; + if(pid==1) + { + printf("fool-init: pid: %i\n",pid); + } if(pid==0) { + printf("fool-init: pid: %i\n",pid); _execve("/bin/foolshell",argv1,env1); // replace process with our foolshell :) //execve("/bin/clear",argv,env); // replace process with our foolshell :) puts("FATAL ERROR: Something terrible happened. Unable to Execute SHELL!"); @@ -31,6 +36,7 @@ int main(int argc, char **argv) // wait until our child process state changes (exits) // and respawn SHELL + while(1); _wait(&status); printf("fool-init: catched exit of process %d.\n",pid); |
