00001
00008
00009
00010
00011
00012 #ifndef __APP_H_
00013 #define __APP_H_
00014
00015 #include <l4/sys/types.h>
00016 #include <l4/l4rm/l4rm.h>
00017
00018 #include "cfg.h"
00019 #include "debug.h"
00020 #ifdef USE_INTEGRITY
00021 #include "integrity-types.h"
00022 #endif
00023
00024 #define MAX_APP_AREA 28
00026 #define DEFAULT_PRIO 0x10
00027 #define DEFAULT_MCP 0xff
00030 typedef struct
00031 {
00032 l4_addr_t here;
00034 l4_addr_t app;
00036 } app_addr_t;
00037
00039 typedef struct
00040 {
00041 app_addr_t beg;
00042 l4_size_t size;
00043 l4_uint16_t type;
00044 l4_uint16_t flags;
00045 #define APP_AREA_VALID 0x0001
00046 #define APP_AREA_PAGE 0x0002
00047 #define APP_AREA_MMIO 0x0004
00048 #define APP_AREA_NOSUP 0x0008
00049 l4dm_dataspace_t ds;
00050 const char *dbg_name;
00051 } app_area_t;
00052
00054 typedef struct
00055 {
00056 l4_threadid_t tid;
00057 unsigned int taskno;
00058 int hi_first_msg;
00059 l4env_infopage_t *env;
00060 app_area_t app_area[MAX_APP_AREA];
00061 int app_area_next_free;
00062 char *iobitmap;
00063 const char *fname;
00064 const char *name;
00065 l4_addr_t eip, esp;
00066 l4_uint32_t flags;
00067 #define APP_MODE_SIGMA0 0x00000001
00068 #define APP_MODE_INTERP 0x00000004
00069 #define APP_DIRECTMAP 0x00000008
00070 #define APP_SYMBOLS 0x00000010
00071 #define APP_LINES 0x00000020
00072 #define APP_ALLOW_KILL 0x00000040
00073 #define APP_ALLOW_VGA 0x00000080
00074 #define APP_NOSIGMA0 0x00000100
00075 #define APP_ALLOW_CLI 0x00000200
00076 #define APP_SHOW_AREAS 0x00000400
00077 #define APP_STOP 0x00000800
00078 #define APP_CONT 0x00001000
00079 #define APP_NOSUPER 0x00002000
00080 #define APP_ALL_WRITBLE 0x00004000
00081 #define APP_ALLOW_BIOS 0x00008000
00082 #define APP_MSG_IO 0x00010000
00083 #define APP_HASH_BINARY 0x00020000
00084 l4_addr_t image;
00085 l4_size_t sz_image;
00086 l4dm_dataspace_t ds_image;
00087 l4_addr_t symbols;
00088 l4_size_t sz_symbols;
00089 l4dm_dataspace_t ds_symbols;
00090 l4_addr_t lines;
00091 l4_size_t sz_lines;
00092 l4dm_dataspace_t ds_lines;
00093 l4_addr_t last_pf;
00094 l4_addr_t last_pf_eip;
00095 l4_uint32_t prio;
00096 l4_uint32_t mcp;
00097 l4_taskid_t owner;
00098 l4_threadid_t caphandler;
00099 cfg_cap_t *caplist;
00100 #ifdef USE_INTEGRITY
00101 integrity_hash_t integrity_hash;
00102 #endif
00103 cfg_kquota_t *kquota;
00104 } app_t;
00105
00106 #define HERE_TO_APP(addr, base) \
00107 (base).app + (((l4_addr_t)(addr) - (base).here))
00108
00109 app_t* task_to_app(l4_threadid_t tid);
00110 int create_app_desc(app_t **new_app);
00111
00112 void __attribute__ ((format (printf, 2, 3)))
00113 app_msg(app_t *app, const char *format, ...);
00114
00115 void app_list_addr(app_t *app);
00116 int app_boot(cfg_task_t *ct, l4_taskid_t owner);
00117 int app_cont(app_t *app);
00118 int app_kill(l4_taskid_t task_id, l4_taskid_t caller);
00119 int app_dump(unsigned long task_id);
00120 int app_info(unsigned long task_id, l4dm_dataspace_t *l4env_ds,
00121 l4_threadid_t client, char **fname);
00122
00123 void app_share_sections_with_client(app_t *app, l4_threadid_t client);
00124 int init_infopage(l4env_infopage_t *env);
00125
00126 int app_attach_ds_to_pager(app_t *app, l4dm_dataspace_t *ds, l4_addr_t addr,
00127 l4_size_t size, l4_uint16_t type,
00128 l4_uint32_t rights,
00129 const char *dbg_name, app_area_t **aa);
00130
00131 #endif