Revert all parts done for BIOS keymap translation

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-08-19 13:32:36 +02:00
parent eb628338db
commit ed19677fe3
14 changed files with 166 additions and 347 deletions

View file

@ -1147,6 +1147,11 @@ FUNCTION(grub_console_putchar)
ret
LOCAL(bypass_table):
.word 0x0100 | '\e',0x0f00 | '\t', 0x0e00 | '\b', 0x1c00 | '\r'
.word 0x1c00 | '\n'
LOCAL(bypass_table_end):
/*
* int grub_console_getkey (void)
* BIOS call "INT 16H Function 00H" to read character from keyboard
@ -1180,17 +1185,39 @@ FUNCTION(grub_console_getkey)
movb $0, %ah
int $0x16
xorl %edx, %edx
movw %ax, %dx /* real_to_prot uses %eax */
DATA32 call real_to_prot
.code32
movw %dx, %ax
movl $0xff, %eax
testl %eax, %edx
jz 1f
andl %edx, %eax
cmp %eax, 0x20
ja 2f
movl %edx, %eax
leal LOCAL(bypass_table), %esi
movl $((LOCAL(bypass_table_end) - LOCAL(bypass_table)) / 2), %ecx
repne cmpsw
jz 3f
addl $('a' - 1 | GRUB_TERM_CTRL), %eax
jmp 2f
3:
andl $0xff, %eax
jmp 2f
1: movl %edx, %eax
shrl $8, %eax
orl $GRUB_TERM_EXTENDED, %eax
2:
popl %ebp
ret
/*
* int grub_console_checkkey (void)
* if there is a character pending, return it; otherwise return -1
@ -1216,6 +1243,7 @@ FUNCTION(grub_console_checkkey)
jz notpending
xorl %edx, %edx
movw %ax, %dx
DATA32 jmp pending
@ -1226,8 +1254,6 @@ pending:
DATA32 call real_to_prot
.code32
movl %edx, %eax
popl %ebp
ret

View file

@ -22,11 +22,13 @@
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/time.h>
#include <grub/keyboard_layouts.h>
struct grub_term_output *grub_term_outputs_disabled;
struct grub_term_input *grub_term_inputs_disabled;
struct grub_term_output *grub_term_outputs;
struct grub_term_input *grub_term_inputs;
struct grub_keyboard_layout *grub_current_layout;
/* Put a Unicode character. */
static void
@ -76,8 +78,8 @@ grub_xputs_dumb (const char *str)
void (*grub_xputs) (const char *str) = grub_xputs_dumb;
static int
grub_getkey_dumb (void)
int
grub_getkey (void)
{
grub_term_input_t term;
@ -89,14 +91,27 @@ grub_getkey_dumb (void)
{
int key = term->checkkey (term);
if (key != -1)
return term->getkey (term) & 0xff;
return term->getkey (term);
}
grub_cpu_idle ();
}
}
int (*grub_getkey) (void) = grub_getkey_dumb;
int
grub_checkkey (void)
{
grub_term_input_t term;
FOR_ACTIVE_TERM_INPUTS(term)
{
int key = term->checkkey (term);
if (key != -1)
return key;
}
return -1;
}
void
grub_refresh (void)