Files
codezero/tasks/mm0/include/task.h
Bahadir Balban 35d2d275b6 Multiple above-minor updates.
- fixed is_err(x), was evaluating x twice, resulting in calling a
function x twice.

- Divided task initialisation into multiple parts.
- MM0 now creates a tcb for itself and maintains memory regions of its own.
- MM0's tcb is used for mmapping other tasks' regions. MM0 mmaps and prefaults
  those regions, instead of the typical mmap() and fault approach used by
  non-pager tasks.
  For example there's an internal shmget_shmat() path to map in other tasks'
  shm utcbs. Those mappings are then prefaulted into mm0's address space using
  the default fault handling path.

- FS0 now reads task data into its utcb from mm0 via a syscall.
  FS0 shmat()s to utcbs of other tasks, e.g. mm0 and test0.

  FS0 then crashes, that is to be fixed and where this commit is left last.
2008-03-24 00:34:14 +00:00

93 lines
1.8 KiB
C

/*
* Thread control block.
*
* Copyright (C) 2007, 2008 Bahadir Balban
*/
#ifndef __TASK_H__
#define __TASK_H__
#include <l4/macros.h>
#include <l4/types.h>
#include INC_GLUE(memlayout.h)
#include <l4/lib/list.h>
#include <l4lib/types.h>
#include <l4lib/utcb.h>
#include <lib/addr.h>
#include <l4/api/kip.h>
#define __TASKNAME__ __PAGERNAME__
#define TASK_FILES_MAX 32
/* POSIX minimum is 4Kb */
#define DEFAULT_ENV_SIZE SZ_4K
#define DEFAULT_STACK_SIZE SZ_16K
#define DEFAULT_UTCB_SIZE PAGE_SIZE
struct vm_file;
struct file_descriptor {
unsigned long vnum;
unsigned long cursor;
struct vm_file *vmfile;
};
/* Stores all task information that can be kept in userspace. */
struct tcb {
/* Task list */
struct list_head list;
/* Name of the task */
char name[16];
/* Task ids */
int tid;
int spid;
/* Related task ids */
unsigned int pagerid; /* Task's pager */
/* Task's main address space region, usually USER_AREA_START/END */
unsigned long start;
unsigned long end;
/* Page aligned program segment marks, ends exclusive as usual */
unsigned long text_start;
unsigned long text_end;
unsigned long data_start;
unsigned long data_end;
unsigned long bss_start;
unsigned long bss_end;
unsigned long stack_start;
unsigned long stack_end;
unsigned long heap_start;
unsigned long heap_end;
unsigned long env_start;
unsigned long env_end;
unsigned long args_start;
unsigned long args_end;
/* Task's mmappable region */
unsigned long map_start;
unsigned long map_end;
/* UTCB information */
void *utcb;
/* Virtual memory areas */
struct list_head vm_area_list;
/* File descriptors for this task */
struct file_descriptor fd[TASK_FILES_MAX];
};
struct tcb *find_task(int tid);
struct initdata;
void init_pm(struct initdata *initdata);
int send_task_data(l4id_t requester);
#endif /* __TASK_H__ */