/* * Setup task image for boot task. (NOMMU version) * Return 0 on success, -1 on failure. * * Note: We assume that the task images are already copied to * the proper address by a boot loader. */ int vm_load(vm_map_t map, struct module *mod, void **stack) { void *base; size_t size; DPRINTF(("Loading task:\'%s\'\n", mod->name)); /* * Reserve text & data area */ base = (void *)mod->text; size = mod->textsz + mod->datasz + mod->bsssz; if (do_reserve(map, &base, size)) return -1; if (mod->bsssz != 0) memset((void *)(mod->data + mod->datasz), 0, mod->bsssz); /* * Create stack */ if (do_allocate(map, stack, USTACK_SIZE, 1)) return -1; return 0; }
int main(void) { int r; message m; int ipc_status; /* SEF local startup. */ sef_local_startup(); for(;;) { r= driver_receive(ANY, &m, &ipc_status); if (r < 0) { printf("PCI: driver_receive failed: %d\n", r); break; } if (is_ipc_notify(ipc_status)) { printf("PCI: got notify from %d\n", m.m_source); /* done, get a new message */ continue; } switch(m.m_type) { case BUSC_PCI_INIT: do_init(&m); break; case BUSC_PCI_FIRST_DEV: do_first_dev(&m); break; case BUSC_PCI_NEXT_DEV: do_next_dev(&m); break; case BUSC_PCI_FIND_DEV: do_find_dev(&m); break; case BUSC_PCI_IDS: do_ids(&m); break; case BUSC_PCI_RESERVE: do_reserve(&m); break; case BUSC_PCI_ATTR_R8: do_attr_r8(&m); break; case BUSC_PCI_ATTR_R16: do_attr_r16(&m); break; case BUSC_PCI_ATTR_R32: do_attr_r32(&m); break; case BUSC_PCI_ATTR_W8: do_attr_w8(&m); break; case BUSC_PCI_ATTR_W16: do_attr_w16(&m); break; case BUSC_PCI_ATTR_W32: do_attr_w32(&m); break; case BUSC_PCI_RESCAN: do_rescan_bus(&m); break; case BUSC_PCI_DEV_NAME_S: do_dev_name_s(&m); break; case BUSC_PCI_SLOT_NAME_S: do_slot_name_s(&m); break; case BUSC_PCI_SET_ACL: do_set_acl(&m); break; case BUSC_PCI_DEL_ACL: do_del_acl(&m); break; case BUSC_PCI_GET_BAR: do_get_bar(&m); break; default: printf("PCI: got message from %d, type %d\n", m.m_source, m.m_type); break; } } return 0; }