[PATCH] bcm43xx: Fix array overrun in bcm43xx_geo_init
[linux-2.6/kmemtrace.git] / include / linux / vt_buffer.h
blob1f7ba3629053684d902d45d16cbdfc2122974a2f
1 /*
2 * include/linux/vt_buffer.h -- Access to VT screen buffer
4 * (c) 1998 Martin Mares <mj@ucw.cz>
6 * This is a set of macros and functions which are used in the
7 * console driver and related code to access the screen buffer.
8 * In most cases the console works with simple in-memory buffer,
9 * but when handling hardware text mode consoles, we store
10 * the foreground console directly in video memory.
13 #ifndef _LINUX_VT_BUFFER_H_
14 #define _LINUX_VT_BUFFER_H_
16 #include <linux/config.h>
18 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
19 #include <asm/vga.h>
20 #endif
22 #ifndef VT_BUF_HAVE_RW
23 #define scr_writew(val, addr) (*(addr) = (val))
24 #define scr_readw(addr) (*(addr))
25 #define scr_memcpyw(d, s, c) memcpy(d, s, c)
26 #define scr_memmovew(d, s, c) memmove(d, s, c)
27 #define VT_BUF_HAVE_MEMCPYW
28 #define VT_BUF_HAVE_MEMMOVEW
29 #endif
31 #ifndef VT_BUF_HAVE_MEMSETW
32 static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
34 count /= 2;
35 while (count--)
36 scr_writew(c, s++);
38 #endif
40 #ifndef VT_BUF_HAVE_MEMCPYW
41 static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
43 count /= 2;
44 while (count--)
45 scr_writew(scr_readw(s++), d++);
47 #endif
49 #ifndef VT_BUF_HAVE_MEMMOVEW
50 static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
52 if (d < s)
53 scr_memcpyw(d, s, count);
54 else {
55 count /= 2;
56 d += count;
57 s += count;
58 while (count--)
59 scr_writew(scr_readw(--s), --d);
62 #endif
64 #endif