예제 #1
0
파일: main.c 프로젝트: glguida/mh
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

}
예제 #2
0
파일: dwebsvr.c 프로젝트: Cloudhomebr/rCPU
void dwebserver_kill(void)
{
    inthandler(SIGUSR1);
}