1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
--- cjktty-6.12.0.patch 2025-07-31 22:41:33.905765387 +0800
+++ cjktty-6.12.58+.patch 2025-12-19 15:31:48.339887605 +0800
@@ -652,7 +652,7 @@
#include <asm/types.h>
#include "fbcon.h"
-@@ -43,6 +44,51 @@ static void update_attr(u8 *dst, u8 *src, int attribute,
+@@ -43,6 +44,54 @@ static void update_attr(u8 *dst, u8 *src, int attribute,
}
}
@@ -676,9 +676,12 @@
+ char *fontname = (cellsize < 64) ? "CJK16x16" : "CJK32x32";
+ const struct font_desc *font;
+
++ u16 ch = scr_readw(s) & charmask;
++ if (ch >= vc->vc_font.charcount)
++ ch = 0;
+ fontdata = ops ? ops->fontbuffer : vc->vc_font.data;
-+ src = fontdata + (scr_readw(s) & charmask) * cellsize;
-+ if ((scr_readw(s) & charmask) != 0xff && (scr_readw(s) & charmask) != 0xfe)
++ src = fontdata + (unsigned int)ch * cellsize;
++ if (ch != 0xff && ch != 0xfe)
+ return src;
+
+ /* assume current font not support unicode */
@@ -692,7 +695,7 @@
+ }
+ if (fontdata) {
+ c_utf = utf8_pos(vc, s);
-+ if ((scr_readw(s) & charmask) == 0xff)
++ if (ch == 0xff)
+ src = fontdata + (c_utf * cellsize_utf * 2);
+ else
+ src = fontdata + (c_utf * cellsize_utf * 2 + cellsize_utf);
@@ -704,27 +707,45 @@
static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy,
int sx, int dy, int dx, int height, int width)
{
-@@ -84,8 +130,7 @@ static inline void bit_putcs_aligned(struct vc_data *vc, struct fb_info *info,
+@@ -79,16 +128,11 @@ static inline void bit_putcs_aligned(struct vc_data *vc, struct fb_info *info,
+ struct fb_image *image, u8 *buf, u8 *dst)
+ {
+ u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
+- unsigned int charcnt = vc->vc_font.charcount;
+ u32 idx = vc->vc_font.width >> 3;
u8 *src;
while (cnt--) {
-- src = vc->vc_font.data + (scr_readw(s++)&
-- charmask)*cellsize;
+- u16 ch = scr_readw(s++) & charmask;
+-
+- if (ch >= charcnt)
+- ch = 0;
+- src = vc->vc_font.data + (unsigned int)ch * cellsize;
+ src = font_bits(vc, s++, cellsize, charmask, NULL);
if (attr) {
update_attr(buf, src, attr, vc);
-@@ -119,8 +164,7 @@ static inline void bit_putcs_unaligned(struct vc_data *vc,
+@@ -116,18 +160,13 @@ static inline void bit_putcs_unaligned(struct vc_data *vc,
+ u8 *dst)
+ {
+ u16 charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
+- unsigned int charcnt = vc->vc_font.charcount;
+ u32 shift_low = 0, mod = vc->vc_font.width % 8;
+ u32 shift_high = 8;
+ u32 idx = vc->vc_font.width >> 3;
u8 *src;
while (cnt--) {
-- src = vc->vc_font.data + (scr_readw(s++)&
-- charmask)*cellsize;
+- u16 ch = scr_readw(s++) & charmask;
+-
+- if (ch >= charcnt)
+- ch = 0;
+- src = vc->vc_font.data + (unsigned int)ch * cellsize;
+ src = font_bits(vc, s++, cellsize, charmask, NULL);
if (attr) {
update_attr(buf, src, attr, vc);
-@@ -252,7 +296,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, bool enable,
+@@ -276,7 +315,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, bool enable,
c = scr_readw((u16 *) vc->vc_pos);
attribute = get_attribute(info, c);
|