mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Wrote the bits that would fill in arg/env info to first page of task stack.
This commit is contained in:
@@ -60,7 +60,7 @@ struct tcb {
|
||||
unsigned long args_end;
|
||||
|
||||
/* UTCB address */
|
||||
unsigned long utcb_addr;
|
||||
unsigned long utcb_address;
|
||||
|
||||
/* Virtual memory areas */
|
||||
struct list_head vm_area_list;
|
||||
|
||||
@@ -258,6 +258,20 @@ int is_env_arg_page(struct fault_data *fault)
|
||||
return fault->address >= page_align(fault->task->stack_end);
|
||||
}
|
||||
|
||||
int fill_env_arg_info(struct fault_data *fault, void *vaddr)
|
||||
{
|
||||
/* Get the env start offset in the page */
|
||||
unsigned long env_offset = fault->task->env_start & PAGE_MASK;
|
||||
|
||||
/* Write the environment information */
|
||||
*(unsigned long *)(vaddr + env_offset) = fault->task->utcb_address;
|
||||
printf("%s: Written env value 0x%x, to task address 0x%x\n",
|
||||
__TASKNAME__, fault->task->utcb_address,
|
||||
page_align(fault->address) + env_offset);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handles any page allocation or file ownership change for anonymous pages.
|
||||
* For read accesses initialises a wired-in zero page and for write accesses
|
||||
@@ -319,8 +333,9 @@ int do_anon_page(struct fault_data *fault)
|
||||
/* Clear the page */
|
||||
memset((void *)vaddr, 0, PAGE_SIZE);
|
||||
|
||||
/* If its the env/arg page on stack, fill that information */
|
||||
if (is_env_arg_page(fault))
|
||||
/* TODO: Fill in environment information here. */
|
||||
fill_env_arg_info(fault, vaddr);
|
||||
|
||||
/* Remove temporary mapping */
|
||||
l4_unmap((void *)vaddr, 1, self_tid());
|
||||
|
||||
@@ -72,7 +72,7 @@ struct tcb *create_init_tcb(struct tcb_head *tcbs)
|
||||
tcbs->total++;
|
||||
|
||||
/* Allocate a utcb virtual address */
|
||||
task->utcb_addr = (unsigned long)utcb_vaddr_new();
|
||||
task->utcb_address = (unsigned long)utcb_vaddr_new();
|
||||
|
||||
return task;
|
||||
}
|
||||
@@ -158,8 +158,8 @@ int start_boot_tasks(struct initdata *initdata, struct tcb_head *tcbs)
|
||||
|
||||
/* mmap each task's utcb as single page anonymous memory. */
|
||||
printf("%s: Mapping utcb for new task at: 0x%x\n", __TASKNAME__,
|
||||
task->utcb_addr);
|
||||
if ((err = do_mmap(0, 0, task, task->utcb_addr,
|
||||
task->utcb_address);
|
||||
if ((err = do_mmap(0, 0, task, task->utcb_address,
|
||||
VM_READ | VM_WRITE | VMA_ANON, 1) < 0)) {
|
||||
printf("do_mmap: Mapping utcb failed with %d.\n", err);
|
||||
goto error;
|
||||
|
||||
Reference in New Issue
Block a user