Ejemplo n.º 1
0
void
vpn_user_init (struct config_data_vpn *vpn, char *seed, int len)
{
	int d, d1;
	struct config_data_vpn *p;
	char *q;
	struct msgbuf buf[2];

	mp = mempool_new (0, 1, true);
	d = newprocess ("vpn");
	if (d < 0)
		panic ("newprocess vpn");
	d1 = msgopen ("ttyout");
	if (d1 < 0)
		panic ("msgopen ttyout");
	msgsenddesc (d, d1);
	msgsenddesc (d, d1);
	msgclose (d1);
	p = mempool_allocmem (mp, sizeof *p);
	memcpy (p, vpn, sizeof *p);
	q = mempool_allocmem (mp, len);
	memcpy (q, seed, len);
	setmsgbuf (&buf[0], p, sizeof *p, 0);
	setmsgbuf (&buf[1], q, sizeof *q, 0);
	if (msgsendbuf (d, 0, buf, 2))
		panic ("vpn init failed");
	mempool_freemem (mp, q);
	mempool_freemem (mp, p);
	msgclose (d);
}
Ejemplo n.º 2
0
void
sendex (char *buf)
{
	unsigned char d[32];
	int a, i;

	a = msgopen ("recvex");
	if (a < 0) {
		printf ("msgopen failed.\n");
		return;
	}
	memset (d, 0, 32);
	printf ("sending buf %p len 0x%x recvbuf %p len 0x%lx\n",
		buf, strlen (buf), d, (unsigned long)sizeof d);
	if (msgsendbuf (a, 0, buf, strlen (buf), d, sizeof d)) {
		printf ("msgsendbuf failed.\n");
		msgclose (a);
		return;
	}
	msgclose (a);
	printf ("received: ");
	for (i = 0; i < 32; i++)
		printf ("0x%02x ", d[i]);
	printf ("\n");
}
Ejemplo n.º 3
0
void
do_panic_reboot (void)
{
	int d;

	printf ("Reboot in 5 seconds...\n");
	sleep_set_timer_counter ();
	usleep (5 * 1000000);
	printf ("Rebooting...");
	usleep (1 * 1000000);
	d = msgopen ("reboot");
	if (d >= 0) {
		msgsendint (d, 0);
		msgclose (d);
		printf ("Reboot failed.\n");
	} else
		printf ("reboot not found.\n");
}
Ejemplo n.º 4
0
void
handle_init_to_bsp (void)
{
	int d;

	if (config.vmm.auto_reboot == 1) {
		d = msgopen ("reboot");
		if (d >= 0) {
			msgsendint (d, 0);
			msgclose (d);
			printf ("Reboot failed.\n");
		} else {
			printf ("reboot not found.\n");
		}
	}
	if (config.vmm.auto_reboot)
		auto_reboot ();
	panic ("INIT signal to BSP");
}
Ejemplo n.º 5
0
static void
dbgsh_thread (void *arg)
{
	int shell, ttyin, ttyout;

	msgregister ("dbgsh_ttyin", dbgsh_ttyin_msghandler);
	msgregister ("dbgsh_ttyout", dbgsh_ttyout_msghandler);
	debug_msgregister ();
	ttyin = msgopen ("dbgsh_ttyin");
	ttyout = msgopen ("dbgsh_ttyout");
	for (;;) {
		shell = newprocess ("shell");
		if (ttyin < 0 || ttyout < 0 || shell < 0)
			panic ("dbgsh_thread");
		msgsenddesc (shell, ttyin);
		msgsenddesc (shell, ttyout);
		msgsendint (shell, 0);
		msgclose (shell);
		schedule ();
	}
}