mirror of
https://github.com/drasko/codezero.git
synced 2026-01-13 11:23:16 +01:00
UTCB create/destroy working.
Execve maps its utcb in mmap_segments. fork/clone does it as part of task_create
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#define DEFAULT_ENV_SIZE SZ_4K
|
||||
#define DEFAULT_STACK_SIZE SZ_32K
|
||||
#define DEFAULT_SHPAGE_SIZE PAGE_SIZE
|
||||
#define TASK_SIZE 0x10000000
|
||||
|
||||
#define TCB_NO_SHARING 0
|
||||
#define TCB_SHARED_VM (1 << 0)
|
||||
|
||||
@@ -82,7 +82,6 @@ int boottask_mmap_regions(struct tcb *task, struct vm_file *file)
|
||||
__pfn(DEFAULT_SHPAGE_SIZE))))
|
||||
return (int)shm;
|
||||
|
||||
/* Task's utcb region */
|
||||
task_setup_utcb(task);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -57,8 +57,8 @@ int mm0_task_init(struct vm_file *f, unsigned long task_start,
|
||||
task->parent = task;
|
||||
|
||||
/*
|
||||
* The first UTCB address is already assigned
|
||||
* by the microkernel for this pager. Ensure that we also got
|
||||
* The first UTCB address is already assigned by the
|
||||
* microkernel for this pager. Ensure that we also get
|
||||
* the same from our internal utcb bookkeeping.
|
||||
*/
|
||||
BUG_ON(task->utcb_address != UTCB_AREA_START);
|
||||
|
||||
@@ -249,7 +249,7 @@ void *do_mmap(struct vm_file *mapfile, unsigned long file_offset,
|
||||
printf("Trying to map %d pages.\n", npages);
|
||||
return PTR_ERR(-EINVAL);
|
||||
}
|
||||
if (npages > __pfn(task->stack_start - task->data_end)) {
|
||||
if (npages > __pfn(TASK_SIZE)) {
|
||||
printf("Trying to map too many pages: %d\n", npages);
|
||||
return PTR_ERR(-ENOMEM);
|
||||
}
|
||||
|
||||
@@ -350,7 +350,6 @@ struct tcb *task_create(struct tcb *parent, struct task_ids *ids,
|
||||
/* Set up a new utcb for new thread */
|
||||
task_setup_utcb(task);
|
||||
|
||||
|
||||
/* Set up parent-child relationship */
|
||||
if ((share_flags & TCB_SHARED_PARENT) ||
|
||||
(share_flags & TCB_SHARED_TGROUP)) {
|
||||
|
||||
@@ -147,7 +147,7 @@ out:
|
||||
|
||||
/* Assign task's utcb address */
|
||||
task->utcb_address = slot;
|
||||
printf("UTCB at 0x%x.\n", slot);
|
||||
// printf("UTCB created at 0x%x.\n", slot);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ int task_destroy_utcb(struct tcb *task)
|
||||
{
|
||||
struct utcb_desc *udesc;
|
||||
|
||||
printf("UTCB: Destroying 0x%x\n", task->utcb_address);
|
||||
// printf("UTCB: Destroying 0x%x\n", task->utcb_address);
|
||||
|
||||
/* Find the utcb descriptor slot first */
|
||||
list_for_each_entry(udesc, &task->utcb_head->list, list) {
|
||||
|
||||
Reference in New Issue
Block a user