예제 #1
0
void		vm(t_dvm *v, int cperloop)
{
	while (--cperloop > -1)
	{
		if (v->graphic && v->pause && data()->mlx.input.up == 0
				&& !(v->pause_inc))
			break ;
		v->pause_inc = 0;
		v->cycle++;
		if (!gameloop(v) || !v->proc)
		{
			if (v->dump != -1)
				vm_dump(v);
			if (v->graphic && (data()->mlx.scene = END))
				return ;
			else
				exit3(0, data(), ABS(v->last_live));
		}
		else if (v->dump == v->cycle)
		{
			if (v->graphic)
				display(&(data()->mlx), v);
			vm_dump(v);
		}
	}
	ft_display_graphic(v);
}
예제 #2
0
static void	ft_display_graphic(t_dvm *v)
{
	if (v->graphic)
		display(&(data()->mlx), v);
	if (v->dump <= v->cycle && v->dump != -1)
		vm_dump(v);
}
예제 #3
0
파일: debugconsole.c 프로젝트: else/xelix
// Execute a command
// Yes, this is only a bunch of hardcoded crap
static void executeCommand(char *command, int argc, char **argv)
{
	if(strcmp(command, "reboot") == 0) reboot();
	else if(strcmp(command, "clear") == 0) printf("\e[H\e[2J");
	else if(strcmp(command, "pid") == 0)
	{
		task_t* proc = scheduler_getCurrentTask();
		if(proc != NULL)
			printf("procnum: %d\n", proc->pid);
	}
	else if(strcmp(command, "halt") == 0) halt();
	else if(strcmp(command, "freeze") == 0) freeze();
	else if(strcmp(command, "panic") == 0) panic("Test panic for debugging");
	else if(strcmp(command, "kill") == 0) asm("mov %eax, 1; int 0x80;");
	else if(strcmp(command, "triplefault") == 0)
	{
		struct vm_context *ctx = vm_new();
		paging_apply(ctx);
	}
	else if(strcmp(command, "pagefault") == 0)
		*((char *)vm_faultAddress) = 0;
	else if(strcmp(command, "reload") == 0)
		paging_apply(vm_kernelContext);
	else if(strcmp(command, "rebuild") == 0)
	{
		vm_set_cache(vm_kernelContext, NULL);
		paging_apply(vm_kernelContext);
	}
	else if(strcmp(command, "dump") == 0)
		vm_dump(vm_currentContext);
    else if (strcmp(command, "kb") == 0)
    {
        if (argc != 1)
        {
            printf("usage: kb <layoutname>\n");
            return;
        }

        if (keyboard_setlayout(argv[0]) == -1)
        {
            printf("unknown layout\n");
            return;
        }
    }
	else
	{
		if(strlen(command) > 0 && command[0] != '#')
			printf("error: command '%s' not found.\n", command);
	}
}