Example #1
0
/**
 * The entry.
 */
int main(int argc, char *argv[], char *envp[])
{
    if (ginfo->status == STATUS_DEBUG)
        raise(SIGTRAP);

    cons_init();

    const char *message = "(THU.CST) os is loading ...";
    kprintf("%s\n\n", message);

    intr_init();
    ide_init();

    host_signal_init();

    /* Only to initialize lcpu_count. */
    mp_init();

    pmm_init();
    pmm_init_ap();
    vmm_init();
    sched_init();
    proc_init();

    swap_init();
    fs_init();
    sync_init();

    umclock_init();
    cpu_idle();

    host_exit(SIGINT);

    return 0;
}
Example #2
0
int main(int argc, char *argv[]){
	int i = 0, ret, fd, cpu_index = 14;
	char c;
	
	if(argc <= 1){
		printf("You should input some of socket file path\n");
		return 0;
	}
	for(i = 1; i < argc; i++)
		printf("socket file is %s\n", argv[i]);
	/**
	* init all of epoll and open per socket file
	*/
	if(init_pdma() < 0){
		printf("PDMA failed in main\n");
		return 0;
	}

	host_connect_chardev(argc, argv);
	epollfd = epoll_create(FDSIZE);
	for(i = 0; i < argc - 1; i++){
		add_event(epollfd, host_pdma_control.socket_fds[i], EPOLLIN);
	}
	// for(i = 0; i < argc - 1; i++){
	// 	pollfd[i].fd = host_pdma_control.socket_fds[i];
	// 	pollfd[i].events = POLLIN;
	// }
	if(get_pdma_info(host_pdma.pdma_fd)){
		printf("Cannot get pdma_info\n");
		return 0;
	}

	pthread_spin_init(&native_queue_lock, PTHREAD_PROCESS_SHARED);
	pthread_spin_init(&readyread_queue_lock, PTHREAD_PROCESS_SHARED);
	/**
	* init queue
	*/
	init_queue();

	pthread_create(&(host_pdma_control.native_request_thread), NULL,
			get_request_thread, &cpu_index);
	cpu_index += 1;
	pthread_create(&(host_pdma.send_request2pdma_thread), NULL,
			deal_request_thread, &(cpu_index));
	cpu_index += 1;
	pthread_create(&(host_pdma.ready_thread), NULL,
			ready_response_thread, &(cpu_index));

	while(1){
		printf("Host has start. If you want to stop it, you can input \'c\' \n");
		printf("input>");
		c = getchar();
		getchar();
		if(c == 's')
			break;
		else
			break;
	}
	host_exit(argc-1);
	exit(0);
}
Example #3
0
void hostif_exit()
{
  host_exit( 0 );
}