summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2011-08-08 20:36:00 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2011-08-08 20:36:00 +0200
commit42dd2d07fe194454dbc4027f3c02164f03be9eb4 (patch)
treea85286b0d5859d116e38737679e4bf7e1ee0196b
parentbf946c17ca7cb2014aad604c253f4fa4660684da (diff)
Let GNU Mach messages appear under Hurd console
* console-client/vga-dynafont.c (dynafont_new): Force ASCII glyphs as being always trivially mapped. * console-client/vga-hw.h (VGA_VIDEO_MEM_BASE_ADDR): Set macro to 0x0b8000. * console-client/vga-support.c [!OSKIT_MACH]: Do not include <device/device.h> and <hurd.h>, remove VIDMMAP_BEGIN, VIDMMAP_SIZE and VIDMMAP_KDOFS macros. (vga_init): Remove code which maps video memory from the kd device. Use VGA_GFX_MISC_B8TOBF instead of VGA_GFX_MISC_A0TOAF or VGA_GFX_MISC_A0TOBF.
-rw-r--r--console-client/vga-dynafont.c25
-rw-r--r--console-client/vga-hw.h2
-rw-r--r--console-client/vga-support.c54
3 files changed, 28 insertions, 53 deletions
diff --git a/console-client/vga-dynafont.c b/console-client/vga-dynafont.c
index f72e45de..834d0aca 100644
--- a/console-client/vga-dynafont.c
+++ b/console-client/vga-dynafont.c
@@ -529,6 +529,31 @@ dynafont_new (bdf_font_t font, bdf_font_t font_italic, bdf_font_t font_bold,
df->vga_font_last_free_index_lgc = 0;
}
+ /* Ensure that ASCII is always available 1-to-1, for kernel messages. */
+ for (int c = ' '; c <= '~'; c++)
+ {
+ glyph = bdf_find_glyph (df->font, c, 0);
+ if (!glyph)
+ glyph = bdf_find_glyph (df->font, -1, c);
+ if (glyph)
+ {
+ struct mapped_character *chr = &df->charmap_data[c];
+ df->vga_font_free_indices--;
+ chr->refs = 1;
+
+ for (int i = 0; i < ((glyph->bbox.height > 32)
+ ? 32 : glyph->bbox.height); i++)
+ df->vga_font[c][i]
+ = glyph->bitmap[i * ((glyph->bbox.width + 7) / 8)];
+ if (glyph->bbox.height < 32)
+ memset (((char *) df->vga_font[c])
+ + glyph->bbox.height, 0, 32 - glyph->bbox.height);
+
+ /* Update the hash table. */
+ hurd_ihash_add (&df->charmap, c, chr);
+ }
+ }
+
/* Ensure that we always have the replacement character
available. */
{
diff --git a/console-client/vga-hw.h b/console-client/vga-hw.h
index 6be87d31..7275b03e 100644
--- a/console-client/vga-hw.h
+++ b/console-client/vga-hw.h
@@ -21,7 +21,7 @@
#ifndef _VGA_HW_H_
#define _VGA_HW_H_ 1
-#define VGA_VIDEO_MEM_BASE_ADDR 0x0a0000
+#define VGA_VIDEO_MEM_BASE_ADDR 0x0b8000
#define VGA_VIDEO_MEM_LENGTH 0x004000
#define VGA_FONT_BUFFER 8
diff --git a/console-client/vga-support.c b/console-client/vga-support.c
index bce6f8e9..2837a6e0 100644
--- a/console-client/vga-support.c
+++ b/console-client/vga-support.c
@@ -59,19 +59,6 @@ struct vga_state
static struct vga_state *vga_state;
-#if OSKIT_MACH
-#else
-
-#include <device/device.h>
-#include <hurd.h>
-
-/* Constants from Mach. */
-#define VIDMMAP_BEGIN 0xA0000
-#define VIDMMAP_SIZE (0xC0000 - 0xA0000)
-#define VIDMMAP_KDOFS 0xA0000 /* == kd_bitmap_start in mach/i386/i386at/kd.c */
-
-#endif
-
error_t
vga_init (void)
{
@@ -101,43 +88,6 @@ vga_init (void)
if (vga_videomem == (void *) -1)
return err;
}
- else if (errno == ENXIO)
- {
- /* GNU Mach v1 does not provide /dev/mem, but allows direct
- memory access to the video memory through the special "kd"
- kernel device. */
- device_t device_master = MACH_PORT_NULL;
- memory_object_t kd_mem = MACH_PORT_NULL;
- static device_t kd_device = MACH_PORT_NULL;
- vm_address_t mapped;
-
- err = get_privileged_ports (0, &device_master);
- if (err)
- return err;
-
- err = device_open (device_master, D_WRITE, "kd", &kd_device);
- if (err)
- return err;
-
- err = device_map (kd_device, VM_PROT_READ | VM_PROT_WRITE,
- VIDMMAP_BEGIN - VIDMMAP_KDOFS, VIDMMAP_SIZE,
- &kd_mem, 0);
- if (err)
- return err;
-
- err = vm_map (mach_task_self (), &mapped, VIDMMAP_SIZE,
- 0, 1, kd_mem, VIDMMAP_BEGIN - VIDMMAP_KDOFS, 0,
- VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE,
- VM_INHERIT_NONE);
- if (err)
- return err;
-
- vga_videomem = (char *) mapped;
- assert (vga_videomem != NULL);
-
- mach_port_deallocate (mach_task_self (), device_master);
- mach_port_deallocate (mach_task_self (), kd_mem);
- }
else
return errno;
@@ -175,7 +125,7 @@ vga_init (void)
/* Read/write in interleaved mode. */
outb (VGA_GFX_MISC_ADDR, VGA_GFX_ADDR_REG);
- outb (VGA_GFX_MISC_CHAINOE | VGA_GFX_MISC_A0TOAF, VGA_GFX_DATA_REG);
+ outb (VGA_GFX_MISC_CHAINOE | VGA_GFX_MISC_B8TOBF, VGA_GFX_DATA_REG);
outb (VGA_GFX_MODE_ADDR, VGA_GFX_ADDR_REG);
outb (VGA_GFX_MODE_HOSTOE, VGA_GFX_DATA_REG);
@@ -269,7 +219,7 @@ vga_read_write_font_buffer (int write, int buffer, int index,
outb (VGA_GFX_MODE_READ0, VGA_GFX_DATA_REG);
outb (VGA_GFX_MISC_ADDR, VGA_GFX_ADDR_REG);
saved_gfx_misc = inb (VGA_GFX_DATA_REG);
- outb (VGA_GFX_MISC_A0TOBF, VGA_GFX_DATA_REG);
+ outb (VGA_GFX_MISC_B8TOBF, VGA_GFX_DATA_REG);
if (write)
memcpy (vga_videomem + offset, data, datalen);