0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _LINUX_VT_BUFFER_H_
0015 #define _LINUX_VT_BUFFER_H_
0016
0017 #include <linux/string.h>
0018
0019 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_MDA_CONSOLE)
0020 #include <asm/vga.h>
0021 #endif
0022
0023 #ifndef VT_BUF_HAVE_RW
0024 #define scr_writew(val, addr) (*(addr) = (val))
0025 #define scr_readw(addr) (*(addr))
0026 #endif
0027
0028 #ifndef VT_BUF_HAVE_MEMSETW
0029 static inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
0030 {
0031 #ifdef VT_BUF_HAVE_RW
0032 count /= 2;
0033 while (count--)
0034 scr_writew(c, s++);
0035 #else
0036 memset16(s, c, count / 2);
0037 #endif
0038 }
0039 #endif
0040
0041 #ifndef VT_BUF_HAVE_MEMCPYW
0042 static inline void scr_memcpyw(u16 *d, const u16 *s, unsigned int count)
0043 {
0044 #ifdef VT_BUF_HAVE_RW
0045 count /= 2;
0046 while (count--)
0047 scr_writew(scr_readw(s++), d++);
0048 #else
0049 memcpy(d, s, count);
0050 #endif
0051 }
0052 #endif
0053
0054 #ifndef VT_BUF_HAVE_MEMMOVEW
0055 static inline void scr_memmovew(u16 *d, const u16 *s, unsigned int count)
0056 {
0057 #ifdef VT_BUF_HAVE_RW
0058 if (d < s)
0059 scr_memcpyw(d, s, count);
0060 else {
0061 count /= 2;
0062 d += count;
0063 s += count;
0064 while (count--)
0065 scr_writew(scr_readw(--s), --d);
0066 }
0067 #else
0068 memmove(d, s, count);
0069 #endif
0070 }
0071 #endif
0072
0073 #endif