32 lines
798 B
C
32 lines
798 B
C
/*
|
|
* @author xamidev <xamidev@riseup.net>
|
|
* @brief Executable loader
|
|
* @license GPL-3.0-only
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
#include <fs/initfs.h>
|
|
#include <kernel.h>
|
|
#include <sched/process.h>
|
|
#include <io/kbd/ps2.h>
|
|
#include <string/string.h>
|
|
|
|
extern void* archive_start_addr;
|
|
|
|
int loader_load_raw()
|
|
{
|
|
char input_buf[PEDICEL_INPUT_SIZE] = {0};
|
|
do {
|
|
printf("file> ");
|
|
keyboard_getline(input_buf, PEDICEL_INPUT_SIZE);
|
|
} while (strncmp(input_buf, "", 1) == 0);
|
|
|
|
char* data = NULL;
|
|
int sz = tar_lookup(archive_start_addr, input_buf,&data);
|
|
if (sz > 0) {
|
|
process_create_user_raw(data, sz, input_buf);
|
|
return 0; // TODO: should return something else on error
|
|
}
|
|
printf("Couldn't load file '%s'\r\n", input_buf);
|
|
return 1;
|
|
} |