make exec_from_file take l9660_file* instead of a filename

This commit is contained in:
2025-09-23 20:13:34 +03:00
parent f697fab390
commit 2019f87b14
4 changed files with 19 additions and 15 deletions
+5
View File
@@ -54,12 +54,17 @@ image:
iso: iso:
mkdir -p tmp mkdir -p tmp
mkdir -p katauos mkdir -p katauos
mkdir -p katauos/katau/
sudo mount rootfs.iso9660 tmp/ sudo mount rootfs.iso9660 tmp/
sudo cp -R tmp/* katauos/ sudo cp -R tmp/* katauos/
sudo chown -R kali:kali katauos/ sudo chown -R kali:kali katauos/
cp katauos.bin grubshit/boot cp katauos.bin grubshit/boot
cp katauos.bin katauos/boot/ cp katauos.bin katauos/boot/
cp grubshit/boot/grub/grub.cfg katauos/boot/grub/grub.cfg cp grubshit/boot/grub/grub.cfg katauos/boot/grub/grub.cfg
cp grubshit/caller katauos/katau/caller
cp grubshit/callee katauos/katau/callee
sudo umount tmp/ sudo umount tmp/
grub-mkrescue -o boot.iso katauos/ grub-mkrescue -o boot.iso katauos/
+1 -1
View File
@@ -9,4 +9,4 @@
#define USER_STACK_SIZE 0x4000 // 16KB stack (4 pages) #define USER_STACK_SIZE 0x4000 // 16KB stack (4 pages)
#define USER_STACK_BOTTOM (USER_STACK_TOP - USER_STACK_SIZE) #define USER_STACK_BOTTOM (USER_STACK_TOP - USER_STACK_SIZE)
void exec_from_file(const char* filename, const char* dirname); void exec_from_file(l9660_file* fs_file, const char* dirname);
+1 -10
View File
@@ -136,16 +136,7 @@ void kmain(unsigned int magic, unsigned int info)
follow_path("/bin/bash.", file, dir); follow_path("/bin/bash.", file, dir);
////////////// exec_from_file(file, ".");
l9660_seek(file, L9660_SEEK_END, 0);
uint32_t file_size = l9660_tell(file);
debug_log("file_size: %X\n", file_size);
l9660_seek(file, L9660_SEEK_SET, 0);
free(file);
free(dir);
//////////////
exec_from_file("caller.", ".");
while(1) while(1)
{ {
+12 -4
View File
@@ -6,7 +6,7 @@
#include "../include/paging.h" #include "../include/paging.h"
#include "../include/task.h" #include "../include/task.h"
void exec_from_file(const char* filename, const char* dirname) void exec_from_file(l9660_file* fs_file, const char* dirname)
{ {
asm volatile("cli"); asm volatile("cli");
int err; int err;
@@ -22,13 +22,21 @@ void exec_from_file(const char* filename, const char* dirname)
uint32_t bss_start, bss_end; uint32_t bss_start, bss_end;
err = vsf_read_file_by_path(filename, &file, &dir); l9660_seek(fs_file, L9660_SEEK_END, 0);
uint32_t file_size = l9660_tell(fs_file);
debug_log("[exec_from_file] file_size: %X\n", file_size);
l9660_seek(fs_file, L9660_SEEK_SET, 0);
if(err != 0) file = (uint8_t*)malloc(file_size);
//err = vsf_read_file_by_path(filename, &file, &dir);
err = vfs_read_file(fs_file, file);
/*if(err != 0)
{ {
debug_log("read_file failed!\n");
return; return;
} }
*/
//debug_log("result: %X\n", result); //debug_log("result: %X\n", result);
//debug_log("buffer: %s\n", file); //debug_log("buffer: %s\n", file);