summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-03-29 17:23:01 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-03-29 17:23:01 +0000
commit65af864ceb4b30a8126a2ead04f6bbceb5b4d795 (patch)
tree8f3779f9f751bbdcd9e1982995950ccdb581a4cd /sys
parent0a0369a02469a60afecdc199d3962fbfbcdbcb2b (diff)
In vga_load_font(), keep track of the font bits being passed by the caller,
should the need to free them arise; and only perform the `use font' logic if we are in the `use font' case (i.e. font->data == NULL). Prompted by a discussion with dan mclaughlin on tech@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/vga.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c
index 688fbfd2349..cb35acfaa6a 100644
--- a/sys/dev/ic/vga.c
+++ b/sys/dev/ic/vga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga.c,v 1.63 2014/07/13 23:10:23 deraadt Exp $ */
+/* $OpenBSD: vga.c,v 1.64 2015/03/29 17:23:00 miod Exp $ */
/* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */
/*-
@@ -86,14 +86,17 @@ static struct vgafont {
int firstchar, numchars;
#endif
int slot;
+ void *fontdata;
} vga_builtinfont = {
- "builtin",
- 16,
- WSDISPLAY_FONTENC_IBM,
+ .name = "builtin",
+ .height = 16,
+ .encoding = WSDISPLAY_FONTENC_IBM,
#ifdef notyet
- 0, 256,
+ .firstchar = 0,
+ .numchars = 256,
#endif
- 0
+ .slot = 0,
+ .fontdata = NULL
};
int vgaconsole, vga_console_type, vga_console_attached;
@@ -838,7 +841,10 @@ vga_load_font(void *v, void *cookie, struct wsdisplay_font *data)
int res, slot;
struct vgafont *f;
- if (scr) {
+ if (data->data == NULL) {
+ if (scr == NULL)
+ return EINVAL;
+
if ((name2 = data->name) != NULL) {
while (*name2 && *name2 != ',')
name2++;
@@ -846,7 +852,7 @@ vga_load_font(void *v, void *cookie, struct wsdisplay_font *data)
*name2++ = '\0';
}
res = vga_selectfont(vc, scr, data->name, name2);
- if (!res)
+ if (res == 0)
vga_setfont(vc, scr);
return (res);
}
@@ -884,6 +890,7 @@ vga_load_font(void *v, void *cookie, struct wsdisplay_font *data)
#endif
vga_loadchars(&vc->hdl, slot, 0, 256, f->height, data->data);
f->slot = slot;
+ f->fontdata = data->data;
vc->vc_fonts[slot] = f;
data->cookie = f;
data->index = slot;