diff --git a/grubshit/caller.c b/grubshit/caller.c index 0cbb593..0fe2de1 100644 --- a/grubshit/caller.c +++ b/grubshit/caller.c @@ -18,7 +18,7 @@ int main() { // The first argument is the path to the executable // The second is the array of arguments // The third is the array of environment variables - execve("callee.", argv, envp); + execve("/katau/callee.", argv, envp); // This part of the code will only be reached if execve fails perror("execve failed"); diff --git a/include/vfs.h b/include/vfs.h index cbf3548..4f36dfd 100644 --- a/include/vfs.h +++ b/include/vfs.h @@ -19,7 +19,7 @@ size_t vfs_read_file_length(l9660_file *file, uint8_t* buffer, size_t length); void test_iso9660(); -int vsf_read_file_by_path(const char* path, uint8_t** buffer, l9660_dir* dir); +int vfs_read_file_by_path(const char* path, uint8_t** buffer); void follow_path(const char* path, l9660_file* file, l9660_dir* dir); #endif \ No newline at end of file diff --git a/src/fs/vfs.c b/src/fs/vfs.c index bc6b88f..39c85ff 100644 --- a/src/fs/vfs.c +++ b/src/fs/vfs.c @@ -191,18 +191,14 @@ void test_iso9660() } } -int vsf_read_file_by_path(const char* path, uint8_t** buffer, l9660_dir* dir) +int vfs_read_file_by_path(const char* path, uint8_t** buffer) { l9660_file* file = (l9660_file*)malloc(sizeof(l9660_file)); + l9660_dir* dir = (l9660_dir*)malloc(sizeof(l9660_dir)); l9660_status err; - err = l9660_openat(file, dir, path); - if (err != L9660_OK) - { - debug_log("read_file: err: 0x%X\n", err); - return err; - } + follow_path(path, file, dir); debug_log("HEHE %s\n", path); @@ -218,6 +214,7 @@ int vsf_read_file_by_path(const char* path, uint8_t** buffer, l9660_dir* dir) read = vfs_read_file(file, *buffer); free(file); + free(dir); debug_log("bytes read: 0x%X\n", read); return 0; diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index 7ba8b2a..b987675 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -131,12 +131,12 @@ void kmain(unsigned int magic, unsigned int info) mount_fs(); - l9660_dir* dir = (l9660_dir*)malloc(sizeof(l9660_dir)); - l9660_file* file = (l9660_file*)malloc(sizeof(l9660_file)); + l9660_dir dir; + l9660_file file; - follow_path("/katau/core.", file, dir); + follow_path("/katau/caller.", &file, &dir); - exec_from_file(file, "."); + exec_from_file(&file, "."); while(1) { diff --git a/src/tasking/syscalls.c b/src/tasking/syscalls.c index 2c0bb13..4b58a00 100644 --- a/src/tasking/syscalls.c +++ b/src/tasking/syscalls.c @@ -292,7 +292,7 @@ int sys_execve(TrapFrame *tf) { } uint8_t* file_buffer; - int err = vsf_read_file_by_path(filename, &file_buffer, root_dir); + int err = vfs_read_file_by_path(filename, &file_buffer); if (err != 0) { debug_log("execve: failed to read file '%s'\n", filename); return -1;