#include "cfg.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <l4/env/errno.h>
#include <l4/sys/consts.h>
#include <l4/rmgr/librmgr.h>
#include <l4/sys/kdebug.h>
#include <l4/thread/thread.h>
#include <l4/loader/loader.h>
#include <l4/names/libnames.h>
#include <l4/util/util.h>
#include <l4/util/macros.h>
#include "app.h"
#include "dm-if.h"
#include "fprov-if.h"
#include "elf-loader.h"
#include "idl.h"
#include "global.h"
Functions | |
static void | cfg_make_template (void) |
static void | cfg_init_task (cfg_task_t *ct, l4dm_dataspace_t ds, l4_threadid_t dsm_id, l4_threadid_t fprov_id, const char *fname) |
void | cfg_new_task_template (void) |
Create a task template. | |
int | cfg_job (l4_uint32_t flag, unsigned int number) |
Create a pseudo task. | |
int | cfg_new_task (const char *fname, const char *args) |
Create new config task. | |
int | cfg_new_module (const char *fname, const char *args, l4_addr_t low, l4_addr_t high) |
Create new module for current config task. | |
int | cfg_new_mem (l4_size_t size, l4_addr_t low, l4_addr_t high, l4_umword_t flags) |
Create new memory region for current config task. | |
int | cfg_new_ioport (int low, int high) |
Add I/O ports low. | |
int | cfg_task_no (unsigned int no) |
Set task number of task we currently working on. | |
int | cfg_task_prio (unsigned int prio) |
Set priority of task we currently working on. | |
int | cfg_task_mcp (unsigned int mcp) |
Set priority of task we currently working on. | |
int | cfg_task_flag (l4_uint32_t flag) |
Set flag of task we currently working on. | |
int | cfg_task_fprov (const char *fprov_name) |
Set task's file provider. | |
int | cfg_task_dsm (const char *dsm_name) |
Set task's dataspace manager. | |
int | cfg_task_caphandler (const char *name) |
Set caphandler of a task. | |
static void | caplist_add (cfg_task_t *ct, cfg_cap_t *cap) |
Add a capability to the cap_list. | |
int | cfg_task_ipc (const char *name, int type) |
Set the task caps. | |
int | cfg_task_integrity_id (const char *id64, int type) |
Set (parent) ID used in integrity database in external service. | |
int | cfg_task_kquota (const char *name) |
cfg_task_t ** | cfg_next_task (void) |
Return next config task. | |
static void | cfg_clear_task (cfg_task_t *ct) |
Recycle cfg_task descriptor. | |
static int | parse_cfg (l4_addr_t cfg_addr, l4_size_t cfg_size) |
Parse config script. | |
int | cfg_lookup_name (const char *name, l4_threadid_t *id) |
Lookup a name by names but check for numerical versions first, task.thread must use hex numbers. | |
int | load_config_script_from_file (const char *fname_and_arg, l4_threadid_t fprov_id, l4_taskid_t owner, l4_uint32_t flags, l4_taskid_t task_ids[]) |
static int | load_without_script (const char *fname_and_arg, l4_size_t fname_len, l4_threadid_t fprov_id, const l4dm_dataspace_t *bin_ds, l4_addr_t bin_addr, l4_size_t bin_size, l4_taskid_t owner, l4_uint32_t ext_flags, l4_uint32_t cfg_flags, l4_taskid_t task_ids[]) |
Load application directly (without config script). | |
int | load_config_script (const char *fname_and_arg, l4_threadid_t fprov_id, const l4dm_dataspace_t *cfg_ds, l4_addr_t cfg_addr, l4_size_t cfg_size, l4_taskid_t owner, l4_uint32_t ext_flags, int *is_binary, l4_taskid_t task_ids[]) |
Load config script from dataspace image. | |
int | cfg_parse_init (void) |
Init config stuff before begin with parsing. | |
int | cfg_init (void) |
Init cfg stuff. | |
Variables | |
static cfg_task_t * | cfg_task [16] |
static cfg_task_t ** | cfg_task_nextfree = cfg_task |
static cfg_task_t ** | cfg_task_current = cfg_task |
static cfg_task_t ** | cfg_task_nextout = cfg_task |
static cfg_task_t | cfg_task_template |
static cfg_task_t * | cfg_task_template_ptr = &cfg_task_template |
static l4env_infopage_t * | cfg_env |
static l4dm_dataspace_t | cfg_env_ds |
static void caplist_add | ( | cfg_task_t * | ct, | |
cfg_cap_t * | cap | |||
) | [static] |
Add a capability to the cap_list.
static void cfg_clear_task | ( | cfg_task_t * | ct | ) | [static] |
Recycle cfg_task descriptor.
int cfg_init | ( | void | ) |
Init cfg stuff.
static void cfg_init_task | ( | cfg_task_t * | ct, | |
l4dm_dataspace_t | ds, | |||
l4_threadid_t | dsm_id, | |||
l4_threadid_t | fprov_id, | |||
const char * | fname | |||
) | [static] |
< this is a template
int cfg_job | ( | l4_uint32_t | flag, | |
unsigned int | number | |||
) |
Create a pseudo task.
< dump memory
< sleep before continue
static void cfg_make_template | ( | void | ) | [static] |
< this is a template
< default priority for new tasks
< default mcp for new tasks
int cfg_new_ioport | ( | int | low, | |
int | high | |||
) |
Add I/O ports low.
.high to I/O permission bitmap.
int cfg_new_mem | ( | l4_size_t | size, | |
l4_addr_t | low, | |||
l4_addr_t | high, | |||
l4_umword_t | flags | |||
) |
Create new memory region for current config task.
int cfg_new_module | ( | const char * | fname, | |
const char * | args, | |||
l4_addr_t | low, | |||
l4_addr_t | high | |||
) |
Create new module for current config task.
int cfg_new_task | ( | const char * | fname, | |
const char * | args | |||
) |
Create new config task.
void cfg_new_task_template | ( | void | ) |
Create a task template.
cfg_task_t** cfg_next_task | ( | void | ) |
Return next config task.
int cfg_parse_init | ( | void | ) |
Init config stuff before begin with parsing.
int cfg_task_caphandler | ( | const char * | name | ) |
Set caphandler of a task.
int cfg_task_dsm | ( | const char * | dsm_name | ) |
Set task's dataspace manager.
int cfg_task_flag | ( | l4_uint32_t | flag | ) |
Set flag of task we currently working on.
int cfg_task_fprov | ( | const char * | fprov_name | ) |
Set task's file provider.
int cfg_task_integrity_id | ( | const char * | id64, | |
int | type | |||
) |
Set (parent) ID used in integrity database in external service.
int cfg_task_ipc | ( | const char * | name, | |
int | type | |||
) |
Set the task caps.
int cfg_task_mcp | ( | unsigned int | mcp | ) |
Set priority of task we currently working on.
int cfg_task_no | ( | unsigned int | no | ) |
Set task number of task we currently working on.
int cfg_task_prio | ( | unsigned int | prio | ) |
Set priority of task we currently working on.
int load_config_script | ( | const char * | fname_and_arg, | |
l4_threadid_t | fprov_id, | |||
const l4dm_dataspace_t * | cfg_ds, | |||
l4_addr_t | cfg_addr, | |||
l4_size_t | cfg_size, | |||
l4_taskid_t | owner, | |||
l4_uint32_t | ext_flags, | |||
int * | is_binary, | |||
l4_taskid_t | task_ids[] | |||
) |
Load config script from dataspace image.
Before loading, the dataspace is sent to the exec server which for ELF check. If it is a valid ELF binary, it is directly loaded.
fname_and_arg | file name of the config script | |
fprov_id | file provider to retrieve the config script from | |
cfg_ds | dataspace of the config script (optionally) | |
cfg_addr | address the dataspace is attached to | |
cfg_size | size of the dataspace | |
owner | owner of the new application | |
ext_flags | external Flags (see <l4/loader/loader.h> | |
is_binary | is that an ELF binary? |
task_ids | IDs of started tasks |
< interpret using libld-l4.s.so
< dump memory
< sleep before continue
< this is a template
< stop app just before start
< interpret using libld-l4.s.so
< this is a template
< this is a template
static int load_without_script | ( | const char * | fname_and_arg, | |
l4_size_t | fname_len, | |||
l4_threadid_t | fprov_id, | |||
const l4dm_dataspace_t * | bin_ds, | |||
l4_addr_t | bin_addr, | |||
l4_size_t | bin_size, | |||
l4_taskid_t | owner, | |||
l4_uint32_t | ext_flags, | |||
l4_uint32_t | cfg_flags, | |||
l4_taskid_t | task_ids[] | |||
) | [static] |
Load application directly (without config script).
fname | file name of the binary image | |
fprov_id | file provieder to retrieve the shared libs from | |
bin_ds | dataspace containing the binary image | |
bin_addr | address the binary is mapped to | |
bin_size | size of the dataspace | |
owner | owner | |
ext_flags | external Flags (see <l4/loader/loader.h>) | |
cfg_flags | internal Flags (CFG_F_*) |
task_ids | IDs of started tasks |
< stop app just before start
< interpret using libld-l4.s.so
static int parse_cfg | ( | l4_addr_t | cfg_addr, | |
l4_size_t | cfg_size | |||
) | [static] |
Parse config script.