Add PIDs and Milestone 3 preparation

This commit is contained in:
Sparchatus 2022-03-25 15:51:38 +00:00
parent f46cf6d66a
commit 22401e4cb0
5 changed files with 16 additions and 1 deletions

View File

@ -6,5 +6,6 @@ bootdriver /armv8/sbin/boot_armv8_generic
cpudriver /armv8/sbin/cpu_a57_qemu loglevel=3 serial=0x9000000 logmask=128 cpudriver /armv8/sbin/cpu_a57_qemu loglevel=3 serial=0x9000000 logmask=128
module /armv8/sbin/init module /armv8/sbin/init
module /armv8/sbin/hello catch Aurel Jan Sandro module /armv8/sbin/hello catch Aurel Jan Sandro
module /armv8/sbin/memeater
# End of file, this needs to have a certain length... # End of file, this needs to have a certain length...

View File

@ -6,3 +6,4 @@ bootdriver /armv8/sbin/boot_armv8_generic
cpudriver /armv8/sbin/cpu_imx8x cpudriver /armv8/sbin/cpu_imx8x
module /armv8/sbin/init module /armv8/sbin/init
module /armv8/sbin/hello catch Aurel Jan Sandro module /armv8/sbin/hello catch Aurel Jan Sandro
module /armv8/sbin/memeater

View File

@ -25,6 +25,8 @@ struct spawninfo {
struct spawninfo *next; struct spawninfo *next;
struct capref dispatcher; // < dispatcher used to start/stop the child process struct capref dispatcher; // < dispatcher used to start/stop the child process
domainid_t pid; // < unique id for this domain
// Information about the binary // Information about the binary
char * binary_name; // Name of the binary char * binary_name; // Name of the binary

View File

@ -17,6 +17,8 @@ extern struct bootinfo *bi;
extern coreid_t my_core_id; extern coreid_t my_core_id;
struct spawninfo *spawn_process_list = NULL; struct spawninfo *spawn_process_list = NULL;
// TODO: handle "freeing" of PIDs in case we learn how to detect stopped child processes
domainid_t spawn_last_pid = 1;
@ -302,6 +304,11 @@ static errval_t spawn_serialize_vspace(struct spawninfo *si, struct paging_state
errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si, errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
domainid_t *pid) { domainid_t *pid) {
errval_t err; errval_t err;
if(spawn_last_pid == MAX_DOMAINID) {
return SPAWN_ERR_OUT_OF_PIDS;
}
// - Initialize the spawn_info struct // - Initialize the spawn_info struct
// TODO // TODO
@ -565,6 +572,10 @@ errval_t spawn_load_argv(int argc, char *argv[], struct spawninfo *si,
); );
if (err_is_fail(err)) return err_push(err, SPAWN_ERR_RUN); if (err_is_fail(err)) return err_push(err, SPAWN_ERR_RUN);
// Get a unique PID
si->pid = ++spawn_last_pid;
*pid = si->pid;
return SYS_ERR_OK; return SYS_ERR_OK;
} }

View File

@ -12,7 +12,7 @@
let let
-- Default list of modules to build/install -- Default list of modules to build/install
modules_common = [ "/sbin/" ++ f | f <- [ "init", "hello" modules_common = [ "/sbin/" ++ f | f <- [ "init", "hello", "memeater"
] ] ] ]
in in
[ [