1  /*
   2   * \brief  Environment of a process
   3   * \author Norman Feske
   4   * \date   2006-07-01
   5   *
   6   * The environment of a Genode process is defined by its parent and initialized
   7   * on startup.
   8   */

   9  
  10  /*
  11   * Copyright (C) 2006-2010 Genode Labs GmbH
  12   *
  13   * This file is part of the Genode OS framework, which is distributed
  14   * under the terms of the GNU General Public License version 2.
  15   */

  16  
  17  #ifndef _INCLUDE__BASE__ENV_H_
  18  #define _INCLUDE__BASE__ENV_H_
  19  
  20  #include <parent/capability.h>
  21  #include <parent/parent.h>
  22  #include <rm_session/rm_session.h>
  23  #include <ram_session/ram_session.h>
  24  #include <cpu_session/cpu_session.h>
  25  #include <pd_session/pd_session.h>
  26  #include <base/allocator.h>
  27  #include <base/snprintf.h>
  28  #include <base/lock.h>
  29  
  30  namespace Genode {
  31  
  32     class Env
  33     {
  34        public:
  35  
  36           virtual ~Env() { }
  37  
  38           /**
  39            * Communication channel to our parent
  40            */

  41           virtual Parent *parent() = 0;

  42  
  43           /**
  44            * RAM session for the program
  45            *
  46            * The RAM Session represents a quota of memory that is
  47            * available to the program. Quota can be used to allocate
  48            * RAM-Dataspaces.
  49            */

  50           virtual Ram_session *ram_session() = 0;

  51           virtual Ram_session_capability ram_session_cap() = 0;
  52  
  53           /**
  54            * CPU session for the program
  55            *
  56            * This session is used to create threads.
  57            */

  58           virtual Cpu_session *cpu_session() = 0;

  59  
  60           /**
  61            * Region manager session of the program
  62            */

  63           virtual Rm_session *rm_session() = 0;

  64  
  65           /**
  66            * Pd session of the program
  67            */

  68           virtual Pd_session *pd_session() = 0;

  69  
  70           /**
  71            * Heap backed by the ram_session of the
  72            * environment.
  73            */

  74           virtual Allocator *heap() = 0;

  75     }
;

  76  
  77  
  78     extern Env *env();
  79  
  80  
  81     /**
  82      * Return parent capability
  83      *
  84      * Platforms have to implement this function for environment
  85      * initialization.
  86      */

  87     Parent_capability parent_cap();

  88  }

  89  
  90  #endif /* _INCLUDE__BASE__ENV_H_ */