genode/ports/src/vancouver/console.h
Markus Partheymueller 1ca0a66ea9 vancouver: Console support
The guest VM can now be provided with a framebuffer and keyboard input.

Mouse positioning of the guest is a problem. Because the PS2 model applies
some calculations to the movement values, it can happen that overflows mess
with the cursor.  Therefore the handling was changed and only movements of 1
and -1 are sent.  Since absolute positioning is not possible with PS2, we
have to live with this limitation until USB HID is implemented.

For the framebuffer size in Vancouver the configuration value in the machine
XML node is used.  It is possible to map the corresponding memory area
directly to the guest, regardless if it is from nitpicker,
liquid_framebuffer or vesa_drv.  The guest is provided with two modes (text
mode 3 and graphics mode 0x114 (0x314 in Linux).

Pressing LWIN+END while a VM has focus resets the virtual machine. Also,
RESET and DEBUG key presses will not be forwarded to the VM anymore.
It is possible to dump a VM's state by pressing LWIN+INS keys.

The text console is able to detect idle mode, unmaps the buffer from the
guest and stops interpreting.  Upon the next pagefault in this area, it
resumes operation again.  The code uses a simple checksum mechanism instead
of a large buffer and memcmp to detect an idle text console.  False
positives don't matter very much.
2013-02-13 15:09:22 +01:00

75 lines
1.9 KiB
C++

/*
* \brief Manager of all VM requested console functionality
* \author Markus Partheymueller
* \date 2012-07-31
*/
/*
* Copyright (C) 2012 Intel Corporation
* Copyright (C) 2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*
* The code is partially based on the Vancouver VMM, which is distributed
* under the terms of the GNU General Public License version 2.
*
* Modifications by Intel Corporation are contributed under the terms and
* conditions of the GNU General Public License version 2.
*/
#ifndef _CONSOLE_H_
#define _CONSOLE_H_
/* Genode includes */
#include <util/string.h>
#include <base/sleep.h>
#include <framebuffer_session/connection.h>
#include <input_session/connection.h>
#include <timer_session/connection.h>
#include <dataspace/client.h>
/* NOVA userland includes */
#include <nul/motherboard.h>
/* includes for I/O */
#include <base/env.h>
#include <util/list.h>
#include <nitpicker_session/connection.h>
#include <nitpicker_view/client.h>
#include <input/event.h>
using Genode::List;
using Genode::Thread;
class Vancouver_console : public Thread<8192>, public StaticReceiver<Vancouver_console>
{
private:
Motherboard &_mb;
short *_pixels;
char *_guest_fb;
unsigned long _fb_size;
Genode::Dataspace_capability _fb_ds;
Genode::size_t _vm_fb_size;
VgaRegs *_regs;
Framebuffer::Mode _fb_mode;
public:
/* bus callbacks */
bool receive(MessageConsole &msg);
bool receive(MessageMemRegion &msg);
/* initialisation */
void entry();
/**
* Constructor
*/
Vancouver_console(Motherboard &mb, Genode::size_t vm_fb_size,
Genode::Dataspace_capability fb_ds);
};
#endif /* _CONSOLE_H_ */