Files
codezero/tasks/mm0/include/task.h
Bahadir Balban e7b0e46065 Preparing to add utcbs at disjoint virtual addresses.
This will help when syscalls have long arguments individual
utcbs can be mapped to server tasks and kept mapped in until the
tasks die, as opposed to map requests every time a server task maps
a different utcb at the same virtual address.

The changes have preparation code to also passing the utcb info
through the stack as part of the environment.

To sum up env and arg regions have also been added above the stack and
env region is to be used to pass on the utcb address information at
task startup.
2008-02-28 00:25:04 +00:00

91 lines
2.0 KiB
C

/*
* Thread control block.
*
* Copyright (C) 2007 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>
#define __TASKNAME__ __PAGERNAME__
#define TASK_OFILES_MAX 32
/* Allow per-task anonymous memory to grow as much as 1 MB for now. */
#define TASK_SWAPFILE_MAXSIZE SZ_1MB
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 */
/* Program segment marks */
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; /* Exclusive of last currently mapped page */
unsigned long heap_start;
unsigned long heap_end; /* Exclusive of last currently mapped page */
unsigned long env_start;
unsigned long env_end;
unsigned long args_start;
unsigned long args_end;
/* UTCB address */
unsigned long utcb_addr;
/* Virtual memory areas */
struct list_head vm_area_list;
/* Per-task swap file for now */
struct vm_file *swap_file;
/* File descriptors for this task */
struct file_descriptor fd[TASK_OFILES_MAX];
/* Pool to generate swap file offsets for fileless anonymous regions */
struct id_pool *swap_file_offset_pool;
};
struct tcb *find_task(int tid);
struct initdata;
void init_pm(struct initdata *initdata);
int start_init_tasks(struct initdata *initdata);
void dump_tasks(void);
void send_task_data(l4id_t requester);
/* Used by servers that have a reference to tcbs (e.g. a pager) */
#define current ((struct ktcb *)__L4_ARM_Utcb()->usr_handle)
#endif /* __TASK_H__ */