/* TODO: add error status */ loader_handle * loader_open_exec (struct vm_space *space, const void *exec_start, busword_t exec_size) { int i; loader_handle *handle; void *opaque; for (i = 0; i < loader_count; ++i) if (loader_is_usable (loader_list + i)) if ((opaque = (loader_list[i].open) (exec_start, exec_size)) != KERNEL_INVALID_POINTER) { if (PTR_UNLIKELY_TO_FAIL (handle = spalloc (sizeof (loader_handle)))) { error ("Not enough memory to allocate loader handle!\n"); (loader_list[i].close) (opaque); return KERNEL_INVALID_POINTER; } handle->loader = loader_list + i; handle->target_space = space; handle->exec_base = exec_start; handle->exec_size = exec_size; handle->opaque = opaque; return handle; } return KERNEL_INVALID_POINTER; }
/* * replace an alloca function with direct allocation on stack. * return a destination temp node. */ static NODE * builtin_alloca(const struct bitable *bt, NODE *a) { NODE *t, *u; #ifdef notyet if (xnobuiltins) return NULL; #endif t = tempnode(0, VOID|PTR, 0, 0); u = tempnode(regno(t), VOID|PTR, 0, 0); spalloc(t, a, SZCHAR); return u; }
/* * replace an alloca function with direct allocation on stack. * return a destination temp node. */ static NODE * builtin_alloca(NODE *f, NODE *a, TWORD rt) { NODE *t, *u; #ifdef notyet if (xnobuiltins) return NULL; #endif t = tempnode(0, VOID|PTR, 0, 0); u = tempnode(regno(t), VOID|PTR, 0, 0); spalloc(t, a, SZCHAR); tfree(f); return u; }
/* * replace an alloca function with direct allocation on stack. * return a destination temp node. */ static NODE * builtin_alloca(NODE *f, NODE *a, TWORD rt) { struct symtab *sp; NODE *t, *u; #ifdef notyet if (xnobuiltins) return NULL; #endif sp = f->n_sp; t = tempnode(0, VOID|PTR, 0, MKAP(INT) /* XXX */); u = tempnode(regno(t), VOID|PTR, 0, MKAP(INT) /* XXX */); spalloc(t, a, SZCHAR); tfree(f); return u; }