示例#1
0
文件: kmalloc.c 项目: scrat101/Alo2
//Initializes the heap
void  kmalloc_init(void) { 
	//Sets up all starting variables and creates the heap 
	_kmalloc_d_start_addr = _kmalloc_max_addr + 0x1000;
	_kmalloc_d_max_addr = _kmalloc_d_start_addr + KMALLOC_MAX_HEAP;
	_kmalloc_d_cur_addr = _kmalloc_d_start_addr;
	_kmalloc_d_prev_addr = _kmalloc_d_cur_addr - 4096;
	_kmalloc_d_last_addr = _kmalloc_d_cur_addr;
	_create_heap();
}
示例#2
0
文件: create.c 项目: thumphries/aos
static void _enable_ipc(int err, seL4_Word sos_vaddr, void *cookie) {
    process_create_data *proc = (process_create_data *) cookie;

    if (err) {
        dprintf(6, "process_create_enable_ipc: could not pin IPC buf (%d)\n",
                err);
        _fail(err, proc);
        return;
    }

    // Record the faulted frame address
    proc->pcb->ipc_vaddr = sos_vaddr;

    // Store the process capability for the IPC buffer into our PCB
    dprintf(6, "\t\tCopying process cap...\n");
    err = frame_process_cap(proc->pcb->ipc_vaddr,
                            proc->pcb,
                            &(proc->pcb->ipc_cap));
    // Broken invariant if that failed
    conditional_panic(err, "Failed to obtain IPC process cap");

    // Copy the fault endpoint to the user app to enable IPC
    dprintf(6, "\t\tMinting cap...\n");
    proc->pcb->ep_cap = cspace_mint_cap(proc->pcb->cspace,
                                       cur_cspace,
                                       _sos_ipc_ep_cap,
                                       seL4_AllRights,
                                       seL4_CapData_Badge_new(proc->pcb->pid));

    // Make sure fault endpoint is in the first cspace slot
    if (!(proc->pcb->ep_cap == 1)) {
        _fail(1, proc);
        return;
    }

    // remainder of process creation
    dprintf(5, "\tCreating stack frame...\n");
    err = _create_stack_frame(proc->pcb);
    if (err) {
        _fail(err, proc);
        return;
    }

    dprintf(5, "\tCreating heap...\n");
    err = _create_heap(proc->pcb);
    if (err) {
        _fail(err, proc);
        return;
    }

    dprintf(5, "\tCreating seL4 TCB...\n");
    err = _create_tcb(proc->pcb, SOS_PROCESS_PRIORITY);
    if (err) {
        _fail(err, proc);
        return;
    }

    dprintf(5, "\tLoading ELF...\n");
    err = _load_elf(proc->pcb, proc->pcb->app_name, proc);
    if (err) {
        _fail(err, proc);
        return;
    }

    dprintf(5, "\tCreating children list...\n");
    proc->pcb->children = list_init();
    if (proc->pcb->children == NULL) {
        dprintf(5, "FAILED to create list head\n");
        _fail(SOS_PROCESS_OOM, proc);
        return;
    }
}