/* Our first setup routine is the console. It's a fairly simple device, but UNIX tty handling makes it uglier than it could be.  */
static void setup_console(void)
/* Our first setup routine is the console. It's a fairly simple device, but UNIX tty handling makes it uglier than it could be.  */
static void setup_console(void)
{
	struct device *dev;
	if (tcgetattr(STDIN_FILENO, &orig_term) == 0) {
		struct termios term = orig_term;
		term.c_lflag &= ~(ISIG|ICANON|ECHO);
		tcsetattr(STDIN_FILENO, TCSANOW, &term);
	}
	dev = new_device("console", VIRTIO_ID_CONSOLE);
	dev->priv = malloc(sizeof(struct console_abort));
	((struct console_abort *)dev->priv)->count = 0;
	add_virtqueue(dev, VIRTQUEUE_NUM, console_input);
	add_virtqueue(dev, VIRTQUEUE_NUM, console_output);
	verbose("device %u: console\n", ++devices.device_num);
}