2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* console_struct.h
|
|
|
|
*
|
|
|
|
* Data structure describing single virtual console except for data
|
|
|
|
* used by vt.c.
|
|
|
|
*
|
|
|
|
* Fields marked with [#] must be set by the low-level driver.
|
|
|
|
* Fields marked with [!] can be changed by the low-level driver
|
|
|
|
* to achieve effects such as fast scrolling by changing the origin.
|
|
|
|
*/
|
|
|
|
|
2007-06-08 22:47:07 +02:00
|
|
|
#ifndef _LINUX_CONSOLE_STRUCT_H
|
|
|
|
#define _LINUX_CONSOLE_STRUCT_H
|
|
|
|
|
2006-07-10 13:44:12 +02:00
|
|
|
#include <linux/wait.h>
|
2005-11-07 10:00:51 +01:00
|
|
|
#include <linux/vt.h>
|
2007-02-10 10:44:34 +01:00
|
|
|
#include <linux/workqueue.h>
|
2005-11-07 10:00:51 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
struct vt_struct;
|
|
|
|
|
|
|
|
#define NPAR 16
|
|
|
|
|
|
|
|
struct vc_data {
|
|
|
|
unsigned short vc_num; /* Console number */
|
|
|
|
unsigned int vc_cols; /* [#] Console size */
|
|
|
|
unsigned int vc_rows;
|
|
|
|
unsigned int vc_size_row; /* Bytes per row */
|
|
|
|
unsigned int vc_scan_lines; /* # of scan lines */
|
|
|
|
unsigned long vc_origin; /* [!] Start of real screen */
|
|
|
|
unsigned long vc_scr_end; /* [!] End of real screen */
|
|
|
|
unsigned long vc_visible_origin; /* [!] Top of visible window */
|
|
|
|
unsigned int vc_top, vc_bottom; /* Scrolling region */
|
|
|
|
const struct consw *vc_sw;
|
|
|
|
unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */
|
|
|
|
unsigned int vc_screenbuf_size;
|
|
|
|
unsigned char vc_mode; /* KD_TEXT, ... */
|
|
|
|
/* attributes for all characters on screen */
|
|
|
|
unsigned char vc_attr; /* Current attributes */
|
|
|
|
unsigned char vc_def_color; /* Default colors */
|
|
|
|
unsigned char vc_color; /* Foreground & background */
|
|
|
|
unsigned char vc_s_color; /* Saved foreground & background */
|
|
|
|
unsigned char vc_ulcolor; /* Color for underline mode */
|
2007-05-08 09:38:04 +02:00
|
|
|
unsigned char vc_itcolor;
|
2005-04-17 00:20:36 +02:00
|
|
|
unsigned char vc_halfcolor; /* Color for half intensity mode */
|
|
|
|
/* cursor */
|
|
|
|
unsigned int vc_cursor_type;
|
|
|
|
unsigned short vc_complement_mask; /* [#] Xor mask for mouse pointer */
|
|
|
|
unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */
|
|
|
|
unsigned int vc_x, vc_y; /* Cursor position */
|
|
|
|
unsigned int vc_saved_x, vc_saved_y;
|
|
|
|
unsigned long vc_pos; /* Cursor address */
|
|
|
|
/* fonts */
|
|
|
|
unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */
|
|
|
|
struct console_font vc_font; /* Current VC font set */
|
|
|
|
unsigned short vc_video_erase_char; /* Background erase character */
|
vt: fix background color on line feed
A command that causes a line feed while a background color is active,
such as
perl -e 'print "x" x 60, "\e[44m", "x" x 40, "\e[0m\n"'
and
perl -e 'print "x" x 40, "\e[44m\n", "x" x 40, "\e[0m\n"'
causes the line that was started as a result of the line feed to be completely
filled with the currently active background color instead of the default
color.
When scrolling, part of the current screen is memcpy'd/memmove'd to the new
region, and the new line(s) that will appear as a result are cleared using
memset. However, the lines are cleared with vc->vc_video_erase_char, causing
them to be colored with the currently active background color. This is
different from X11 terminal emulators which always paint the new lines with
the default background color (e.g. `xterm -bg black`).
The clear operation (\e[1J and \e[2J) also use vc_video_erase_char, so a new
vc->vc_scrl_erase_char is introduced with contains the erase character used
for scrolling, which is built from vc->vc_def_color instead of vc->vc_color.
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 09:59:46 +02:00
|
|
|
unsigned short vc_scrl_erase_char; /* Erase character for scroll */
|
2005-04-17 00:20:36 +02:00
|
|
|
/* VT terminal data */
|
|
|
|
unsigned int vc_state; /* Escape sequence parser state */
|
|
|
|
unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
|
|
|
|
struct tty_struct *vc_tty; /* TTY we are attached to */
|
|
|
|
/* data for manual vt switching */
|
|
|
|
struct vt_mode vt_mode;
|
2006-10-02 11:17:14 +02:00
|
|
|
struct pid *vt_pid;
|
2005-04-17 00:20:36 +02:00
|
|
|
int vt_newvt;
|
|
|
|
wait_queue_head_t paste_wait;
|
|
|
|
/* mode flags */
|
|
|
|
unsigned int vc_charset : 1; /* Character set G0 / G1 */
|
|
|
|
unsigned int vc_s_charset : 1; /* Saved character set */
|
|
|
|
unsigned int vc_disp_ctrl : 1; /* Display chars < 32? */
|
|
|
|
unsigned int vc_toggle_meta : 1; /* Toggle high bit? */
|
|
|
|
unsigned int vc_decscnm : 1; /* Screen Mode */
|
|
|
|
unsigned int vc_decom : 1; /* Origin Mode */
|
|
|
|
unsigned int vc_decawm : 1; /* Autowrap Mode */
|
|
|
|
unsigned int vc_deccm : 1; /* Cursor Visible */
|
|
|
|
unsigned int vc_decim : 1; /* Insert Mode */
|
|
|
|
unsigned int vc_deccolm : 1; /* 80/132 Column Mode */
|
|
|
|
/* attribute flags */
|
|
|
|
unsigned int vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */
|
2007-05-08 09:38:04 +02:00
|
|
|
unsigned int vc_italic:1;
|
2005-04-17 00:20:36 +02:00
|
|
|
unsigned int vc_underline : 1;
|
|
|
|
unsigned int vc_blink : 1;
|
|
|
|
unsigned int vc_reverse : 1;
|
|
|
|
unsigned int vc_s_intensity : 2; /* saved rendition */
|
2007-05-08 09:38:04 +02:00
|
|
|
unsigned int vc_s_italic:1;
|
2005-04-17 00:20:36 +02:00
|
|
|
unsigned int vc_s_underline : 1;
|
|
|
|
unsigned int vc_s_blink : 1;
|
|
|
|
unsigned int vc_s_reverse : 1;
|
|
|
|
/* misc */
|
|
|
|
unsigned int vc_ques : 1;
|
|
|
|
unsigned int vc_need_wrap : 1;
|
|
|
|
unsigned int vc_can_do_color : 1;
|
|
|
|
unsigned int vc_report_mouse : 2;
|
|
|
|
unsigned int vc_kmalloced : 1;
|
|
|
|
unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */
|
|
|
|
unsigned char vc_utf_count;
|
|
|
|
int vc_utf_char;
|
|
|
|
unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */
|
|
|
|
unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */
|
|
|
|
unsigned short * vc_translate;
|
|
|
|
unsigned char vc_G0_charset;
|
|
|
|
unsigned char vc_G1_charset;
|
|
|
|
unsigned char vc_saved_G0;
|
|
|
|
unsigned char vc_saved_G1;
|
vt/vgacon: Check if screen resize request comes from userspace
Various console drivers are able to resize the screen via the con_resize()
hook. This hook is also visible in userspace via the TIOCWINSZ, VT_RESIZE and
VT_RESIZEX ioctl's. One particular utility, SVGATextMode, expects that
con_resize() of the VGA console will always return success even if the
resulting screen is not compatible with the hardware. However, this
particular behavior of the VGA console, as reported in Kernel Bugzilla Bug
7513, can cause undefined behavior if the user starts with a console size
larger than 80x25.
To work around this problem, add an extra parameter to con_resize(). This
parameter is ignored by drivers except for vgacon. If this parameter is
non-zero, then the resize request came from a VT_RESIZE or VT_RESIZEX ioctl
and vgacon will always return success. If this parameter is zero, vgacon will
return -EINVAL if the requested size is not compatible with the hardware. The
latter is the more correct behavior.
With this change, SVGATextMode should still work correctly while in-kernel and
stty resize calls can expect correct behavior from vgacon.
Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-16 10:29:35 +02:00
|
|
|
unsigned int vc_resize_user; /* resize request from user */
|
2005-04-17 00:20:36 +02:00
|
|
|
unsigned int vc_bell_pitch; /* Console bell pitch */
|
|
|
|
unsigned int vc_bell_duration; /* Console bell duration */
|
|
|
|
struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
|
|
|
|
unsigned long vc_uni_pagedir;
|
|
|
|
unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
|
|
|
|
/* additional information is in vt_kern.h */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vc {
|
|
|
|
struct vc_data *d;
|
2007-02-10 10:44:34 +01:00
|
|
|
struct work_struct SAK_work;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/* might add scrmem, vt_struct, kbd at some time,
|
|
|
|
to have everything in one place - the disadvantage
|
|
|
|
would be that vc_cons etc can no longer be static */
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct vc vc_cons [MAX_NR_CONSOLES];
|
2007-02-10 10:44:34 +01:00
|
|
|
extern void vc_SAK(struct work_struct *work);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#define CUR_DEF 0
|
|
|
|
#define CUR_NONE 1
|
|
|
|
#define CUR_UNDERLINE 2
|
|
|
|
#define CUR_LOWER_THIRD 3
|
|
|
|
#define CUR_LOWER_HALF 4
|
|
|
|
#define CUR_TWO_THIRDS 5
|
|
|
|
#define CUR_BLOCK 6
|
|
|
|
#define CUR_HWMASK 0x0f
|
|
|
|
#define CUR_SWMASK 0xfff0
|
|
|
|
|
|
|
|
#define CUR_DEFAULT CUR_UNDERLINE
|
|
|
|
|
|
|
|
#define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)
|
2007-06-08 22:47:07 +02:00
|
|
|
|
|
|
|
#endif /* _LINUX_CONSOLE_STRUCT_H */
|