Ejemplo n.º 1
0
static EVENT cd_sizeevent( void )
/*******************************/
{
    SAREA       area;
    unsigned    state;
    unsigned    arm;

    if( !StatePending )
        return( EV_NO_EVENT );
    StatePending = 0;
    state = console_state( UIConCtrl, UIConsole, 0,
                (_CON_EVENT_ACTIVE|_CON_EVENT_INACTIVE|_CON_EVENT_SIZE) );
    arm = 0;
    if( state & _CON_EVENT_INACTIVE ) {
        clear_shift();
        arm = _CON_EVENT_ACTIVE;
    } else if( state & _CON_EVENT_ACTIVE ) {
        arm = _CON_EVENT_INACTIVE;
    }
    console_arm( UIConCtrl, UIConsole, 0, arm | _CON_EVENT_SIZE );
    if( !(state & _CON_EVENT_SIZE) )
        return( EV_NO_EVENT );
    if( !uiinlists( EV_BACKGROUND_RESIZE ) )
        return( EV_NO_EVENT );
    if( !setupscrnbuff() )
        return( EV_NO_EVENT );
    closebackground();
    openbackground();
    area.row = 0;
    area.col = 0;
    area.height = UIData->height;
    area.width = UIData->width;
    uidirty( area );
    return( EV_BACKGROUND_RESIZE );
}
Ejemplo n.º 2
0
/* This is called to do OS-specific stuff when we switch away from
 * our console.
 */
Bool xf86VTSwitchAway()
{
	int ret;
	unsigned event, bits;

	ErrorF("Called VT switch away!\n");

	/* First check wether we are trying to switch to our console... */
	if (xf86Info.vtRequestsPending == QNX_our_console) {
		xf86Info.vtRequestsPending = FALSE;
		return (FALSE);
		}

	/* Reenable console switching */
	QNX_con_bits &= ~QNX_con_mask;
        bits = console_ctrl(QNX_con_ctrl, -1, QNX_con_bits, QNX_con_mask);
        QNX_con_mask = 0;

	/* And activate the new console. Check if it is valid first... */
	ret = console_active(QNX_con_ctrl, xf86Info.vtRequestsPending);
	ErrorF("xf86VTSwitchAway: Made console %d active, ret %d\n", 
		xf86Info.vtRequestsPending, ret);
	xf86Info.vtRequestsPending = FALSE;

	if (ret == -1) {
	        QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
	        QNX_con_bits = console_ctrl (QNX_con_ctrl, 
			QNX_our_console, QNX_con_mask, QNX_con_mask);
		return (FALSE);
		}
	/* Arm the console with the proxy so we know when we come back */
      	console_state(QNX_con_ctrl, QNX_our_console, 0L, _CON_EVENT_ACTIVE); 
	event = _CON_EVENT_ACTIVE;
        console_arm (QNX_con_ctrl, QNX_our_console, QNX_console_proxy, event);

        return(TRUE);
}
Ejemplo n.º 3
0
Archivo: boot.c Proyecto: kisom/pmon
int
cmd_boot(int argc, char **argv)
{
	char path[256];
	char buf[DLREC+1];
	extern char  clientcmd[];	/* in go.c */
	extern char *clientav[];	/* in go.c */
	extern int   clientac;		/* in go.c */
	extern int optind;
	extern char *optarg;
	int c, err;
	long ep;
	int n;
	int flags;
	unsigned long offset = 0;
	unsigned long entry = 0;

	flags = 0;
	optind = err = 0;
	offset = 0;
	while ((c = getopt (argc, argv, "sbke:ro:")) != EOF) {
		switch (c) {
			case 's':
				flags |= SFLAG; break;
			case 'b':
				flags |= BFLAG; break;
			case 'k':
				flags |= KFLAG; break;
			case 'r':
				flags |= RFLAG; break;
			case 'e':
				if (!get_rsa ((u_int32_t *)&entry, optarg)) {
					err++;
				}
				break;
			case 'o':
				if (!get_rsa ((u_int32_t *)&offset, optarg)) {
					err++;
				}
				break;
			default:
				err++;
				break;
		}
	}

	if (err) {
		return EXIT_FAILURE;
	}

	if (optind < argc) {
		strcpy(path, argv[optind++]);
	} 
	else if (getenv("bootfile")) {
		strcpy(path, getenv("bootfile"));
	}
	else {
		printf("boot what?\n");
		return EXIT_FAILURE;
	}

	if ((bootfd = open (path, O_RDONLY | O_NONBLOCK)) < 0) {
		perror (path);
		return EXIT_FAILURE;
	}

	dl_initialise (offset, flags);

	fprintf (stderr, "Loading file: %s ", path);
	errno = 0;
	n = 0;
	if (flags & RFLAG) {
		ExecId id;

		id = getExec("bin");
		if (id != NULL) {
			ep = exec (id, bootfd, buf, &n, flags);
		} else {
			perror ("Can't find binary loader");
			return EXIT_FAILURE;
		}
	} else {
		ep = exec (NULL, bootfd, buf, &n, flags);
	}

	close (bootfd);
	putc ('\n', stderr);

	if (ep == -1) {
		fprintf (stderr, "%s: boot failed\n", path);
		return EXIT_FAILURE;
	}

	if (ep == -2) {
		fprintf (stderr, "%s: invalid file format\n", path);
		return EXIT_FAILURE;
	}

	if (entry)
		dl_entry = entry;
	else
		dl_entry = ep;

	sprintf(clientcmd, "boot %s ", path);
	while (optind < argc) {
		strcat(clientcmd, argv[optind++]);
		strcat(clientcmd, " ");
	}

	md_setentry(NULL, (register_t)(int)dl_entry); /* set start address */
	clientac = argvize (clientav, clientcmd);
	initstack (clientac, clientav, 1);
	clrhndlrs ();
	closelst (2);		/* Init client terminal state */
	md_setsr(NULL, initial_sr);
	tgt_enable(tgt_getmachtype ()); /* set up i/u hardware */

#ifdef __powerpc__
	if(getenv("vxWorks")) {
		strcpy ((void *)0x4200, getenv ("vxWorks"));
	}
#endif

	/* Flush caches if they are enabled */
	if (md_cachestat())
		flush_cache (DCACHE | ICACHE, NULL);

	if (setjmp (go_return_jump) == 0) {
		goclient ();
	}

	console_state(1);
	return 0;
}