/*
  TMProtectionDomain.h, Copyright  (c) by Boris Lutz,
  Swiss Federal Institute of Technology,
  Computer Engineering and Networks Laboratory.
 
  TOPSY -- A Teachable Operating System.
  Implementation of a tiny and simple
  micro kernel for teaching purposes.
 
  For further information, please visit http://www.tik.ee.ethz.ch/~topsy
 
  This software is provided under the terms of the GNU General Public Licence.
 
  A full copy of the GNU GPL is provided in the file COPYING found in the 
  development root of Topsy.
 */
/*
	File:                  $Source: /home/ruf/cvs_Topsy/cvs/Topsy/Threads/Attic/TMProtectionDomain.h,v $
	Author(s):             Christian Conrad
	Affiliation:           ETH Zuerich, TIK
	Version:               $Revision: 2922 $
	Creation Date:         
	Last Date of Change:   $Date: 2007-03-19 17:48:52 +0100 (Mon, 19 Mär 2007) $      by: $Author: baderma $
*/


#ifndef TMPROTECTIONDOMAIN_H
#define TMPROTECTIONDOMAIN_H


#include "tailq.h"
#include "vm.h"
#include "tm-include.h"

/*** pd-datastructure ***/
typedef struct protection_domain
{
  ThreadId parent_pdId;					// the parent of the PD has special rights
  ThreadId pdId;								// unique Id (same id space as threads)
  char name[MAXNAMESIZE];				// to produce human readable outpit
  ThreadPermission permission;	// threads in this pd can't have a higher
  // permission than this (XXX)
  ThreadPriority priority;			// threads in this pd can't have a higher
  // priority than this (XXX)
  TAILQ_HEAD(pdThreads, Thread_t)	// list which keeps track of all threads in
  container;									// the PD
  struct vm_domain vm_space;		// all that MM needs for a PD
}
pdom_entry_t;
typedef struct protection_domain *pdom_t;


/*** return values ***/
#define PDOK			 0
#define PDFAIL		-1


/*** function prototypes ***/
int pdInit(void);
int pdAdd(pdom_t addPD);
pdom_t pdCreate(ThreadId parentPDId, char* name,
                address_t start, address_t end,
                ThreadPermission permission, ThreadPriority priority);
int pdDestroy(ThreadId pdId);
pdom_t getPDbyId(ThreadId pdId);
void pdPrint(ThreadId pdId);

#endif
