aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-02-03 21:41:21 -0800
committerH. Peter Anvin <hpa@zytor.com>2009-02-03 21:41:21 -0800
commitfd3b1f970c6385d178762fb5cfe922a2930d0cad (patch)
treee33ac5715b258a799e35bc821725947e57aee721
parentdbc9c2da4332a308fd70a1fe055528204e0bb789 (diff)
downloadsyslinux-elf-fd3b1f970c6385d178762fb5cfe922a2930d0cad.tar.gz
syslinux-elf-fd3b1f970c6385d178762fb5cfe922a2930d0cad.tar.xz
syslinux-elf-fd3b1f970c6385d178762fb5cfe922a2930d0cad.zip
Add comboot interface to access the keyboard remapping table
Add a comboot interface to access the keyboard remapping table, which can be used for either querying or changing the keyboard map.
-rw-r--r--com32/include/syslinux/keyboard.h53
-rw-r--r--com32/lib/Makefile1
-rw-r--r--com32/lib/syslinux/keyboard.c44
-rw-r--r--core/comboot.inc17
-rw-r--r--doc/comboot.txt13
5 files changed, 127 insertions, 1 deletions
diff --git a/com32/include/syslinux/keyboard.h b/com32/include/syslinux/keyboard.h
new file mode 100644
index 00000000..9d4f1409
--- /dev/null
+++ b/com32/include/syslinux/keyboard.h
@@ -0,0 +1,53 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2009 H. Peter Anvin - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * syslinux/keyboard.h
+ *
+ * Query syslinux keyboard map.
+ */
+
+#ifndef _SYSLINUX_KEYBOARD_H
+#define _SYSLINUX_KEYBOARD_H
+
+#include <stdint.h>
+
+struct syslinux_keyboard_map {
+ uint16_t version;
+ uint16_t length;
+ void *map;
+};
+
+extern struct syslinux_keyboard_map __syslinux_keyboard_map;
+static inline const struct syslinux_keyboard_map *
+syslinux_keyboard_map(void)
+{
+ return &__syslinux_keyboard_map;
+}
+
+#endif /* _SYSLINUX_KEYBOARD_H */
+
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 02799040..91405a06 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -74,6 +74,7 @@ LIBOBJS = \
syslinux/idle.o syslinux/reboot.o \
syslinux/features.o syslinux/config.o syslinux/serial.o \
syslinux/ipappend.o syslinux/dsinfo.o syslinux/version.o \
+ syslinux/keyboard.o \
\
syslinux/addlist.o syslinux/freelist.o syslinux/memmap.o \
syslinux/movebits.o syslinux/shuffle.o syslinux/shuffle_pm.o \
diff --git a/com32/lib/syslinux/keyboard.c b/com32/lib/syslinux/keyboard.c
new file mode 100644
index 00000000..2635dfb9
--- /dev/null
+++ b/com32/lib/syslinux/keyboard.c
@@ -0,0 +1,44 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2009 H. Peter Anvin - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <syslinux/keyboard.h>
+#include <com32.h>
+
+struct syslinux_keyboard_map __syslinux_keyboard_map;
+
+void __constructor __syslinux_get_keyboard_map(void)
+{
+ static com32sys_t reg;
+
+ reg.eax.w[0] = 0x001e;
+ __intcall(0x22, &reg, &reg);
+ if (!(reg.eflags.l & EFLAGS_CF)) {
+ __syslinux_keyboard_map.version = reg.eax.w[0];
+ __syslinux_keyboard_map.length = reg.edx.w[0];
+ __syslinux_keyboard_map.map = MK_PTR(reg.es, reg.ebx.w[0]);
+ }
+}
diff --git a/core/comboot.inc b/core/comboot.inc
index 810d8251..7210b8b8 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -1,6 +1,6 @@
;; -----------------------------------------------------------------------
;;
-;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
+;; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -1033,6 +1033,20 @@ comapi_getadv:
;
comapi_writeadv equ adv_write
+;
+; INT 22h AX=001Eh Keyboard remapping table
+comapi_kbdtable:
+ cmp P_DX,0
+ jne .err
+ mov P_AX,1 ; Version
+ mov P_CX,256 ; Length
+ mov P_ES,cs
+ mov P_BX,KbdMap
+ ret
+.err:
+ stc
+ ret
+
section .data
%macro int21 2
@@ -1085,6 +1099,7 @@ int22_table:
dw comapi_shufflerm ; 001B cleanup, shuffle and boot to rm
dw comapi_getadv ; 001C get pointer to ADV
dw comapi_writeadv ; 001D write ADV to disk
+ dw comapi_kbdtable ; 001E keyboard remapping table
int22_count equ ($-int22_table)/2
APIKeyWait db 0
diff --git a/doc/comboot.txt b/doc/comboot.txt
index ceee93a5..53295020 100644
--- a/doc/comboot.txt
+++ b/doc/comboot.txt
@@ -908,3 +908,16 @@ AX=001Dh [3.60] Write auxilliary data vector
In a future version, PXELINUX may end up attempting to save
the ADV on the server via TFTP write.
+
+
+AX=001Eh [3.74] Keyboard remapping table
+ Input: AX 001Eh
+ DX 0000h - all other values reserved
+ Output: AX format version (1)
+ CX length in bytes (256)
+ ES:BX pointer to keyboard table
+
+ This call queries the keyboard remapping table. For the current
+ version, the format code is always 1 and the length is always
+ 256. This version can be updated simply by overwriting the version
+ in memory; this may not be true in the future.