mirror of
https://github.com/drasko/codezero.git
synced 2026-03-15 08:41:50 +01:00
Added means to search for threads in other containers
Thread ids now contain their container ids in the top 2 nibbles. Threads on other containers can be addressed by changing those two nibbles. The addressing of inter-container threads are subject to capabilities.
This commit is contained in:
@@ -19,7 +19,6 @@ struct task_ids {
|
||||
l4id_t tid;
|
||||
l4id_t spid;
|
||||
l4id_t tgid;
|
||||
l4id_t cid;
|
||||
};
|
||||
|
||||
static inline void *
|
||||
|
||||
@@ -96,9 +96,9 @@ struct tcb {
|
||||
char name[16];
|
||||
|
||||
/* Task ids */
|
||||
int tid;
|
||||
int spid;
|
||||
int tgid;
|
||||
l4id_t tid;
|
||||
l4id_t spid;
|
||||
l4id_t tgid;
|
||||
|
||||
/* Related task ids */
|
||||
unsigned int pagerid; /* Task's pager */
|
||||
|
||||
@@ -195,7 +195,7 @@ void handle_requests(void)
|
||||
void main(void)
|
||||
{
|
||||
|
||||
printf("\n%s: Started with thread id %d\n", __TASKNAME__, self_tid());
|
||||
printf("\n%s: Started with thread id %x\n", __TASKNAME__, self_tid());
|
||||
|
||||
init();
|
||||
|
||||
|
||||
@@ -446,7 +446,7 @@ int task_copy_args_to_user(char *user_stack,
|
||||
{
|
||||
char **argv_start, **envp_start;
|
||||
|
||||
BUG_ON((unsigned long)user_stack & 7);
|
||||
BUG_ON(!is_aligned(user_stack, 8));
|
||||
|
||||
/* Copy argc */
|
||||
*((int *)user_stack) = args->argc;
|
||||
@@ -508,12 +508,18 @@ int task_map_stack(struct vm_file *f, struct exec_file_desc *efd,
|
||||
struct tcb *task, struct args_struct *args,
|
||||
struct args_struct *env)
|
||||
{
|
||||
/* First set up task's stack markers */
|
||||
unsigned long stack_used = align_up(args->size + env->size + 8, 8);
|
||||
unsigned long stack_used;
|
||||
unsigned long arg_pages = __pfn(page_align_up(stack_used));
|
||||
char *args_on_stack;
|
||||
void *mapped;
|
||||
|
||||
/*
|
||||
* Stack contains: args, environment, argc integer,
|
||||
* 2 Null integers as terminators.
|
||||
*
|
||||
* It needs to be 8-byte aligned also.
|
||||
*/
|
||||
stack_used = align_up(args->size + env->size + sizeof(int) * 3 + 8, 8);
|
||||
task->stack_end = __pfn_to_addr(cont_mem_regions.task->end);
|
||||
task->stack_start = __pfn_to_addr(cont_mem_regions.task->end) - DEFAULT_STACK_SIZE;
|
||||
task->args_end = task->stack_end;
|
||||
|
||||
@@ -31,7 +31,7 @@ l4id_t pagerid;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
printf("\n%s: Started with thread id %d\n", __TASKNAME__, getpid());
|
||||
printf("\n%s: Started with thread id %x\n", __TASKNAME__, getpid());
|
||||
|
||||
parent_of_all = getpid();
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
||||
/* Compare two pid strings. We use strings because we dont have atoi() */
|
||||
if (!strcmp(pidbuf, parent_of_all)) {
|
||||
printf("EXECVE TEST -- PASSED --\n");
|
||||
printf("\nThread (%d): Continues to sync with the pager...\n\n", getpid());
|
||||
printf("\nThread (%x): Continues to sync with the pager...\n\n", getpid());
|
||||
while (1)
|
||||
wait_pager(pagerid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user