diff --git a/Makefile b/Makefile index 7b18303..ede899d 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,9 @@ iso: cp grubshit/caller katauos/katau/caller cp grubshit/callee katauos/katau/callee + cp grubshit/callee2 katauos/katau/callee2 + + cp grubshit/zsh katauos/katau/zsh sudo umount tmp/ grub-mkrescue -o boot.iso katauos/ diff --git a/include/kheap.h b/include/kheap.h index 9bb3a62..48c05dd 100644 --- a/include/kheap.h +++ b/include/kheap.h @@ -5,7 +5,7 @@ #include #define KHEAP_START 0xE0000000 // Start of kernel heap -#define KHEAP_INITIAL_SIZE 0x100000 // 1 MiB initial size +#define KHEAP_INITIAL_SIZE 0x400000 // 1 MiB initial size #define KHEAP_END (KHEAP_START + KHEAP_INITIAL_SIZE) #define KHEAP_PAGES (KHEAP_INITIAL_SIZE / PAGE_SIZE) diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index a213cbb..7ba8b2a 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -134,7 +134,7 @@ void kmain(unsigned int magic, unsigned int info) l9660_dir* dir = (l9660_dir*)malloc(sizeof(l9660_dir)); l9660_file* file = (l9660_file*)malloc(sizeof(l9660_file)); - follow_path("/bin/bash.", file, dir); + follow_path("/katau/core.", file, dir); exec_from_file(file, "."); diff --git a/src/tasking/exec_from_file.c b/src/tasking/exec_from_file.c index c3be57d..621f035 100644 --- a/src/tasking/exec_from_file.c +++ b/src/tasking/exec_from_file.c @@ -68,12 +68,20 @@ void exec_from_file(l9660_file* fs_file, const char* dirname) continue; } - int pages_needed = DivRoundUp(elf_phdr->p_memsz, 0x1000);//(elf_phdr->p_memsz / 0x1000) + 1; + uint32_t start_addr = elf_phdr->p_vaddr; + uint32_t end_addr = start_addr + elf_phdr->p_memsz; + + uint32_t start_page = start_addr & ~0xFFF; + uint32_t end_page = (end_addr - 1) & ~0xFFF; + + int pages_needed = ((end_page - start_page) / 0x1000) + 1; + + //int pages_needed = DivRoundUp(elf_phdr->p_memsz, 0x1000);//(elf_phdr->p_memsz / 0x1000) + 1; //debug_log("pages needed: %X\n", pages_needed); for(int j = 0; j < pages_needed; j++) { - uint32_t vaddr = (elf_phdr->p_vaddr & ~0xFFF) + j * 0x1000; + uint32_t vaddr = start_page + j * 0x1000; void* phys_addr = alloc_page(); debug_log("mapping 0x%X -> 0x%X\n", phys_addr, vaddr); @@ -131,7 +139,8 @@ void exec_from_file(l9660_file* fs_file, const char* dirname) *p_task1->cwd = dir; uint32_t brk_address = DivRoundUp(bss_end+1, 0x1000)*0x1000; + debug_log("initial brk address: 0x%X\n", brk_address); p_task1->brk = (void*)brk_address; asm volatile("sti"); -} \ No newline at end of file +} diff --git a/src/tasking/syscalls.c b/src/tasking/syscalls.c index c270350..2c0bb13 100644 --- a/src/tasking/syscalls.c +++ b/src/tasking/syscalls.c @@ -525,6 +525,11 @@ void handle_syscall(TrapFrame *tf) case 0x2d://brk tf->eax = sys_brk(tf); break; + + case 0x36://ioctl + debug_log("IOCTL WAS CALLED, FUCKFUCK!!!!\n"); + tf->eax = -38;//-ENOSYS + break; case 0xa2://nanosleep tf->eax = sys_nanosleep(tf); @@ -535,4 +540,4 @@ void handle_syscall(TrapFrame *tf) tf->eax = -1; break; } -} \ No newline at end of file +}