Barrelfish
Data Structures | Macros | Functions
spawndomain.h File Reference

Domain spawn functionality. More...

Data Structures

struct  spawninfo
 Struct to refer to the various caps within a domain being spawned. More...
 

Macros

#define SPAWN_FLAGS_NEW_DOMAIN   (1 << 0)
 allocate a new domain ID
 
#define SPAWN_FLAGS_OMP   (1 << 1)
 do the OpenMP parsing
 

Functions

__BEGIN_DECLS errval_t spawn_get_cmdline_args (struct mem_region *module, char **retargs)
 Retrive the commandline args of #name. More...
 
int spawn_tokenize_cmdargs (char *args, char *argv[], size_t argv_len)
 Returns tokenized cmdline args. More...
 
errval_t spawn_load_with_bootinfo (struct spawninfo *si, struct bootinfo *bi, const char *name, coreid_t coreid)
 Spawn a domain and give it the bootinfo struct. Just monitor and memserv should be spawned using this.
 
errval_t spawn_load_with_args (struct spawninfo *si, struct mem_region *module, const char *name, coreid_t coreid, char *const argv[], char *const envp[])
 Spawn a domain with the given args.
 
errval_t spawn_load_image (struct spawninfo *si, lvaddr_t binary, size_t binary_size, enum cpu_type type, const char *name, coreid_t coreid, char *const argv[], char *const envp[], struct capref inheritcn_cap, struct capref argcn_cap)
 Load an image. More...
 
errval_t spawn_vspace_init (struct spawninfo *si, struct capref vnode, enum cpu_type cpu_type)
 Initialize the vspace for the domain being spawned. More...
 
errval_t spawn_vspace_map_one_frame (struct spawninfo *si, genvaddr_t *retaddr, struct capref frame, size_t size)
 Map one frame anywhere.
 
errval_t spawn_vspace_map_fixed_one_frame (struct spawninfo *si, genvaddr_t addr, struct capref frame, size_t size)
 Map one frame at the given addr.
 
errval_t spawn_vspace_map_anon_fixed_attr (struct spawninfo *si, genvaddr_t addr, size_t size, struct vregion **vregion, struct memobj **memobj, vregion_flags_t flags)
 Return memobj and vregion for anonymous type mapping.
 
const char * multiboot_module_rawstring (struct mem_region *region)
 Returns a raw pointer to the modules string area string.
 
const char * multiboot_module_name (struct mem_region *region)
 returns the basename without arguments of a multiboot module
 
errval_t spawn_map_module (struct mem_region *module, size_t *retsize, lvaddr_t *retaddr, genpaddr_t *retpaddr)
 Map in the frame caps for a module into our vspace, return their location.
 
errval_t spawn_span_domain (struct spawninfo *si, struct capref vroot, struct capref disp_frame)
 Span a domain with the given vroot and disp_frame. More...
 
errval_t spawn_symval_lookup_idx (uint32_t idx, char **ret_name, genvaddr_t *ret_add)
 looks up the symbol by a given index More...
 
errval_t spawn_symval_lookup_name (char *name, uint32_t *ret_idx, genvaddr_t *ret_add)
 looks up the symbol based on its name and adds it to the cache More...
 
errval_t spawn_symval_lookup_addr (genvaddr_t addr, uint32_t *ret_idx, char **ret_name)
 looks up the symbol information based on its address More...
 
errval_t spawn_symval_count (uint32_t *ret_count)
 obtains the number of OpenMP symbols of the ELF file More...
 
errval_t spawn_symval_cache_init (uint8_t lazy)
 initializes the symbol value cache for faster lookups More...
 

Detailed Description

Domain spawn functionality.

Function Documentation

__BEGIN_DECLS errval_t spawn_get_cmdline_args ( struct mem_region module,
char **  retargs 
)

Retrive the commandline args of #name.

The arguments are malloced into a new space so need to be freed after use

errval_t spawn_load_image ( struct spawninfo si,
lvaddr_t  binary,
size_t  binary_size,
enum cpu_type  type,
const char *  name,
coreid_t  coreid,
char *const  argv[],
char *const  envp[],
struct capref  inheritcn_cap,
struct capref  argcn_cap 
)

Load an image.

Parameters
siStruct used by the library
binaryThe image to load
typeThe type of arch to load for
nameName of the image required only to place it in disp struct
coreidCoreid to load for, required only to place it in disp struct
argvCommand-line arguments, NULL-terminated
envpEnvironment, NULL-terminated
inheritcn_capCap to a CNode containing capabilities to be inherited
argcn_capCap to a CNode containing capabilities passed as arguments
errval_t spawn_span_domain ( struct spawninfo si,
struct capref  vroot,
struct capref  disp_frame 
)

Span a domain with the given vroot and disp_frame.

Operation similar to spawning a domain but the vroot and disp_frame are already provided

errval_t spawn_symval_cache_init ( uint8_t  lazy)

initializes the symbol value cache for faster lookups

Parameters
lazydo a lazy initialization i.e. only allocate memory for the symbols but do not load them
Returns
SYS_ERR_OK on success errval on error
errval_t spawn_symval_count ( uint32_t *  ret_count)

obtains the number of OpenMP symbols of the ELF file

Parameters
ret_countreturns the number of symbols
Returns
SYS_ERR_OK on success errval on failure
errval_t spawn_symval_lookup_addr ( genvaddr_t  addr,
uint32_t *  ret_idx,
char **  ret_name 
)

looks up the symbol information based on its address

Parameters
addrthe address to lookup
ret_idxreturns the symbol index
ret_namereturns the symbol name
Returns
SYS_ERR_OK on success errval on error
errval_t spawn_symval_lookup_idx ( uint32_t  idx,
char **  ret_name,
genvaddr_t *  ret_addr 
)

looks up the symbol by a given index

Parameters
idxthe index of the symbol to look up
ret_namereturns the name of the symbol
ret_addrreturns the address of the symbol
Returns
SYS_ERR_OK on success errval on failure
errval_t spawn_symval_lookup_name ( char *  name,
uint32_t *  ret_idx,
genvaddr_t *  ret_addr 
)

looks up the symbol based on its name and adds it to the cache

Parameters
namethe name of the symbol to query
ret_idxreturns the symbol index
ret_addrreturns the address of the symbol
Returns
SYS_ERR_OK on success errval on failure
int spawn_tokenize_cmdargs ( char *  s,
char *  argv[],
size_t  argv_len 
)

Returns tokenized cmdline args.

Parameters
sArgument string, which is modified in place
argvArray to be filled-in with arguments
argv_lenLength of array available in argv, including terminator

The arguments are placed in #argv, which is NULL-terminated

Returns
Number of arguments, not including terminator
errval_t spawn_vspace_init ( struct spawninfo si,
struct capref  vnode,
enum cpu_type cpu_type   
)

Initialize the vspace for the domain being spawned.

Parameters
vnodeThe pml4 cap for the new domain