int main() { pid_t pid; struct sys_hwcreat_cfg cfg; printf("Hello!\n"); cfg.nameid = squoze("platform"); cfg.nirqsegs = 1; cfg.npiosegs = 0; cfg.nmemsegs = 0; cfg.segs[0].base = 1; /* IRQ 1 */ cfg.segs[0].len = 1; printf("creat[%llx]: %d\n", cfg.nameid, sys_hwcreat(&cfg, 0111)); if (sys_fork() == 0) goto child; inthandler(INTR_CHILD, do_child, NULL); lwt_sleep(); child: if (sys_fork()) sys_die(-3); /* Child of Child */ printf("Opening platform [%llx]\n", squoze("platform")); printf("open[%llx]: %d\n", squoze("platform"), sys_open(squoze("platform"))); printf("irqmap[%llx]: %d\n", squoze("platform"), sys_mapirq(0, 1, 5)); lwt_sleep(); printf("Goodbye!"); sys_die(5); #if 0 int j; size_t len; struct diodevice *dc; struct iovec iov[11]; uint64_t val; do { dc = dirtio_pipe_open(500); } while(dc == NULL); dirtio_mmio_inw(&dc->desc, PORT_DIRTIO_MAGIC, 0, &val); printf("PORT_DIRTIO_MAGIC is %"PRIx64"\n", val); dirtio_mmio_inw(&dc->desc, PORT_DIRTIO_MAGIC, 0, &val); printf("PORT_DIRTIO_MAGIC is %"PRIx64"\n", val); len = dirtio_allocv(dc, iov, 11, 11 * 128 * 1024 - 1); for (j = 0; j < 11; j++) printf("\t%p -> %d\n", iov[j].iov_base, iov[j].iov_len); dioqueue_addv(&dc->dqueues[0], 1, 10, iov); #endif }
void foo() { printf("Foo will sleep 2 senconds... \n"); lwt_sleep(2); printf("Foo wake up \n"); lwt_exit(3); printf("Problem my occur here\n"); }
void bar() { printf("Bar will sleep 3 seconds... \n"); lwt_sleep(5); //printf("current is ... %s\n", sys_t.curr->name); //printf("next is ... %s\n", sys_t.curr->next->name); //printf("next is ... %s\n", sys_t.lcurr->next->next->name); printf("Bar wake up \n"); lwt_exit(4); }
static void pltconsole() { int ret; struct sys_creat_cfg cfg; memset(&cfg, 0, sizeof(cfg)); cfg.nameid = CONSOLE_NAMEID; reqevt = evtalloc(); evtast(reqevt, __console_io_ast); ret = devcreat(&cfg, 0111, reqevt); if (ret < 0) mrg_panic("Cannot create console: devcreat() [%d]", ret); devid = ret; console_kbd_init(); lwt_sleep(); }