Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20171018' into staging

Linux-user updates for Qemu 2.11

# gpg: Signature made Wed 18 Oct 2017 13:20:14 BST
# gpg:                using RSA key 0xB44890DEDE3C9BC0
# gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>"
# gpg:                 aka "Riku Voipio <riku.voipio@linaro.org>"
# Primary key fingerprint: FF82 03C8 C391 98AE 0581  41EF B448 90DE DE3C 9BC0

* remotes/riku/tags/pull-linux-user-20171018:
  linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values
  linux-user/main: support dfilter
  linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers
  linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31
  linux-user: Tidy and enforce reserved_va initialization
  tcg: Fix off-by-one in assert in page_set_flags
  linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests
  linux-user: remove duplicate break in syscall
  target/m68k,linux-user: manage FP registers in ucontext
  linux-user: fix O_TMPFILE handling

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/.gitignore b/.gitignore
index 3a7e01d..620eec6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
 /trace/generated-tcg-tracers.h
 /ui/shader/texture-blit-frag.h
 /ui/shader/texture-blit-vert.h
+/ui/input-keymap-*.c
 *-timestamp
 /*-softmmu
 /*-darwin-user
@@ -113,6 +114,7 @@
 /docs/version.texi
 *.tps
 .stgit-*
+.git-submodule-status
 cscope.*
 tags
 TAGS
diff --git a/.gitmodules b/.gitmodules
index 84c54cd..7c981a4 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -34,3 +34,6 @@
 [submodule "roms/QemuMacDrivers"]
 	path = roms/QemuMacDrivers
 	url = git://git.qemu.org/QemuMacDrivers.git
+[submodule "ui/keycodemapdb"]
+	path = ui/keycodemapdb
+	url = git://git.qemu.org/keycodemapdb.git
diff --git a/MAINTAINERS b/MAINTAINERS
index 772ac20..9522d1b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -778,7 +778,7 @@
 Sun4v
 M: Artyom Tarasenko <atar4qemu@gmail.com>
 S: Maintained
-F: hw/sparc64/sun4v.c
+F: hw/sparc64/niagara.c
 F: hw/timer/sun4v-rtc.c
 F: include/hw/timer/sun4v-rtc.h
 
@@ -934,6 +934,7 @@
 F: hw/pci-bridge/*
 F: docs/pci*
 F: docs/specs/*pci*
+F: default-configs/pci.mak
 
 ACPI/SMBIOS
 M: Michael S. Tsirkin <mst@redhat.com>
@@ -980,16 +981,10 @@
 M: Paolo Bonzini <pbonzini@redhat.com>
 S: Supported
 F: include/hw/scsi/*
-F: include/scsi/*
 F: hw/scsi/*
-F: util/scsi*
 F: tests/virtio-scsi-test.c
 T: git git://github.com/bonzini/qemu.git scsi-next
 
-LSI53C895A
-S: Orphan
-F: hw/scsi/lsi53c895a.c
-
 SSI
 M: Peter Crosthwaite <crosthwaite.peter@gmail.com>
 M: Alistair Francis <alistair.francis@xilinx.com>
@@ -1317,6 +1312,17 @@
 F: device_tree.c
 F: include/sysemu/device_tree.h
 
+Dump
+S: Supported
+M: Marc-André Lureau <marcandre.lureau@redhat.com>
+F: dump.c
+F: hw/misc/vmcoreinfo.c
+F: include/hw/misc/vmcoreinfo.h
+F: include/sysemu/dump-arch.h
+F: include/sysemu/dump.h
+F: scripts/dump-guest-memory.py
+F: stubs/dump.c
+
 Error reporting
 M: Markus Armbruster <armbru@redhat.com>
 S: Supported
@@ -1529,12 +1535,14 @@
 T: git git://github.com/stefanha/qemu.git tracing
 
 TPM
-S: Orphan
+M: Stefan Berger <stefanb@linux.vnet.ibm.com>
+S: Maintained
 F: tpm.c
 F: hw/tpm/*
 F: include/hw/acpi/tpm.h
 F: include/sysemu/tpm*
 F: qapi/tpm.json
+F: backends/tpm.c
 
 Checkpatch
 S: Odd Fixes
@@ -1949,3 +1957,9 @@
 S: Odd Fixes
 F: docs/devel/build-system.txt
 
+Build System
+------------
+GIT submodules
+M: Daniel P. Berrange <berrange@redhat.com>
+S: Odd Fixes
+F: scripts/git-submodule.sh
diff --git a/Makefile b/Makefile
index 97b4508..062745f 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,27 @@
 all:
 include config-host.mak
 
+git-submodule-update:
+
+.PHONY: git-submodule-update
+
+ifeq (0,$(MAKELEVEL))
+  git_module_status := $(shell \
+    cd '$(SRC_PATH)' && \
+    ./scripts/git-submodule.sh status $(GIT_SUBMODULES); \
+    echo $$?; \
+  )
+
+ifeq (1,$(git_module_status))
+git-submodule-update:
+	$(call quiet-command, \
+          (cd $(SRC_PATH) && ./scripts/git-submodule.sh update $(GIT_SUBMODULES)), \
+          "GIT","$(GIT_SUBMODULES)")
+endif
+endif
+
+.git-submodule-status: git-submodule-update config-host.mak
+
 # Check that we're not trying to do an out-of-tree build from
 # a tree that's been used for an in-tree build.
 ifneq ($(realpath $(SRC_PATH)),$(realpath .))
@@ -84,6 +105,7 @@
 GENERATED_FILES += $(TRACE_HEADERS)
 GENERATED_FILES += $(TRACE_SOURCES)
 GENERATED_FILES += $(BUILD_DIR)/trace-events-all
+GENERATED_FILES += .git-submodule-status
 
 trace-group-name = $(shell dirname $1 | sed -e 's/[^a-zA-Z0-9]/_/g')
 
@@ -191,6 +213,31 @@
 
 trace-dtrace-root.o: trace-dtrace-root.dtrace
 
+KEYCODEMAP_GEN = $(SRC_PATH)/ui/keycodemapdb/tools/keymap-gen
+KEYCODEMAP_CSV = $(SRC_PATH)/ui/keycodemapdb/data/keymaps.csv
+
+KEYCODEMAP_FILES = \
+		 ui/input-keymap-linux-to-qcode.c \
+		 ui/input-keymap-qcode-to-qnum.c \
+		 ui/input-keymap-qnum-to-qcode.c \
+		 $(NULL)
+
+GENERATED_FILES += $(KEYCODEMAP_FILES)
+
+ui/input-keymap-%.c: $(KEYCODEMAP_GEN) $(KEYCODEMAP_CSV) $(SRC_PATH)/ui/Makefile.objs
+	$(call quiet-command,\
+	    src=$$(echo $@ | sed -E -e "s,^ui/input-keymap-(.+)-to-(.+)\.c$$,\1,") && \
+	    dst=$$(echo $@ | sed -E -e "s,^ui/input-keymap-(.+)-to-(.+)\.c$$,\2,") && \
+	    test -e $(KEYCODEMAP_GEN) && \
+	    $(PYTHON) $(KEYCODEMAP_GEN) \
+	          --lang glib2 \
+	          --varname qemu_input_map_$${src}_to_$${dst} \
+	          code-map $(KEYCODEMAP_CSV) $${src} $${dst} \
+	        > $@ || rm -f $@, "GEN", "$@")
+
+$(KEYCODEMAP_GEN): .git-submodule-status
+$(KEYCODEMAP_CSV): .git-submodule-status
+
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
 Makefile: ;
@@ -330,7 +377,7 @@
 DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
 DTC_CPPFLAGS=-I$(BUILD_DIR)/dtc -I$(SRC_PATH)/dtc -I$(SRC_PATH)/dtc/libfdt
 
-subdir-dtc:dtc/libfdt dtc/tests
+subdir-dtc: .git-submodule-status dtc/libfdt dtc/tests
 	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt/libfdt.a,)
 
 dtc/%:
@@ -371,6 +418,8 @@
 
 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
 
+qemu-keymap$(EXESUF): qemu-keymap.o ui/input-keymap.o $(COMMON_LDADDS)
+
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o $(COMMON_LDADDS)
 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
 
@@ -385,6 +434,9 @@
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
 qemu-ga$(EXESUF): QEMU_CFLAGS += -I qga/qapi-generated
 
+qemu-keymap$(EXESUF): LIBS += $(XKBCOMMON_LIBS)
+qemu-keymap$(EXESUF): QEMU_CFLAGS += $(XKBCOMMON_CFLAGS)
+
 gen-out-type = $(subst .,-,$(suffix $@))
 
 qapi-py = $(SRC_PATH)/scripts/qapi.py $(SRC_PATH)/scripts/ordereddict.py
@@ -672,8 +724,10 @@
 		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
 		"FRAG","$@")
 
-ui/console-gl.o: $(SRC_PATH)/ui/console-gl.c \
-	ui/shader/texture-blit-vert.h ui/shader/texture-blit-frag.h
+ui/shader.o: $(SRC_PATH)/ui/shader.c \
+	ui/shader/texture-blit-vert.h \
+	ui/shader/texture-blit-flip-vert.h \
+	ui/shader/texture-blit-frag.h
 
 # documentation
 MAKEINFO=makeinfo
diff --git a/backends/tpm.c b/backends/tpm.c
index 536f262..37c84b7 100644
--- a/backends/tpm.c
+++ b/backends/tpm.c
@@ -18,7 +18,24 @@
 #include "qapi/qmp/qerror.h"
 #include "sysemu/tpm.h"
 #include "qemu/thread.h"
-#include "sysemu/tpm_backend_int.h"
+
+static void tpm_backend_worker_thread(gpointer data, gpointer user_data)
+{
+    TPMBackend *s = TPM_BACKEND(user_data);
+    TPMBackendClass *k  = TPM_BACKEND_GET_CLASS(s);
+
+    assert(k->handle_request != NULL);
+    k->handle_request(s, (TPMBackendCmd)data);
+}
+
+static void tpm_backend_thread_end(TPMBackend *s)
+{
+    if (s->thread_pool) {
+        g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_END, NULL);
+        g_thread_pool_free(s->thread_pool, FALSE, TRUE);
+        s->thread_pool = NULL;
+    }
+}
 
 enum TpmType tpm_backend_get_type(TPMBackend *s)
 {
@@ -27,67 +44,67 @@
     return k->ops->type;
 }
 
-const char *tpm_backend_get_desc(TPMBackend *s)
-{
-    TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
-    return k->ops->desc();
-}
-
-void tpm_backend_destroy(TPMBackend *s)
-{
-    TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
-    k->ops->destroy(s);
-}
-
 int tpm_backend_init(TPMBackend *s, TPMState *state,
                      TPMRecvDataCB *datacb)
 {
     TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
 
-    return k->ops->init(s, state, datacb);
+    s->tpm_state = state;
+    s->recv_data_callback = datacb;
+    s->had_startup_error = false;
+
+    return k->ops->init ? k->ops->init(s) : 0;
 }
 
 int tpm_backend_startup_tpm(TPMBackend *s)
 {
+    int res = 0;
     TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
 
-    return k->ops->startup_tpm(s);
+    /* terminate a running TPM */
+    tpm_backend_thread_end(s);
+
+    s->thread_pool = g_thread_pool_new(tpm_backend_worker_thread, s, 1, TRUE,
+                                       NULL);
+    g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL);
+
+    res = k->ops->startup_tpm ? k->ops->startup_tpm(s) : 0;
+
+    s->had_startup_error = (res != 0);
+
+    return res;
 }
 
 bool tpm_backend_had_startup_error(TPMBackend *s)
 {
-    TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
-    return k->ops->had_startup_error(s);
-}
-
-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb)
-{
-    TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
-    return k->ops->realloc_buffer(sb);
+    return s->had_startup_error;
 }
 
 void tpm_backend_deliver_request(TPMBackend *s)
 {
-    TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
-
-    k->ops->deliver_request(s);
+    g_thread_pool_push(s->thread_pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD,
+                       NULL);
 }
 
 void tpm_backend_reset(TPMBackend *s)
 {
     TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
 
-    k->ops->reset(s);
+    if (k->ops->reset) {
+        k->ops->reset(s);
+    }
+
+    tpm_backend_thread_end(s);
+
+    s->had_startup_error = false;
 }
 
 void tpm_backend_cancel_cmd(TPMBackend *s)
 {
     TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
 
+    assert(k->ops->cancel_cmd);
+
     k->ops->cancel_cmd(s);
 }
 
@@ -95,23 +112,40 @@
 {
     TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
 
-    return k->ops->get_tpm_established_flag(s);
+    return k->ops->get_tpm_established_flag ?
+           k->ops->get_tpm_established_flag(s) : false;
 }
 
 int tpm_backend_reset_tpm_established_flag(TPMBackend *s, uint8_t locty)
 {
     TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
 
-    return k->ops->reset_tpm_established_flag(s, locty);
+    return k->ops->reset_tpm_established_flag ?
+           k->ops->reset_tpm_established_flag(s, locty) : 0;
 }
 
 TPMVersion tpm_backend_get_tpm_version(TPMBackend *s)
 {
     TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
 
+    assert(k->ops->get_tpm_version);
+
     return k->ops->get_tpm_version(s);
 }
 
+TPMInfo *tpm_backend_query_tpm(TPMBackend *s)
+{
+    TPMInfo *info = g_new0(TPMInfo, 1);
+    TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
+
+    info->id = g_strdup(s->id);
+    info->model = s->fe_model;
+    info->options = k->ops->get_tpm_options ?
+                    k->ops->get_tpm_options(s) : NULL;
+
+    return info;
+}
+
 static bool tpm_backend_prop_get_opened(Object *obj, Error **errp)
 {
     TPMBackend *s = TPM_BACKEND(obj);
@@ -152,33 +186,21 @@
 
 static void tpm_backend_instance_init(Object *obj)
 {
+    TPMBackend *s = TPM_BACKEND(obj);
+
     object_property_add_bool(obj, "opened",
                              tpm_backend_prop_get_opened,
                              tpm_backend_prop_set_opened,
                              NULL);
+    s->fe_model = -1;
 }
 
-void tpm_backend_thread_deliver_request(TPMBackendThread *tbt)
+static void tpm_backend_instance_finalize(Object *obj)
 {
-   g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_PROCESS_CMD, NULL);
-}
+    TPMBackend *s = TPM_BACKEND(obj);
 
-void tpm_backend_thread_create(TPMBackendThread *tbt,
-                               GFunc func, gpointer user_data)
-{
-    if (!tbt->pool) {
-        tbt->pool = g_thread_pool_new(func, user_data, 1, TRUE, NULL);
-        g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_INIT, NULL);
-    }
-}
-
-void tpm_backend_thread_end(TPMBackendThread *tbt)
-{
-    if (tbt->pool) {
-        g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_END, NULL);
-        g_thread_pool_free(tbt->pool, FALSE, TRUE);
-        tbt->pool = NULL;
-    }
+    g_free(s->id);
+    tpm_backend_thread_end(s);
 }
 
 static const TypeInfo tpm_backend_info = {
@@ -186,6 +208,7 @@
     .parent = TYPE_OBJECT,
     .instance_size = sizeof(TPMBackend),
     .instance_init = tpm_backend_instance_init,
+    .instance_finalize = tpm_backend_instance_finalize,
     .class_size = sizeof(TPMBackendClass),
     .abstract = true,
 };
diff --git a/block/io.c b/block/io.c
index 8e41907..0854e0f 100644
--- a/block/io.c
+++ b/block/io.c
@@ -156,6 +156,7 @@
     Coroutine *co;
     BlockDriverState *bs;
     bool done;
+    bool begin;
 } BdrvCoDrainData;
 
 static void coroutine_fn bdrv_drain_invoke_entry(void *opaque)
@@ -163,18 +164,23 @@
     BdrvCoDrainData *data = opaque;
     BlockDriverState *bs = data->bs;
 
-    bs->drv->bdrv_co_drain(bs);
+    if (data->begin) {
+        bs->drv->bdrv_co_drain_begin(bs);
+    } else {
+        bs->drv->bdrv_co_drain_end(bs);
+    }
 
     /* Set data->done before reading bs->wakeup.  */
     atomic_mb_set(&data->done, true);
     bdrv_wakeup(bs);
 }
 
-static void bdrv_drain_invoke(BlockDriverState *bs)
+static void bdrv_drain_invoke(BlockDriverState *bs, bool begin)
 {
-    BdrvCoDrainData data = { .bs = bs, .done = false };
+    BdrvCoDrainData data = { .bs = bs, .done = false, .begin = begin};
 
-    if (!bs->drv || !bs->drv->bdrv_co_drain) {
+    if (!bs->drv || (begin && !bs->drv->bdrv_co_drain_begin) ||
+            (!begin && !bs->drv->bdrv_co_drain_end)) {
         return;
     }
 
@@ -183,15 +189,16 @@
     BDRV_POLL_WHILE(bs, !data.done);
 }
 
-static bool bdrv_drain_recurse(BlockDriverState *bs)
+static bool bdrv_drain_recurse(BlockDriverState *bs, bool begin)
 {
     BdrvChild *child, *tmp;
     bool waited;
 
-    waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0);
-
     /* Ensure any pending metadata writes are submitted to bs->file.  */
-    bdrv_drain_invoke(bs);
+    bdrv_drain_invoke(bs, begin);
+
+    /* Wait for drained requests to finish */
+    waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0);
 
     QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) {
         BlockDriverState *bs = child->bs;
@@ -208,7 +215,7 @@
              */
             bdrv_ref(bs);
         }
-        waited |= bdrv_drain_recurse(bs);
+        waited |= bdrv_drain_recurse(bs, begin);
         if (in_main_loop) {
             bdrv_unref(bs);
         }
@@ -224,12 +231,18 @@
     BlockDriverState *bs = data->bs;
 
     bdrv_dec_in_flight(bs);
-    bdrv_drained_begin(bs);
+    if (data->begin) {
+        bdrv_drained_begin(bs);
+    } else {
+        bdrv_drained_end(bs);
+    }
+
     data->done = true;
     aio_co_wake(co);
 }
 
-static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs)
+static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
+                                                bool begin)
 {
     BdrvCoDrainData data;
 
@@ -242,6 +255,7 @@
         .co = qemu_coroutine_self(),
         .bs = bs,
         .done = false,
+        .begin = begin,
     };
     bdrv_inc_in_flight(bs);
     aio_bh_schedule_oneshot(bdrv_get_aio_context(bs),
@@ -256,7 +270,7 @@
 void bdrv_drained_begin(BlockDriverState *bs)
 {
     if (qemu_in_coroutine()) {
-        bdrv_co_yield_to_drain(bs);
+        bdrv_co_yield_to_drain(bs, true);
         return;
     }
 
@@ -265,17 +279,22 @@
         bdrv_parent_drained_begin(bs);
     }
 
-    bdrv_drain_recurse(bs);
+    bdrv_drain_recurse(bs, true);
 }
 
 void bdrv_drained_end(BlockDriverState *bs)
 {
+    if (qemu_in_coroutine()) {
+        bdrv_co_yield_to_drain(bs, false);
+        return;
+    }
     assert(bs->quiesce_counter > 0);
     if (atomic_fetch_dec(&bs->quiesce_counter) > 1) {
         return;
     }
 
     bdrv_parent_drained_end(bs);
+    bdrv_drain_recurse(bs, false);
     aio_enable_external(bdrv_get_aio_context(bs));
 }
 
@@ -353,7 +372,7 @@
             aio_context_acquire(aio_context);
             for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
                 if (aio_context == bdrv_get_aio_context(bs)) {
-                    waited |= bdrv_drain_recurse(bs);
+                    waited |= bdrv_drain_recurse(bs, true);
                 }
             }
             aio_context_release(aio_context);
@@ -374,6 +393,7 @@
         aio_context_acquire(aio_context);
         aio_enable_external(aio_context);
         bdrv_parent_drained_end(bs);
+        bdrv_drain_recurse(bs, false);
         aio_context_release(aio_context);
     }
 
diff --git a/block/nbd-client.c b/block/nbd-client.c
index 72651dc..c0683c3 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -156,7 +156,6 @@
         qio_channel_set_cork(s->ioc, true);
         rc = nbd_send_request(s->ioc, request);
         if (rc >= 0 && !s->quit) {
-            assert(request->len == iov_size(qiov->iov, qiov->niov));
             if (qio_channel_writev_all(s->ioc, qiov->iov, qiov->niov,
                                        NULL) < 0) {
                 rc = -EIO;
@@ -181,11 +180,11 @@
 }
 
 static int nbd_co_receive_reply(NBDClientSession *s,
-                                NBDRequest *request,
+                                uint64_t handle,
                                 QEMUIOVector *qiov)
 {
     int ret;
-    int i = HANDLE_TO_INDEX(s, request->handle);
+    int i = HANDLE_TO_INDEX(s, handle);
 
     /* Wait until we're woken up by nbd_read_reply_entry.  */
     s->requests[i].receiving = true;
@@ -194,10 +193,9 @@
     if (!s->ioc || s->quit) {
         ret = -EIO;
     } else {
-        assert(s->reply.handle == request->handle);
+        assert(s->reply.handle == handle);
         ret = -s->reply.error;
         if (qiov && s->reply.error == 0) {
-            assert(request->len == iov_size(qiov->iov, qiov->niov));
             if (qio_channel_readv_all(s->ioc, qiov->iov, qiov->niov,
                                       NULL) < 0) {
                 ret = -EIO;
@@ -231,15 +229,19 @@
     NBDClientSession *client = nbd_get_client_session(bs);
     int ret;
 
-    assert(!qiov || request->type == NBD_CMD_WRITE ||
-           request->type == NBD_CMD_READ);
+    if (qiov) {
+        assert(request->type == NBD_CMD_WRITE || request->type == NBD_CMD_READ);
+        assert(request->len == iov_size(qiov->iov, qiov->niov));
+    } else {
+        assert(request->type != NBD_CMD_WRITE && request->type != NBD_CMD_READ);
+    }
     ret = nbd_co_send_request(bs, request,
                               request->type == NBD_CMD_WRITE ? qiov : NULL);
     if (ret < 0) {
         return ret;
     }
 
-    return nbd_co_receive_reply(client, request,
+    return nbd_co_receive_reply(client, request->handle,
                                 request->type == NBD_CMD_READ ? qiov : NULL);
 }
 
diff --git a/block/qed.c b/block/qed.c
index 28e2ec8..821dcaa 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -265,7 +265,7 @@
     assert(!s->allocating_write_reqs_plugged);
     if (s->allocating_acb != NULL) {
         /* Another allocating write came concurrently.  This cannot happen
-         * from bdrv_qed_co_drain, but it can happen when the timer runs.
+         * from bdrv_qed_co_drain_begin, but it can happen when the timer runs.
          */
         qemu_co_mutex_unlock(&s->table_lock);
         return false;
@@ -358,7 +358,7 @@
     }
 }
 
-static void coroutine_fn bdrv_qed_co_drain(BlockDriverState *bs)
+static void coroutine_fn bdrv_qed_co_drain_begin(BlockDriverState *bs)
 {
     BDRVQEDState *s = bs->opaque;
 
@@ -1608,7 +1608,7 @@
     .bdrv_check               = bdrv_qed_check,
     .bdrv_detach_aio_context  = bdrv_qed_detach_aio_context,
     .bdrv_attach_aio_context  = bdrv_qed_attach_aio_context,
-    .bdrv_co_drain            = bdrv_qed_co_drain,
+    .bdrv_co_drain_begin      = bdrv_qed_co_drain_begin,
 };
 
 static void bdrv_qed_init(void)
diff --git a/block/throttle.c b/block/throttle.c
index 5bca763..833175a 100644
--- a/block/throttle.c
+++ b/block/throttle.c
@@ -197,6 +197,21 @@
     return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate);
 }
 
+static void coroutine_fn throttle_co_drain_begin(BlockDriverState *bs)
+{
+    ThrottleGroupMember *tgm = bs->opaque;
+    if (atomic_fetch_inc(&tgm->io_limits_disabled) == 0) {
+        throttle_group_restart_tgm(tgm);
+    }
+}
+
+static void coroutine_fn throttle_co_drain_end(BlockDriverState *bs)
+{
+    ThrottleGroupMember *tgm = bs->opaque;
+    assert(tgm->io_limits_disabled);
+    atomic_dec(&tgm->io_limits_disabled);
+}
+
 static BlockDriver bdrv_throttle = {
     .format_name                        =   "throttle",
     .protocol_name                      =   "throttle",
@@ -226,6 +241,9 @@
     .bdrv_reopen_abort                  =   throttle_reopen_abort,
     .bdrv_co_get_block_status           =   bdrv_co_get_block_status_from_file,
 
+    .bdrv_co_drain_begin                =   throttle_co_drain_begin,
+    .bdrv_co_drain_end                  =   throttle_co_drain_end,
+
     .is_filter                          =   true,
 };
 
diff --git a/configure b/configure
index 6587e80..663e908 100755
--- a/configure
+++ b/configure
@@ -265,6 +265,13 @@
 debug_info="yes"
 stack_protector=""
 
+if test -e "$source_path/.git"
+then
+    git_submodules="ui/keycodemapdb"
+else
+    git_submodules=""
+fi
+
 # Don't accept a target_list environment variable.
 unset target_list
 
@@ -297,6 +304,7 @@
 vnc_sasl=""
 vnc_jpeg=""
 vnc_png=""
+xkbcommon=""
 xen=""
 xen_ctrl_version=""
 xen_pv_domain_build="no"
@@ -2901,6 +2909,21 @@
 fi
 
 ##########################################
+# xkbcommon probe
+if test "$xkbcommon" != "no" ; then
+  if $pkg_config xkbcommon --exists; then
+    xkbcommon_cflags=$($pkg_config xkbcommon --cflags)
+    xkbcommon_libs=$($pkg_config xkbcommon --libs)
+    xkbcommon=yes
+  else
+    if test "$xkbcommon" = "yes" ; then
+      feature_not_found "xkbcommon" "Install libxkbcommon-devel"
+    fi
+    xkbcommon=no
+  fi
+fi
+
+##########################################
 # fnmatch() probe, used for ACL routines
 fnmatch="no"
 cat > $TMPC << EOF
@@ -3495,6 +3518,12 @@
   tpm_passthrough=no
 fi
 
+# TPM emulator is for all posix systems
+if test "$mingw32" != "yes"; then
+  tpm_emulator=$tpm
+else
+  tpm_emulator=no
+fi
 ##########################################
 # attr probe
 
@@ -3584,27 +3613,30 @@
   if compile_prog "" "$fdt_libs" ; then
     # system DTC is good - use it
     fdt=yes
-  elif test -d ${source_path}/dtc/libfdt ; then
-    # have submodule DTC - use it
-    fdt=yes
-    dtc_internal="yes"
-    mkdir -p dtc
-    if [ "$pwd_is_source_path" != "y" ] ; then
-       symlink "$source_path/dtc/Makefile" "dtc/Makefile"
-       symlink "$source_path/dtc/scripts" "dtc/scripts"
-    fi
-    fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
-    fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
-  elif test "$fdt" = "yes" ; then
-    # have neither and want - prompt for system/submodule install
-    error_exit "DTC (libfdt) version >= 1.4.2 not present. Your options:" \
-        "  (1) Preferred: Install the DTC (libfdt) devel package" \
-        "  (2) Fetch the DTC submodule, using:" \
-        "      git submodule update --init dtc"
   else
-    # don't have and don't want
-    fdt_libs=
-    fdt=no
+      # have GIT checkout, so activate dtc submodule
+      if test -e "${source_path}/.git" ; then
+          git_submodules="${git_submodules} dtc"
+      fi
+      if test -d "${source_path}/dtc/libfdt" || test -e "${source_path}/.git" ; then
+          fdt=yes
+          dtc_internal="yes"
+          mkdir -p dtc
+          if [ "$pwd_is_source_path" != "y" ] ; then
+              symlink "$source_path/dtc/Makefile" "dtc/Makefile"
+              symlink "$source_path/dtc/scripts" "dtc/scripts"
+          fi
+          fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
+          fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
+      elif test "$fdt" = "yes" ; then
+          # Not a git build & no libfdt found, prompt for system install
+          error_exit "DTC (libfdt) version >= 1.4.2 not present." \
+                     "Please install the DTC (libfdt) devel package"
+      else
+          # don't have and don't want
+          fdt_libs=
+          fdt=no
+      fi
   fi
 fi
 
@@ -5097,6 +5129,9 @@
     mpath=no
   fi
 fi
+if test "$xkbcommon" = "yes"; then
+  tools="qemu-keymap\$(EXESUF) $tools"
+fi
 
 # Probe for guest agent support/options
 
@@ -5295,6 +5330,7 @@
 echo "Windows SDK       $win_sdk"
 fi
 echo "Source path       $source_path"
+echo "GIT submodules    $git_submodules"
 echo "C compiler        $cc"
 echo "Host C compiler   $host_cc"
 echo "C++ compiler      $cxx"
@@ -5412,6 +5448,7 @@
 echo "TPM support       $tpm"
 echo "libssh2 support   $libssh2"
 echo "TPM passthrough   $tpm_passthrough"
+echo "TPM emulator      $tpm_emulator"
 echo "QOM debugging     $qom_cast_debug"
 echo "Live block migration $live_block_migration"
 echo "lzo support       $lzo"
@@ -5483,6 +5520,7 @@
 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
+echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
 
 echo "ARCH=$ARCH" >> $config_host_mak
 
@@ -5594,6 +5632,10 @@
 if test "$vnc_png" = "yes" ; then
   echo "CONFIG_VNC_PNG=y" >> $config_host_mak
 fi
+if test "$xkbcommon" = "yes" ; then
+  echo "XKBCOMMON_CFLAGS=$xkbcommon_cflags" >> $config_host_mak
+  echo "XKBCOMMON_LIBS=$xkbcommon_libs" >> $config_host_mak
+fi
 if test "$fnmatch" = "yes" ; then
   echo "CONFIG_FNMATCH=y" >> $config_host_mak
 fi
@@ -6011,12 +6053,16 @@
   echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
 fi
 
-# TPM passthrough support?
 if test "$tpm" = "yes"; then
   echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
+  # TPM passthrough support?
   if test "$tpm_passthrough" = "yes"; then
     echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
   fi
+  # TPM emulator support?
+  if test "$tpm_emulator" = "yes"; then
+    echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak
+  fi
 fi
 
 echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index d2ab2f6..a685c43 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -7,6 +7,7 @@
 CONFIG_VGA_ISA=y
 CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
+CONFIG_VMXNET3_PCI=y
 CONFIG_VIRTIO_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index 187e438..e514bde 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -22,7 +22,6 @@
 CONFIG_RTL8139_PCI=y
 CONFIG_E1000_PCI=y
 CONFIG_E1000E_PCI=y
-CONFIG_VMXNET3_PCI=y
 CONFIG_IDE_CORE=y
 CONFIG_IDE_QDEV=y
 CONFIG_IDE_PCI=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 9bde2f1..ea69e82 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -7,6 +7,7 @@
 CONFIG_VGA_ISA=y
 CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
+CONFIG_VMXNET3_PCI=y
 CONFIG_VIRTIO_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_IPMI=y
diff --git a/docs/specs/tpm.txt b/docs/specs/tpm.txt
new file mode 100644
index 0000000..914daac
--- /dev/null
+++ b/docs/specs/tpm.txt
@@ -0,0 +1,123 @@
+QEMU TPM Device
+===============
+
+= Guest-side Hardware Interface =
+
+The QEMU TPM emulation implements a TPM TIS hardware interface following the
+Trusted Computing Group's specification "TCG PC Client Specific TPM Interface
+Specification (TIS)", Specification Version 1.3, 21 March 2013. This
+specification, or a later version of it, can be accessed from the following
+URL:
+
+https://trustedcomputinggroup.org/pc-client-work-group-pc-client-specific-tpm-interface-specification-tis/
+
+The TIS interface makes a memory mapped IO region in the area 0xfed40000 -
+0xfed44fff available to the guest operating system.
+
+
+QEMU files related to TPM TIS interface:
+ - hw/tpm/tpm_tis.c
+ - hw/tpm/tpm_tis.h
+
+
+= ACPI Interface =
+
+The TPM device is defined with ACPI ID "PNP0C31". QEMU builds a SSDT and passes
+it into the guest through the fw_cfg device. The device description contains
+the base address of the TIS interface 0xfed40000 and the size of the MMIO area
+(0x5000). In case a TPM2 is used by QEMU, a TPM2 ACPI table is also provided.
+The device is described to be used in polling mode rather than interrupt mode
+primarily because no unused IRQ could be found.
+
+To support measurement logs to be written by the firmware, e.g. SeaBIOS, a TCPA
+table is implemented. This table provides a 64kb buffer where the firmware can
+write its log into. For TPM 2 only a more recent version of the TPM2 table
+provides support for measurements logs and a TCPA table does not need to be
+created.
+
+The TCPA and TPM2 ACPI tables follow the Trusted Computing Group specification
+"TCG ACPI Specification" Family "1.2" and "2.0", Level 00 Revision 00.37. This
+specification, or a later version of it, can be accessed from the following
+URL:
+
+https://trustedcomputinggroup.org/tcg-acpi-specification/
+
+
+QEMU files related to TPM ACPI tables:
+ - hw/i386/acpi-build.c
+ - include/hw/acpi/tpm.h
+
+
+= TPM backend devices =
+
+The TPM implementation is split into two parts, frontend and backend. The
+frontend part is the hardware interface, such as the TPM TIS interface
+described earlier, and the other part is the TPM backend interface. The backend
+interfaces implement the interaction with a TPM device, which may be a physical
+or an emulated device. The split between the front- and backend devices allows
+a frontend to be connected with any available backend. This enables the TIS
+interface to be used with the passthrough backend or the (future) swtpm backend.
+
+
+QEMU files related to TPM backends:
+ - backends/tpm.c
+ - include/sysemu/tpm_backend.h
+ - include/sysemu/tpm_backend_int.h
+
+
+== The QEMU TPM passthrough device ==
+
+In case QEMU is run on Linux as the host operating system it is possible to
+make the hardware TPM device available to a single QEMU guest. In this case the
+user must make sure that no other program is using the device, e.g., /dev/tpm0,
+before trying to start QEMU with it.
+
+The passthrough driver uses the host's TPM device for sending TPM commands
+and receiving responses from. Besides that it accesses the TPM device's sysfs
+entry for support of command cancellation. Since none of the state of a
+hardware TPM can be migrated between hosts, virtual machine migration is
+disabled when the TPM passthrough driver is used.
+
+Since the host's TPM device will already be initialized by the host's firmware,
+certain commands, e.g. TPM_Startup(), sent by the virtual firmware for device
+initialization, will fail. In this case the firmware should not use the TPM.
+
+Sharing the device with the host is generally not a recommended usage scenario
+for a TPM device. The primary reason for this is that two operating systems can
+then access the device's single set of resources, such as platform configuration
+registers (PCRs). Applications or kernel security subsystems, such as the
+Linux Integrity Measurement Architecture (IMA), are not expecting to share PCRs.
+
+
+QEMU files related to the TPM passthrough device:
+ - hw/tpm/tpm_passthrough.c
+ - hw/tpm/tpm_util.c
+ - hw/tpm/tpm_util.h
+
+
+Command line to start QEMU with the TPM passthrough device using the host's
+hardware TPM /dev/tpm0:
+
+qemu-system-x86_64 -display sdl -enable-kvm \
+  -m 1024 -boot d -bios bios-256k.bin -boot menu=on \
+  -tpmdev passthrough,id=tpm0,path=/dev/tpm0 \
+  -device tpm-tis,tpmdev=tpm0 test.img
+
+The following commands should result in similar output inside the VM with a
+Linux kernel that either has the TPM TIS driver built-in or available as a
+module:
+
+#> dmesg | grep -i tpm
+[    0.711310] tpm_tis 00:06: 1.2 TPM (device=id 0x1, rev-id 1)
+
+#> dmesg | grep TCPA
+[    0.000000] ACPI: TCPA 0x0000000003FFD191C 000032 (v02 BOCHS  \
+    BXPCTCPA 0000001 BXPC 00000001)
+
+#> ls -l /dev/tpm*
+crw-------. 1 root root 10, 224 Jul 11 10:11 /dev/tpm0
+
+#> find /sys/devices/ | grep pcrs$ | xargs cat
+PCR-00: 35 4E 3B CE 23 9F 38 59 ...
+...
+PCR-23: 00 00 00 00 00 00 00 00 ...
diff --git a/docs/specs/vmcoreinfo.txt b/docs/specs/vmcoreinfo.txt
new file mode 100644
index 0000000..8212610
--- /dev/null
+++ b/docs/specs/vmcoreinfo.txt
@@ -0,0 +1,49 @@
+=================
+VMCoreInfo device
+=================
+
+The `-device vmcoreinfo` will create a fw_cfg entry for a guest to
+store dump details.
+
+etc/vmcoreinfo
+**************
+
+A guest may use this fw_cfg entry to add information details to qemu
+dumps.
+
+The entry of 16 bytes has the following layout, in little-endian::
+
+#define VMCOREINFO_FORMAT_NONE 0x0
+#define VMCOREINFO_FORMAT_ELF 0x1
+
+    struct FWCfgVMCoreInfo {
+        uint16_t host_format;  /* formats host supports */
+        uint16_t guest_format; /* format guest supplies */
+        uint32_t size;         /* size of vmcoreinfo region */
+        uint64_t paddr;        /* physical address of vmcoreinfo region */
+    };
+
+Only full write (of 16 bytes) are considered valid for further
+processing of entry values.
+
+A write of 0 in guest_format will disable further processing of
+vmcoreinfo entry values & content.
+
+Format & content
+****************
+
+As of qemu 2.11, only VMCOREINFO_FORMAT_ELF is supported.
+
+The entry gives location and size of an ELF note that is appended in
+qemu dumps.
+
+The note format/class must be of the target bitness and the size must
+be less than 1Mb.
+
+If the ELF note name is "VMCOREINFO", it is expected to be the Linux
+vmcoreinfo note (see Documentation/ABI/testing/sysfs-kernel-vmcoreinfo
+in Linux source). In this case, qemu dump code will read the content
+as a key=value text file, looking for "NUMBER(phys_base)" key
+value. The value is expected to be more accurate than architecture
+guess of the value. This is useful for KASLR-enabled guest with
+ancient tools not handling the VMCOREINFO note.
diff --git a/dump.c b/dump.c
index 7ebcf55..d4a8c94 100644
--- a/dump.c
+++ b/dump.c
@@ -25,6 +25,8 @@
 #include "qapi/qmp/qerror.h"
 #include "qmp-commands.h"
 #include "qapi-event.h"
+#include "qemu/error-report.h"
+#include "hw/misc/vmcoreinfo.h"
 
 #include <zlib.h>
 #ifdef CONFIG_LZO
@@ -37,6 +39,13 @@
 #define ELF_MACHINE_UNAME "Unknown"
 #endif
 
+#define MAX_GUEST_NOTE_SIZE (1 << 20) /* 1MB should be enough */
+
+#define ELF_NOTE_SIZE(hdr_size, name_size, desc_size)   \
+    ((DIV_ROUND_UP((hdr_size), 4) +                     \
+      DIV_ROUND_UP((name_size), 4) +                    \
+      DIV_ROUND_UP((desc_size), 4)) * 4)
+
 uint16_t cpu_to_dump16(DumpState *s, uint16_t val)
 {
     if (s->dump_info.d_endian == ELFDATA2LSB) {
@@ -75,6 +84,8 @@
     guest_phys_blocks_free(&s->guest_phys_blocks);
     memory_mapping_list_free(&s->list);
     close(s->fd);
+    g_free(s->guest_note);
+    s->guest_note = NULL;
     if (s->resume) {
         if (s->detached) {
             qemu_mutex_lock_iothread();
@@ -234,6 +245,19 @@
     return cpu->cpu_index + 1;
 }
 
+static void write_guest_note(WriteCoreDumpFunction f, DumpState *s,
+                             Error **errp)
+{
+    int ret;
+
+    if (s->guest_note) {
+        ret = f(s->guest_note, s->guest_note_size, s);
+        if (ret < 0) {
+            error_setg(errp, "dump: failed to write guest note");
+        }
+    }
+}
+
 static void write_elf64_notes(WriteCoreDumpFunction f, DumpState *s,
                               Error **errp)
 {
@@ -257,6 +281,8 @@
             return;
         }
     }
+
+    write_guest_note(f, s, errp);
 }
 
 static void write_elf32_note(DumpState *s, Error **errp)
@@ -302,6 +328,8 @@
             return;
         }
     }
+
+    write_guest_note(f, s, errp);
 }
 
 static void write_elf_section(DumpState *s, int type, Error **errp)
@@ -713,6 +741,61 @@
     return 0;
 }
 
+/*
+ * This function retrieves various sizes from an elf header.
+ *
+ * @note has to be a valid ELF note. The return sizes are unmodified
+ * (not padded or rounded up to be multiple of 4).
+ */
+static void get_note_sizes(DumpState *s, const void *note,
+                           uint64_t *note_head_size,
+                           uint64_t *name_size,
+                           uint64_t *desc_size)
+{
+    uint64_t note_head_sz;
+    uint64_t name_sz;
+    uint64_t desc_sz;
+
+    if (s->dump_info.d_class == ELFCLASS64) {
+        const Elf64_Nhdr *hdr = note;
+        note_head_sz = sizeof(Elf64_Nhdr);
+        name_sz = tswap64(hdr->n_namesz);
+        desc_sz = tswap64(hdr->n_descsz);
+    } else {
+        const Elf32_Nhdr *hdr = note;
+        note_head_sz = sizeof(Elf32_Nhdr);
+        name_sz = tswap32(hdr->n_namesz);
+        desc_sz = tswap32(hdr->n_descsz);
+    }
+
+    if (note_head_size) {
+        *note_head_size = note_head_sz;
+    }
+    if (name_size) {
+        *name_size = name_sz;
+    }
+    if (desc_size) {
+        *desc_size = desc_sz;
+    }
+}
+
+static bool note_name_equal(DumpState *s,
+                            const uint8_t *note, const char *name)
+{
+    int len = strlen(name) + 1;
+    uint64_t head_size, name_size;
+
+    get_note_sizes(s, note, &head_size, &name_size, NULL);
+    head_size = ROUND_UP(head_size, 4);
+
+    if (name_size != len ||
+        memcmp(note + head_size, "VMCOREINFO", len)) {
+        return false;
+    }
+
+    return true;
+}
+
 /* write common header, sub header and elf note to vmcore */
 static void create_header32(DumpState *s, Error **errp)
 {
@@ -774,6 +857,18 @@
     kh->dump_level = cpu_to_dump32(s, DUMP_LEVEL);
 
     offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size;
+    if (s->guest_note &&
+        note_name_equal(s, s->guest_note, "VMCOREINFO")) {
+        uint64_t hsize, name_size, size_vmcoreinfo_desc, offset_vmcoreinfo;
+
+        get_note_sizes(s, s->guest_note,
+                       &hsize, &name_size, &size_vmcoreinfo_desc);
+        offset_vmcoreinfo = offset_note + s->note_size - s->guest_note_size +
+            (DIV_ROUND_UP(hsize, 4) + DIV_ROUND_UP(name_size, 4)) * 4;
+        kh->offset_vmcoreinfo = cpu_to_dump64(s, offset_vmcoreinfo);
+        kh->size_vmcoreinfo = cpu_to_dump32(s, size_vmcoreinfo_desc);
+    }
+
     kh->offset_note = cpu_to_dump64(s, offset_note);
     kh->note_size = cpu_to_dump32(s, s->note_size);
 
@@ -874,6 +969,18 @@
     kh->dump_level = cpu_to_dump32(s, DUMP_LEVEL);
 
     offset_note = DISKDUMP_HEADER_BLOCKS * block_size + size;
+    if (s->guest_note &&
+        note_name_equal(s, s->guest_note, "VMCOREINFO")) {
+        uint64_t hsize, name_size, size_vmcoreinfo_desc, offset_vmcoreinfo;
+
+        get_note_sizes(s, s->guest_note,
+                       &hsize, &name_size, &size_vmcoreinfo_desc);
+        offset_vmcoreinfo = offset_note + s->note_size - s->guest_note_size +
+            (DIV_ROUND_UP(hsize, 4) + DIV_ROUND_UP(name_size, 4)) * 4;
+        kh->offset_vmcoreinfo = cpu_to_dump64(s, offset_vmcoreinfo);
+        kh->size_vmcoreinfo = cpu_to_dump64(s, size_vmcoreinfo_desc);
+    }
+
     kh->offset_note = cpu_to_dump64(s, offset_note);
     kh->note_size = cpu_to_dump64(s, s->note_size);
 
@@ -1487,10 +1594,44 @@
     return total;
 }
 
+static void vmcoreinfo_update_phys_base(DumpState *s)
+{
+    uint64_t size, note_head_size, name_size, phys_base;
+    char **lines;
+    uint8_t *vmci;
+    size_t i;
+
+    if (!note_name_equal(s, s->guest_note, "VMCOREINFO")) {
+        return;
+    }
+
+    get_note_sizes(s, s->guest_note, &note_head_size, &name_size, &size);
+    note_head_size = ROUND_UP(note_head_size, 4);
+
+    vmci = s->guest_note + note_head_size + ROUND_UP(name_size, 4);
+    *(vmci + size) = '\0';
+
+    lines = g_strsplit((char *)vmci, "\n", -1);
+    for (i = 0; lines[i]; i++) {
+        if (g_str_has_prefix(lines[i], "NUMBER(phys_base)=")) {
+            if (qemu_strtou64(lines[i] + 18, NULL, 16,
+                              &phys_base) < 0) {
+                warn_report("Failed to read NUMBER(phys_base)=");
+            } else {
+                s->dump_info.phys_base = phys_base;
+            }
+            break;
+        }
+    }
+
+    g_strfreev(lines);
+}
+
 static void dump_init(DumpState *s, int fd, bool has_format,
                       DumpGuestMemoryFormat format, bool paging, bool has_filter,
                       int64_t begin, int64_t length, Error **errp)
 {
+    VMCoreInfoState *vmci = vmcoreinfo_find();
     CPUState *cpu;
     int nr_cpus;
     Error *err = NULL;
@@ -1568,6 +1709,48 @@
         goto cleanup;
     }
 
+    /*
+     * The goal of this block is to (a) update the previously guessed
+     * phys_base, (b) copy the guest note out of the guest.
+     * Failure to do so is not fatal for dumping.
+     */
+    if (vmci) {
+        uint64_t addr, note_head_size, name_size, desc_size;
+        uint32_t size;
+        uint16_t format;
+
+        note_head_size = s->dump_info.d_class == ELFCLASS32 ?
+            sizeof(Elf32_Nhdr) : sizeof(Elf64_Nhdr);
+
+        format = le16_to_cpu(vmci->vmcoreinfo.guest_format);
+        size = le32_to_cpu(vmci->vmcoreinfo.size);
+        addr = le64_to_cpu(vmci->vmcoreinfo.paddr);
+        if (!vmci->has_vmcoreinfo) {
+            warn_report("guest note is not present");
+        } else if (size < note_head_size || size > MAX_GUEST_NOTE_SIZE) {
+            warn_report("guest note size is invalid: %" PRIu32, size);
+        } else if (format != VMCOREINFO_FORMAT_ELF) {
+            warn_report("guest note format is unsupported: %" PRIu16, format);
+        } else {
+            s->guest_note = g_malloc(size + 1); /* +1 for adding \0 */
+            cpu_physical_memory_read(addr, s->guest_note, size);
+
+            get_note_sizes(s, s->guest_note, NULL, &name_size, &desc_size);
+            s->guest_note_size = ELF_NOTE_SIZE(note_head_size, name_size,
+                                               desc_size);
+            if (name_size > MAX_GUEST_NOTE_SIZE ||
+                desc_size > MAX_GUEST_NOTE_SIZE ||
+                s->guest_note_size > size) {
+                warn_report("Invalid guest note header");
+                g_free(s->guest_note);
+                s->guest_note = NULL;
+            } else {
+                vmcoreinfo_update_phys_base(s);
+                s->note_size += s->guest_note_size;
+            }
+        }
+    }
+
     /* get memory mapping */
     if (paging) {
         qemu_get_guest_memory_mapping(&s->list, &s->guest_phys_blocks, &err);
diff --git a/hmp.c b/hmp.c
index 739d330..ec61329 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1000,6 +1000,7 @@
     Error *err = NULL;
     unsigned int c = 0;
     TPMPassthroughOptions *tpo;
+    TPMEmulatorOptions *teo;
 
     info_list = qmp_query_tpm(&err);
     if (err) {
@@ -1029,6 +1030,10 @@
                            tpo->has_cancel_path ? ",cancel-path=" : "",
                            tpo->has_cancel_path ? tpo->cancel_path : "");
             break;
+        case TPM_TYPE_OPTIONS_KIND_EMULATOR:
+            teo = ti->options->u.emulator.data;
+            monitor_printf(mon, ",chardev=%s", teo->chardev);
+            break;
         case TPM_TYPE_OPTIONS_KIND__MAX:
             break;
         }
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 23ac7bb..f8bbac2 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -3234,7 +3234,7 @@
         xattr_fidp->fid_type = P9_FID_XATTR;
         xattr_fidp->fs.xattr.xattrwalk_fid = true;
         if (size) {
-            xattr_fidp->fs.xattr.value = g_malloc(size);
+            xattr_fidp->fs.xattr.value = g_malloc0(size);
             err = v9fs_co_llistxattr(pdu, &xattr_fidp->path,
                                      xattr_fidp->fs.xattr.value,
                                      xattr_fidp->fs.xattr.len);
@@ -3267,7 +3267,7 @@
         xattr_fidp->fid_type = P9_FID_XATTR;
         xattr_fidp->fs.xattr.xattrwalk_fid = true;
         if (size) {
-            xattr_fidp->fs.xattr.value = g_malloc(size);
+            xattr_fidp->fs.xattr.value = g_malloc0(size);
             err = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
                                     &name, xattr_fidp->fs.xattr.value,
                                     xattr_fidp->fs.xattr.len);
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index f4fd590..a0fb1ce 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -718,6 +718,7 @@
     .interfaces = (InterfaceInfo[]) {
         { TYPE_HOTPLUG_HANDLER },
         { TYPE_ACPI_DEVICE_IF },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
         { }
     }
 };
diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c
index 2876d8a..105044f 100644
--- a/hw/acpi/vmgenid.c
+++ b/hw/acpi/vmgenid.c
@@ -124,7 +124,7 @@
     fw_cfg_add_file(s, VMGENID_GUID_FW_CFG_FILE, guid->data,
                     VMGENID_FW_CFG_SIZE);
     /* Create a read-write fw_cfg file for Address */
-    fw_cfg_add_file_callback(s, VMGENID_ADDR_FW_CFG_FILE, NULL, NULL,
+    fw_cfg_add_file_callback(s, VMGENID_ADDR_FW_CFG_FILE, NULL, NULL, NULL,
                              vms->vmgenid_addr_le,
                              ARRAY_SIZE(vms->vmgenid_addr_le), false);
 }
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 959c786..337402e 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -1431,6 +1431,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof (AC97LinkState),
     .class_init    = ac97_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void ac97_register_types (void)
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index dd7c23d..59cf252 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -1082,6 +1082,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof (ES1370State),
     .class_init    = es1370_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void es1370_register_types (void)
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index 18a50a8..a3e670c 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -1263,6 +1263,10 @@
     .instance_size = sizeof(IntelHDAState),
     .class_init    = intel_hda_class_init,
     .abstract      = true,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static const TypeInfo intel_hda_info_ich6 = {
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 9aa3269..441e21e 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1110,6 +1110,10 @@
     .instance_size = sizeof(NvmeCtrl),
     .class_init    = nvme_class_init,
     .instance_init = nvme_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { }
+    },
 };
 
 static void nvme_register_types(void)
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index 303104d..cb0d04c 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -250,6 +250,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCISerialState),
     .class_init    = serial_pci_class_initfn,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static const TypeInfo multi_2x_serial_pci_info = {
@@ -257,6 +261,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIMultiSerialState),
     .class_init    = multi_2x_serial_pci_class_initfn,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static const TypeInfo multi_4x_serial_pci_info = {
@@ -264,6 +272,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIMultiSerialState),
     .class_init    = multi_4x_serial_pci_class_initfn,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void serial_pci_register_types(void)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 4593061..91669d6 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -1023,7 +1023,7 @@
         }
 
         fw_cfg_add_file_callback(fw_cfg, fw_file_name,
-                                 fw_callback, callback_opaque,
+                                 fw_callback, NULL, callback_opaque,
                                  data, rom->datasize, read_only);
     }
     return mr;
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index afc290a..bc32bf1 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -2038,15 +2038,14 @@
     unsigned val = mem_value;
     uint8_t *dst;
 
-    dst = s->vga.vram_ptr + (offset &= s->cirrus_addr_mask);
     for (x = 0; x < 8; x++) {
+        dst = s->vga.vram_ptr + ((offset + x) & s->cirrus_addr_mask);
 	if (val & 0x80) {
 	    *dst = s->cirrus_shadow_gr1;
 	} else if (mode == 5) {
 	    *dst = s->cirrus_shadow_gr0;
 	}
 	val <<= 1;
-	dst++;
     }
     memory_region_set_dirty(&s->vga.vram, offset, 8);
 }
@@ -2060,8 +2059,8 @@
     unsigned val = mem_value;
     uint8_t *dst;
 
-    dst = s->vga.vram_ptr + (offset &= s->cirrus_addr_mask);
     for (x = 0; x < 8; x++) {
+        dst = s->vga.vram_ptr + ((offset + 2 * x) & s->cirrus_addr_mask & ~1);
 	if (val & 0x80) {
 	    *dst = s->cirrus_shadow_gr1;
 	    *(dst + 1) = s->vga.gr[0x11];
@@ -2070,7 +2069,6 @@
 	    *(dst + 1) = s->vga.gr[0x10];
 	}
 	val <<= 1;
-	dst += 2;
     }
     memory_region_set_dirty(&s->vga.vram, offset, 16);
 }
@@ -3162,6 +3160,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCICirrusVGAState),
     .class_init    = cirrus_vga_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void cirrus_vga_register_types(void)
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index d92fe05..99365c3 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2432,6 +2432,10 @@
     .instance_size = sizeof(PCIQXLDevice),
     .abstract = true,
     .class_init = qxl_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void qxl_primary_class_init(ObjectClass *klass, void *data)
diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 9aa515b..6eddac9 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -1843,6 +1843,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(SM501PCIState),
     .class_init    = sm501_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void sm501_register_types(void)
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index ac9a764..7adb89f 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -338,6 +338,10 @@
     .instance_size = sizeof(PCIVGAState),
     .abstract = true,
     .class_init = vga_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void vga_class_init(ObjectClass *klass, void *data)
diff --git a/hw/display/vga.c b/hw/display/vga.c
index ed24ef7..1d19f6b 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1464,14 +1464,14 @@
 {
     DisplaySurface *surface = qemu_console_surface(s->con);
     int y1, y, update, linesize, y_start, double_scan, mask, depth;
-    int width, height, shift_control, line_offset, bwidth, bits;
-    ram_addr_t page0, page1;
+    int width, height, shift_control, bwidth, bits;
+    ram_addr_t page0, page1, region_start, region_end;
     DirtyBitmapSnapshot *snap = NULL;
     int disp_width, multi_scan, multi_run;
     uint8_t *d;
     uint32_t v, addr1, addr;
     vga_draw_line_func *vga_draw_line = NULL;
-    bool share_surface;
+    bool share_surface, force_shadow = false;
     pixman_format_code_t format;
 #ifdef HOST_WORDS_BIGENDIAN
     bool byteswap = !s->big_endian_fb;
@@ -1484,6 +1484,15 @@
     s->get_resolution(s, &width, &height);
     disp_width = width;
 
+    region_start = (s->start_addr * 4);
+    region_end = region_start + (ram_addr_t)s->line_offset * height;
+    if (region_end > s->vbe_size) {
+        /* wraps around (can happen with cirrus vbe modes) */
+        region_start = 0;
+        region_end = s->vbe_size;
+        force_shadow = true;
+    }
+
     shift_control = (s->gr[VGA_GFX_MODE] >> 5) & 3;
     double_scan = (s->cr[VGA_CRTC_MAX_SCAN] >> 7);
     if (shift_control != 1) {
@@ -1523,7 +1532,7 @@
     format = qemu_default_pixman_format(depth, !byteswap);
     if (format) {
         share_surface = dpy_gfx_check_format(s->con, format)
-            && !s->force_shadow;
+            && !s->force_shadow && !force_shadow;
     } else {
         share_surface = false;
     }
@@ -1614,7 +1623,6 @@
         s->cursor_invalidate(s);
     }
 
-    line_offset = s->line_offset;
 #if 0
     printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n",
            width, height, v, line_offset, s->cr[9], s->cr[VGA_CRTC_MODE],
@@ -1628,8 +1636,6 @@
     y1 = 0;
 
     if (!full_update) {
-        ram_addr_t region_start = addr1;
-        ram_addr_t region_end = addr1 + line_offset * height;
         vga_sync_dirty_bitmap(s);
         if (s->line_compare < height) {
             /* split screen mode */
@@ -1652,10 +1658,17 @@
             addr = (addr & ~0x8000) | ((y1 & 2) << 14);
         }
         update = full_update;
-        page0 = addr;
-        page1 = addr + bwidth - 1;
+        page0 = addr & s->vbe_size_mask;
+        page1 = (addr + bwidth - 1) & s->vbe_size_mask;
         if (full_update) {
             update = 1;
+        } else if (page1 < page0) {
+            /* scanline wraps from end of video memory to the start */
+            assert(force_shadow);
+            update = memory_region_snapshot_get_dirty(&s->vram, snap,
+                                                      page0, 0);
+            update |= memory_region_snapshot_get_dirty(&s->vram, snap,
+                                                       page1, 0);
         } else {
             update = memory_region_snapshot_get_dirty(&s->vram, snap,
                                                       page0, page1 - page0);
@@ -1681,7 +1694,7 @@
         if (!multi_run) {
             mask = (s->cr[VGA_CRTC_MODE] & 3) ^ 3;
             if ((y1 & mask) == mask)
-                addr1 += line_offset;
+                addr1 += s->line_offset;
             y1++;
             multi_run = multi_scan;
         } else {
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 4a64b41..cdc3fed 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -1350,6 +1350,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(struct pci_vmsvga_state_s),
     .class_init    = vmsvga_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void vmsvga_register_types(void)
diff --git a/hw/i2c/smbus_ich9.c b/hw/i2c/smbus_ich9.c
index ea51e09..e47556c 100644
--- a/hw/i2c/smbus_ich9.c
+++ b/hw/i2c/smbus_ich9.c
@@ -119,6 +119,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(ICH9SMBState),
     .class_init = ich9_smb_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void ich9_smb_register(void)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2af37a9..73519ab 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2911,7 +2911,7 @@
 
         build_state->rsdp = g_memdup(tables.rsdp->data, rsdp_size);
         fw_cfg_add_file_callback(pcms->fw_cfg, ACPI_BUILD_RSDP_FILE,
-                                 acpi_build_update, build_state,
+                                 acpi_build_update, NULL, build_state,
                                  build_state->rsdp, rsdp_size, true);
         build_state->rsdp_mr = NULL;
     } else {
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 334938a..ad8155c 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1227,6 +1227,10 @@
     .name = "AMDVI-PCI",
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(AMDVIPCIState),
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void amdvi_iommu_memory_region_class_init(ObjectClass *klass, void *data)
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 33e20cb..d8559d8 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -1864,6 +1864,10 @@
     .instance_size      = sizeof(AssignedDevice),
     .class_init         = assign_class_init,
     .instance_init      = assigned_dev_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void assign_register_types(void)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 9ff79b1..f79d5cb 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -378,8 +378,6 @@
 
 static void pc_init_isa(MachineState *machine)
 {
-    x86_cpu_change_kvm_default("kvm-pv-eoi", NULL);
-    enable_compat_apic_id_mode();
     pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE);
 }
 
@@ -428,7 +426,6 @@
 {
     m->family = "pc_piix";
     m->desc = "Standard PC (i440FX + PIIX, 1996)";
-    m->hot_add_cpu = pc_hot_add_cpu;
     m->default_machine_opts = "firmware=bios-256k.bin";
     m->default_display = "std";
 }
@@ -1055,6 +1052,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init = isa_bridge_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pt_graphics_register_types(void)
@@ -1123,7 +1124,6 @@
     m->desc = "Xen Fully-virtualized PC";
     m->max_cpus = HVM_MAX_VCPUS;
     m->default_machine_opts = "accel=xen";
-    m->hot_add_cpu = pc_hot_add_cpu;
 }
 
 DEFINE_PC_MACHINE(xenfv, "xenfv", pc_xen_hvm_init,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 6c4ec4b..da3ea60 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -295,7 +295,6 @@
 {
     m->family = "pc_q35";
     m->desc = "Standard PC (Q35 + ICH9, 2009)";
-    m->hot_add_cpu = pc_hot_add_cpu;
     m->units_per_default_bus = 1;
     m->default_machine_opts = "firmware=bios-256k.bin";
     m->default_display = "std";
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 9ba7474..056b87d 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -517,6 +517,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIXenPlatformState),
     .class_init    = xen_platform_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void xen_platform_register_types(void)
diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index c093b34..f748823 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -127,6 +127,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(XenPVDevice),
     .class_init    = xen_pv_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void xen_pv_register_types(void)
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 9472a60..8dd0ced 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -184,6 +184,10 @@
     .instance_size = sizeof(AHCIPCIState),
     .instance_init = pci_ich9_ahci_init,
     .class_init    = ich_ahci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void ich_ahci_register_types(void)
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index ce194c6..2e043ef 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -353,12 +353,14 @@
 
 static const VMStateDescription vmstate_pmac = {
     .name = "ide",
-    .version_id = 4,
+    .version_id = 5,
     .minimum_version_id = 0,
     .fields = (VMStateField[]) {
         VMSTATE_IDE_BUS(bus, MACIOIDEState),
         VMSTATE_IDE_DRIVES(bus.ifs, MACIOIDEState),
         VMSTATE_BOOL(dma_active, MACIOIDEState),
+        VMSTATE_UINT32(timing_reg, MACIOIDEState),
+        VMSTATE_UINT32(irq_reg, MACIOIDEState),
         VMSTATE_END_OF_LIST()
     }
 };
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index d53ff53..25f1d36 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -453,6 +453,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIIDEState),
     .abstract = true,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pci_ide_register_types(void)
diff --git a/hw/ipack/tpci200.c b/hw/ipack/tpci200.c
index 4dfa6b3..da05c85 100644
--- a/hw/ipack/tpci200.c
+++ b/hw/ipack/tpci200.c
@@ -646,6 +646,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(TPCI200State),
     .class_init    = tpci200_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void tpci200_register_types(void)
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 4d29a99..d20ea4c 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -138,6 +138,10 @@
     .instance_size = sizeof(I82378State),
     .instance_init = i82378_init,
     .class_init = i82378_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void i82378_register_types(void)
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index ac8416d..ec3c9f7 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -402,12 +402,12 @@
          * just link them into fw_cfg here.
          */
         fw_cfg_add_file_callback(fw_cfg, "etc/smi/requested-features",
-                                 NULL, NULL,
+                                 NULL, NULL, NULL,
                                  lpc->smi_guest_features_le,
                                  sizeof lpc->smi_guest_features_le,
                                  false);
         fw_cfg_add_file_callback(fw_cfg, "etc/smi/features-ok",
-                                 smi_features_ok_callback, lpc,
+                                 smi_features_ok_callback, NULL, lpc,
                                  &lpc->smi_features_ok,
                                  sizeof lpc->smi_features_ok,
                                  true);
@@ -823,6 +823,7 @@
     .interfaces = (InterfaceInfo[]) {
         { TYPE_HOTPLUG_HANDLER },
         { TYPE_ACPI_DEVICE_IF },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
         { }
     }
 };
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index f811eba..6b8bc3f 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -132,6 +132,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PIIX4State),
     .class_init    = piix4_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void piix4_register_types(void)
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 50dc83d..c129985 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -301,6 +301,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(VT686AC97State),
     .class_init    = via_ac97_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp)
@@ -341,6 +345,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(VT686MC97State),
     .class_init    = via_mc97_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 /* vt82c686 pm init */
@@ -419,6 +427,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(VT686PMState),
     .class_init    = via_pm_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static const VMStateDescription vmstate_via = {
@@ -502,6 +514,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(VT82C686BState),
     .class_init    = via_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void vt82c686b_register_types(void)
diff --git a/hw/m68k/an5206.c b/hw/m68k/an5206.c
index 9002c46..db634cb 100644
--- a/hw/m68k/an5206.c
+++ b/hw/m68k/an5206.c
@@ -66,7 +66,7 @@
         if (qtest_enabled()) {
             return;
         }
-        fprintf(stderr, "Kernel image must be specified\n");
+        error_report("Kernel image must be specified");
         exit(1);
     }
 
@@ -83,7 +83,7 @@
         entry = KERNEL_LOAD_ADDR;
     }
     if (kernel_size < 0) {
-        fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
+        error_report("Could not load kernel '%s'", kernel_filename);
         exit(1);
     }
 
diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c
index b81901f..bd8e993 100644
--- a/hw/m68k/mcf5206.c
+++ b/hw/m68k/mcf5206.c
@@ -6,6 +6,7 @@
  * This code is licensed under the GPL
  */
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/hw.h"
@@ -137,7 +138,7 @@
     m5206_timer_state *s;
     QEMUBH *bh;
 
-    s = (m5206_timer_state *)g_malloc0(sizeof(m5206_timer_state));
+    s = g_new0(m5206_timer_state, 1);
     bh = qemu_bh_new(m5206_timer_trigger, s);
     s->timer = ptimer_init(bh, PTIMER_POLICY_DEFAULT);
     s->irq = irq;
@@ -220,7 +221,7 @@
                 break;
             default:
                 /* Unknown vector.  */
-                fprintf(stderr, "Unhandled vector for IRQ %d\n", irq);
+                error_report("Unhandled vector for IRQ %d", irq);
                 vector = 0xf;
                 break;
             }
@@ -533,7 +534,7 @@
     m5206_mbar_state *s;
     qemu_irq *pic;
 
-    s = (m5206_mbar_state *)g_malloc0(sizeof(m5206_mbar_state));
+    s = g_new0(m5206_mbar_state, 1);
 
     memory_region_init_io(&s->iomem, NULL, &m5206_mbar_ops, s,
                           "mbar", 0x00001000);
diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index b9dde75..68589c3 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -6,6 +6,7 @@
  * This code is licensed under the GPL
  */
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "cpu.h"
@@ -183,7 +184,7 @@
     memory_region_add_subregion(address_space, 0xfc0a8000, iomem);
     /* Timers.  */
     for (i = 0; i < 2; i++) {
-        s = (m5208_timer_state *)g_malloc0(sizeof(m5208_timer_state));
+        s = g_new0(m5208_timer_state, 1);
         bh = qemu_bh_new(m5208_timer_trigger, s);
         s->timer = ptimer_init(bh, PTIMER_POLICY_DEFAULT);
         memory_region_init_io(&s->iomem, NULL, &m5208_timer_ops, s,
@@ -257,7 +258,7 @@
     mcf5208_sys_init(address_space_mem, pic);
 
     if (nb_nics > 1) {
-        fprintf(stderr, "Too many NICs\n");
+        error_report("Too many NICs");
         exit(1);
     }
     if (nd_table[0].used) {
@@ -292,7 +293,7 @@
         if (qtest_enabled()) {
             return;
         }
-        fprintf(stderr, "Kernel image must be specified\n");
+        error_report("Kernel image must be specified");
         exit(1);
     }
 
@@ -309,7 +310,7 @@
         entry = 0x40000000;
     }
     if (kernel_size < 0) {
-        fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
+        error_report("Could not load kernel '%s'", kernel_filename);
         exit(1);
     }
 
diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index e8b2eef..5a9dad9 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -1232,6 +1232,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init    = gt64120_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void gt64120_class_init(ObjectClass *klass, void *data)
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
index e8f0a02..19202d9 100644
--- a/hw/misc/Makefile.objs
+++ b/hw/misc/Makefile.objs
@@ -9,6 +9,7 @@
 common-obj-$(CONFIG_EDU) += edu.o
 
 common-obj-y += unimp.o
+common-obj-y += vmcoreinfo.o
 
 obj-$(CONFIG_VMPORT) += vmport.o
 
diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index 01acacf..34eb05d 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -408,12 +408,17 @@
 
 static void pci_edu_register_types(void)
 {
+    static InterfaceInfo interfaces[] = {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    };
     static const TypeInfo edu_info = {
         .name          = "edu",
         .parent        = TYPE_PCI_DEVICE,
         .instance_size = sizeof(EduState),
         .instance_init = edu_instance_init,
         .class_init    = edu_class_init,
+        .interfaces = interfaces,
     };
 
     type_register_static(&edu_info);
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index b3ef3ec..a5a4682 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -1010,6 +1010,10 @@
     .instance_size = sizeof(IVShmemState),
     .abstract      = true,
     .class_init    = ivshmem_common_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static const VMStateDescription ivshmem_plain_vmsd = {
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 9aa7e75..44f91d1 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -426,6 +426,10 @@
     .instance_init = macio_instance_init,
     .abstract      = true,
     .class_init    = macio_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void macio_register_types(void)
diff --git a/hw/misc/pci-testdev.c b/hw/misc/pci-testdev.c
index 7d59902..32041f5 100644
--- a/hw/misc/pci-testdev.c
+++ b/hw/misc/pci-testdev.c
@@ -326,6 +326,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCITestDevState),
     .class_init    = pci_testdev_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pci_testdev_register_types(void)
diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
new file mode 100644
index 0000000..a618e12
--- /dev/null
+++ b/hw/misc/vmcoreinfo.c
@@ -0,0 +1,96 @@
+/*
+ * Virtual Machine coreinfo device
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * Authors: Marc-André Lureau <marcandre.lureau@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "hw/nvram/fw_cfg.h"
+#include "hw/misc/vmcoreinfo.h"
+
+static void fw_cfg_vmci_write(void *dev, off_t offset, size_t len)
+{
+    VMCoreInfoState *s = VMCOREINFO(dev);
+
+    s->has_vmcoreinfo = offset == 0 && len == sizeof(s->vmcoreinfo)
+        && s->vmcoreinfo.guest_format != VMCOREINFO_FORMAT_NONE;
+}
+
+static void vmcoreinfo_reset(void *dev)
+{
+    VMCoreInfoState *s = VMCOREINFO(dev);
+
+    s->has_vmcoreinfo = false;
+    memset(&s->vmcoreinfo, 0, sizeof(s->vmcoreinfo));
+    s->vmcoreinfo.host_format = cpu_to_le16(VMCOREINFO_FORMAT_ELF);
+}
+
+static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
+{
+    VMCoreInfoState *s = VMCOREINFO(dev);
+    FWCfgState *fw_cfg = fw_cfg_find();
+
+    /* Given that this function is executing, there is at least one VMCOREINFO
+     * device. Check if there are several.
+     */
+    if (!vmcoreinfo_find()) {
+        error_setg(errp, "at most one %s device is permitted",
+                   VMCOREINFO_DEVICE);
+        return;
+    }
+
+    if (!fw_cfg || !fw_cfg->dma_enabled) {
+        error_setg(errp, "%s device requires fw_cfg with DMA",
+                   VMCOREINFO_DEVICE);
+        return;
+    }
+
+    fw_cfg_add_file_callback(fw_cfg, "etc/vmcoreinfo",
+                             NULL, fw_cfg_vmci_write, s,
+                             &s->vmcoreinfo, sizeof(s->vmcoreinfo), false);
+
+    qemu_register_reset(vmcoreinfo_reset, dev);
+}
+
+static const VMStateDescription vmstate_vmcoreinfo = {
+    .name = "vmcoreinfo",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_BOOL(has_vmcoreinfo, VMCoreInfoState),
+        VMSTATE_UINT16(vmcoreinfo.host_format, VMCoreInfoState),
+        VMSTATE_UINT16(vmcoreinfo.guest_format, VMCoreInfoState),
+        VMSTATE_UINT32(vmcoreinfo.size, VMCoreInfoState),
+        VMSTATE_UINT64(vmcoreinfo.paddr, VMCoreInfoState),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->vmsd = &vmstate_vmcoreinfo;
+    dc->realize = vmcoreinfo_realize;
+    dc->hotpluggable = false;
+}
+
+static const TypeInfo vmcoreinfo_device_info = {
+    .name          = VMCOREINFO_DEVICE,
+    .parent        = TYPE_DEVICE,
+    .instance_size = sizeof(VMCoreInfoState),
+    .class_init    = vmcoreinfo_device_class_init,
+};
+
+static void vmcoreinfo_register_types(void)
+{
+    type_register_static(&vmcoreinfo_device_info);
+}
+
+type_init(vmcoreinfo_register_types)
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index cae9518..c0abee4 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1687,6 +1687,10 @@
     .instance_init = e1000_instance_init,
     .class_size    = sizeof(E1000BaseClass),
     .abstract      = true,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static const E1000Info e1000_devices[] = {
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index 744f0f3..f1af279 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -710,6 +710,10 @@
     .instance_size = sizeof(E1000EState),
     .class_init = e1000e_class_init,
     .instance_init = e1000e_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { }
+    },
 };
 
 static void e1000e_register_types(void)
diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index a7b9f77..80b8f47 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -2116,6 +2116,10 @@
         type_info.class_init = eepro100_class_init;
         type_info.instance_size = sizeof(EEPRO100State);
         type_info.instance_init = eepro100_instance_init;
+        type_info.interfaces = (InterfaceInfo[]) {
+            { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+            { },
+        };
 
         type_register(&type_info);
     }
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
index 798d681..3938e6d 100644
--- a/hw/net/ne2000.c
+++ b/hw/net/ne2000.c
@@ -786,6 +786,10 @@
     .instance_size = sizeof(PCINE2000State),
     .class_init    = ne2000_class_init,
     .instance_init = ne2000_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void ne2000_register_types(void)
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 0acf8a4..0ae5ca4 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -365,6 +365,10 @@
     .instance_size = sizeof(PCIPCNetState),
     .class_init    = pcnet_class_init,
     .instance_init = pcnet_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pci_pcnet_register_types(void)
diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c
index 9273473..823a29d 100644
--- a/hw/net/rocker/rocker.c
+++ b/hw/net/rocker/rocker.c
@@ -1525,6 +1525,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(Rocker),
     .class_init    = rocker_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void rocker_register_types(void)
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index d6c8188..a6b2a9f 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -3444,6 +3444,10 @@
     .instance_size = sizeof(RTL8139State),
     .class_init    = rtl8139_class_init,
     .instance_init = rtl8139_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void rtl8139_register_types(void)
diff --git a/hw/net/sungem.c b/hw/net/sungem.c
index dffa0c9..6aa8d11 100644
--- a/hw/net/sungem.c
+++ b/hw/net/sungem.c
@@ -1437,6 +1437,10 @@
     .instance_size = sizeof(SunGEMState),
     .class_init    = sungem_class_init,
     .instance_init = sungem_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { }
+    }
 };
 
 static void sungem_register_types(void)
diff --git a/hw/net/sunhme.c b/hw/net/sunhme.c
index 60277ad..b1efa1b 100644
--- a/hw/net/sunhme.c
+++ b/hw/net/sunhme.c
@@ -968,6 +968,10 @@
     .class_init    = sunhme_class_init,
     .instance_size = sizeof(SunHMEState),
     .instance_init = sunhme_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { }
+    }
 };
 
 static void sunhme_register_types(void)
diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index b43b58b..8c4bae5 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -2653,6 +2653,11 @@
     .instance_size = sizeof(VMXNET3State),
     .class_init    = vmxnet3_class_init,
     .instance_init = vmxnet3_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { }
+    },
 };
 
 static void vmxnet3_register_types(void)
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index e3bd626..753ac0e 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -56,6 +56,7 @@
     uint8_t *data;
     void *callback_opaque;
     FWCfgCallback select_cb;
+    FWCfgWriteCallback write_cb;
 };
 
 #define JPG_FILE 0
@@ -370,6 +371,8 @@
                     dma_memory_read(s->dma_as, dma.address,
                                     &e->data[s->cur_offset], len)) {
                     dma.control |= FW_CFG_DMA_CTL_ERROR;
+                } else if (e->write_cb) {
+                    e->write_cb(e->callback_opaque, s->cur_offset, len);
                 }
             }
 
@@ -570,6 +573,7 @@
 
 static void fw_cfg_add_bytes_callback(FWCfgState *s, uint16_t key,
                                       FWCfgCallback select_cb,
+                                      FWCfgWriteCallback write_cb,
                                       void *callback_opaque,
                                       void *data, size_t len,
                                       bool read_only)
@@ -584,6 +588,7 @@
     s->entries[arch][key].data = data;
     s->entries[arch][key].len = (uint32_t)len;
     s->entries[arch][key].select_cb = select_cb;
+    s->entries[arch][key].write_cb = write_cb;
     s->entries[arch][key].callback_opaque = callback_opaque;
     s->entries[arch][key].allow_write = !read_only;
 }
@@ -610,7 +615,7 @@
 
 void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len)
 {
-    fw_cfg_add_bytes_callback(s, key, NULL, NULL, data, len, true);
+    fw_cfg_add_bytes_callback(s, key, NULL, NULL, NULL, data, len, true);
 }
 
 void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value)
@@ -737,6 +742,7 @@
 
 void fw_cfg_add_file_callback(FWCfgState *s,  const char *filename,
                               FWCfgCallback select_cb,
+                              FWCfgWriteCallback write_cb,
                               void *callback_opaque,
                               void *data, size_t len, bool read_only)
 {
@@ -800,7 +806,7 @@
     }
 
     fw_cfg_add_bytes_callback(s, FW_CFG_FILE_FIRST + index,
-                              select_cb,
+                              select_cb, write_cb,
                               callback_opaque, data, len,
                               read_only);
 
@@ -815,7 +821,7 @@
 void fw_cfg_add_file(FWCfgState *s,  const char *filename,
                      void *data, size_t len)
 {
-    fw_cfg_add_file_callback(s, filename, NULL, NULL, data, len, true);
+    fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);
 }
 
 void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
@@ -838,7 +844,7 @@
         }
     }
     /* add new one */
-    fw_cfg_add_file_callback(s, filename, NULL, NULL, data, len, true);
+    fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);
     return NULL;
 }
 
diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index eb275e1..84492d5 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -79,6 +79,10 @@
     .parent        = TYPE_PCI_BRIDGE,
     .instance_size = sizeof(PCIBridge),
     .class_init    = dec_21154_pci_bridge_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
@@ -138,6 +142,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init    = dec_21154_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
index ed03ffc..ad4e6aa 100644
--- a/hw/pci-bridge/gen_pcie_root_port.c
+++ b/hw/pci-bridge/gen_pcie_root_port.c
@@ -85,6 +85,13 @@
         rpc->parent_class.exit(d);
         return;
     }
+
+    if (!grp->io_reserve) {
+        pci_word_test_and_clear_mask(d->wmask + PCI_COMMAND,
+                                     PCI_COMMAND_IO);
+        d->wmask[PCI_IO_BASE] = 0;
+        d->wmask[PCI_IO_LIMIT] = 0;
+    }
 }
 
 static const VMStateDescription vmstate_rp_dev = {
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index 2c1b747..cb522bf 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -106,6 +106,10 @@
     .parent        = TYPE_PCI_BRIDGE,
     .instance_size = sizeof(I82801b11Bridge),
     .class_init    = i82801b11_bridge_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void d2pbr_register(void)
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index da4e5bd..5f56a2f 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -64,15 +64,13 @@
 static int ioh3420_interrupts_init(PCIDevice *d, Error **errp)
 {
     int rc;
-    Error *local_err = NULL;
 
     rc = msi_init(d, IOH_EP_MSI_OFFSET, IOH_EP_MSI_NR_VECTOR,
                   IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
                   IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT,
-                  &local_err);
+                  errp);
     if (rc < 0) {
         assert(rc == -ENOTSUP);
-        error_propagate(errp, local_err);
     }
 
     return rc;
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 4373f1d..d56f663 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -238,6 +238,7 @@
     .instance_finalize = pci_bridge_dev_instance_finalize,
     .interfaces = (InterfaceInfo[]) {
         { TYPE_HOTPLUG_HANDLER },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
         { }
     }
 };
diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index ff59abf..8c8ac73 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -316,6 +316,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PXBDev),
     .class_init    = pxb_dev_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pxb_pcie_dev_realize(PCIDevice *dev, Error **errp)
@@ -350,6 +354,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PXBDev),
     .class_init    = pxb_pcie_dev_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pxb_register_types(void)
diff --git a/hw/pci-bridge/pcie_pci_bridge.c b/hw/pci-bridge/pcie_pci_bridge.c
index 9aa5cc3..a4d827c 100644
--- a/hw/pci-bridge/pcie_pci_bridge.c
+++ b/hw/pci-bridge/pcie_pci_bridge.c
@@ -65,10 +65,18 @@
         goto aer_error;
     }
 
+    Error *local_err = NULL;
     if (pcie_br->msi != ON_OFF_AUTO_OFF) {
-        rc = msi_init(d, 0, 1, true, true, errp);
+        rc = msi_init(d, 0, 1, true, true, &local_err);
         if (rc < 0) {
-            goto msi_error;
+            assert(rc == -ENOTSUP);
+            if (pcie_br->msi != ON_OFF_AUTO_ON) {
+                error_free(local_err);
+            } else {
+                /* failed to satisfy user's explicit request for MSI */
+                error_propagate(errp, local_err);
+                goto msi_error;
+            }
         }
     }
     pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY |
@@ -81,7 +89,7 @@
 pm_error:
     pcie_cap_exit(d);
 cap_error:
-    shpc_free(d);
+    shpc_cleanup(d, &pcie_br->shpc_bar);
 error:
     pci_bridge_exitfn(d);
 }
@@ -98,7 +106,9 @@
 {
     PCIDevice *d = PCI_DEVICE(qdev);
     pci_bridge_reset(qdev);
-    msi_reset(d);
+    if (msi_present(d)) {
+        msi_reset(d);
+    }
     shpc_reset(d);
 }
 
@@ -106,12 +116,14 @@
         uint32_t address, uint32_t val, int len)
 {
     pci_bridge_write_config(d, address, val, len);
-    msi_write_config(d, address, val, len);
+    if (msi_present(d)) {
+        msi_write_config(d, address, val, len);
+    }
     shpc_cap_write_config(d, address, val, len);
 }
 
 static Property pcie_pci_bridge_dev_properties[] = {
-        DEFINE_PROP_ON_OFF_AUTO("msi", PCIEPCIBridge, msi, ON_OFF_AUTO_ON),
+        DEFINE_PROP_ON_OFF_AUTO("msi", PCIEPCIBridge, msi, ON_OFF_AUTO_AUTO),
         DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -180,6 +192,7 @@
         .class_init = pcie_pci_bridge_class_init,
         .interfaces = (InterfaceInfo[]) {
             { TYPE_HOTPLUG_HANDLER },
+            { INTERFACE_PCIE_DEVICE },
             { },
         }
 };
diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c
index 4d588cb..9b6e4ce 100644
--- a/hw/pci-bridge/pcie_root_port.c
+++ b/hw/pci-bridge/pcie_root_port.c
@@ -161,6 +161,10 @@
     .class_init    = rp_class_init,
     .abstract      = true,
     .class_size = sizeof(PCIERootPortClass),
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { }
+    },
 };
 
 static void rp_register_types(void)
diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
index e706f36..1e09d2a 100644
--- a/hw/pci-bridge/xio3130_downstream.c
+++ b/hw/pci-bridge/xio3130_downstream.c
@@ -94,6 +94,7 @@
     pcie_chassis_create(s->chassis);
     rc = pcie_chassis_add_slot(s);
     if (rc < 0) {
+        error_setg(errp, "Can't add chassis slot, error %d", rc);
         goto err_pcie_cap;
     }
 
@@ -195,6 +196,10 @@
     .name          = "xio3130-downstream",
     .parent        = TYPE_PCIE_SLOT,
     .class_init    = xio3130_downstream_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { }
+    },
 };
 
 static void xio3130_downstream_register_types(void)
diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
index a052224..227997c 100644
--- a/hw/pci-bridge/xio3130_upstream.c
+++ b/hw/pci-bridge/xio3130_upstream.c
@@ -166,6 +166,10 @@
     .name          = "x3130-upstream",
     .parent        = TYPE_PCIE_PORT,
     .class_init    = xio3130_upstream_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { }
+    },
 };
 
 static void xio3130_upstream_register_types(void)
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index b709456..1edf57f 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -836,6 +836,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init    = pbm_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pbm_host_class_init(ObjectClass *klass, void *data)
@@ -883,6 +887,10 @@
     .parent        = TYPE_PCI_BRIDGE,
     .class_init    = pbm_pci_bridge_class_init,
     .instance_size = sizeof(PBMPCIBridge),
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pbm_iommu_memory_region_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 89133a9..9f61e27 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -833,6 +833,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIBonitoState),
     .class_init    = bonito_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void bonito_pcihost_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index be25245..4090793 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -166,6 +166,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(GPEXRootState),
     .class_init = gpex_root_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void gpex_register(void)
diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
index 2e281f6..38cd279 100644
--- a/hw/pci-host/grackle.c
+++ b/hw/pci-host/grackle.c
@@ -142,6 +142,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init = grackle_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pci_grackle_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index dec345f..a7e2256 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -696,6 +696,10 @@
     .instance_size = sizeof(PIIX3State),
     .abstract = true,
     .class_init = pci_piix3_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void piix3_class_init(ObjectClass *klass, void *data)
@@ -750,6 +754,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCII440FXState),
     .class_init    = i440fx_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 /* IGD Passthrough Host Bridge. */
diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
index becc0ee..39cd244 100644
--- a/hw/pci-host/ppce500.c
+++ b/hw/pci-host/ppce500.c
@@ -516,6 +516,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PPCE500PCIBridgeState),
     .class_init    = e500_host_bridge_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static Property pcihost_properties[] = {
diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 8b293ba..92eed0f 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -372,6 +372,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(RavenPCIState),
     .class_init = raven_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static Property raven_pcihost_properties[] = {
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index 1ff648e..ddaa7d1 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -591,6 +591,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(MCHPCIState),
     .class_init = mch_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void q35_register(void)
diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 6cf5e59..ea5c265 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -374,6 +374,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init = unin_main_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void u3_agp_pci_host_class_init(ObjectClass *klass, void *data)
@@ -398,6 +402,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init = u3_agp_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void unin_agp_pci_host_class_init(ObjectClass *klass, void *data)
@@ -422,6 +430,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init = unin_agp_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void unin_internal_pci_host_class_init(ObjectClass *klass, void *data)
@@ -446,6 +458,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init = unin_internal_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void pci_unin_main_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index aa1fdf7..6394a52 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -487,6 +487,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init    = versatile_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static Property pci_vpb_properties[] = {
diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c
index 4613dda..7659253 100644
--- a/hw/pci-host/xilinx-pcie.c
+++ b/hw/pci-host/xilinx-pcie.c
@@ -317,6 +317,10 @@
     .parent = TYPE_PCI_BRIDGE,
     .instance_size = sizeof(XilinxPCIERoot),
     .class_init = xilinx_pcie_root_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { }
+    },
 };
 
 static void xilinx_pcie_register(void)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1e6fb88..5ed3c8d 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -170,6 +170,16 @@
     .class_init = pci_bus_class_init,
 };
 
+static const TypeInfo pcie_interface_info = {
+    .name          = INTERFACE_PCIE_DEVICE,
+    .parent        = TYPE_INTERFACE,
+};
+
+static const TypeInfo conventional_pci_interface_info = {
+    .name          = INTERFACE_CONVENTIONAL_PCI_DEVICE,
+    .parent        = TYPE_INTERFACE,
+};
+
 static const TypeInfo pcie_bus_info = {
     .name = TYPE_PCIE_BUS,
     .parent = TYPE_PCI_BUS,
@@ -2537,6 +2547,17 @@
     pc->realize = pci_default_realize;
 }
 
+static void pci_device_class_base_init(ObjectClass *klass, void *data)
+{
+    if (!object_class_is_abstract(klass)) {
+        ObjectClass *conventional =
+            object_class_dynamic_cast(klass, INTERFACE_CONVENTIONAL_PCI_DEVICE);
+        ObjectClass *pcie =
+            object_class_dynamic_cast(klass, INTERFACE_PCIE_DEVICE);
+        assert(conventional || pcie);
+    }
+}
+
 AddressSpace *pci_device_iommu_address_space(PCIDevice *dev)
 {
     PCIBus *bus = PCI_BUS(dev->bus);
@@ -2661,12 +2682,15 @@
     .abstract = true,
     .class_size = sizeof(PCIDeviceClass),
     .class_init = pci_device_class_init,
+    .class_base_init = pci_device_class_base_init,
 };
 
 static void pci_register_types(void)
 {
     type_register_static(&pci_bus_info);
     type_register_static(&pcie_bus_info);
+    type_register_static(&conventional_pci_interface_info);
+    type_register_static(&pcie_interface_info);
     type_register_static(&pci_device_type_info);
 }
 
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index 17feae5..a47d257 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -379,7 +379,8 @@
     sec_bus->address_space_mem = &br->address_space_mem;
     memory_region_init(&br->address_space_mem, OBJECT(br), "pci_bridge_pci", UINT64_MAX);
     sec_bus->address_space_io = &br->address_space_io;
-    memory_region_init(&br->address_space_io, OBJECT(br), "pci_bridge_io", 65536);
+    memory_region_init(&br->address_space_io, OBJECT(br), "pci_bridge_io",
+                       UINT32_MAX);
     br->windows = pci_bridge_region_init(br);
     QLIST_INIT(&sec_bus->child);
     QLIST_INSERT_HEAD(&parent->child, sec_bus, sibling);
diff --git a/hw/pci/pcie_host.c b/hw/pci/pcie_host.c
index dcebf57..553db56 100644
--- a/hw/pci/pcie_host.c
+++ b/hw/pci/pcie_host.c
@@ -81,7 +81,7 @@
 static const MemoryRegionOps pcie_mmcfg_ops = {
     .read = pcie_mmcfg_data_read,
     .write = pcie_mmcfg_data_write,
-    .endianness = DEVICE_NATIVE_ENDIAN,
+    .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
 static void pcie_host_init(Object *obj)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index db0e49a..9178e70 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -803,11 +803,6 @@
     SysBusDevice *s;
     PPCE500CCSRState *ccsr;
 
-    /* Setup CPUs */
-    if (machine->cpu_model == NULL) {
-        machine->cpu_model = "e500v2_v30";
-    }
-
     irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
     irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB);
     for (i = 0; i < smp_cpus; i++) {
@@ -815,8 +810,7 @@
         CPUState *cs;
         qemu_irq *input;
 
-        cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
-                                           machine->cpu_model));
+        cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
         env = &cpu->env;
         cs = CPU(cpu);
 
diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c
index 94b4545..e59e80f 100644
--- a/hw/ppc/e500plat.c
+++ b/hw/ppc/e500plat.c
@@ -64,6 +64,7 @@
     mc->init = e500plat_init;
     mc->max_cpus = 32;
     mc->has_dynamic_sysbus = true;
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30");
 }
 
 DEFINE_MACHINE("ppce500", e500plat_machine_init)
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 6d0ace2..3fa7c42 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -174,16 +174,8 @@
     linux_boot = (kernel_filename != NULL);
 
     /* init CPUs */
-    if (machine->cpu_model == NULL) {
-#ifdef TARGET_PPC64
-        machine->cpu_model = "970fx";
-#else
-        machine->cpu_model = "G4";
-#endif
-    }
     for (i = 0; i < smp_cpus; i++) {
-        cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
-                                           machine->cpu_model));
+        cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
         env = &cpu->env;
 
         /* Set time-base frequency to 100 Mhz */
@@ -520,6 +512,11 @@
     mc->max_cpus = MAX_CPUS;
     mc->default_boot_order = "cd";
     mc->kvm_type = core99_kvm_type;
+#ifdef TARGET_PPC64
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("970fx_v3.1");
+#else
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7400_v2.9");
+#endif
 }
 
 static const TypeInfo core99_machine_info = {
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index bc7c8b7..010ea36 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -108,11 +108,8 @@
     linux_boot = (kernel_filename != NULL);
 
     /* init CPUs */
-    if (machine->cpu_model == NULL)
-        machine->cpu_model = "G3";
     for (i = 0; i < smp_cpus; i++) {
-        cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
-                                           machine->cpu_model));
+        cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
         env = &cpu->env;
 
         /* Set time-base frequency to 16.6 Mhz */
@@ -385,6 +382,7 @@
     /* TOFIX "cad" when Mac floppy is implemented */
     mc->default_boot_order = "cd";
     mc->kvm_type = heathrow_kvm_type;
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("750_v3.1");
 }
 
 static const TypeInfo ppc_heathrow_machine_info = {
diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c
index 27b8289..1717953 100644
--- a/hw/ppc/mpc8544ds.c
+++ b/hw/ppc/mpc8544ds.c
@@ -16,6 +16,7 @@
 #include "sysemu/device_tree.h"
 #include "hw/ppc/openpic.h"
 #include "qemu/error-report.h"
+#include "cpu.h"
 
 static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)
 {
@@ -55,6 +56,7 @@
     mc->desc = "mpc8544ds";
     mc->init = mpc8544ds_init;
     mc->max_cpus = 15;
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("e500v2_v30");
 }
 
 DEFINE_MACHINE("mpc8544ds", ppce500_machine_init)
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index d46d91c..c35c439 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -55,6 +55,16 @@
 #define KERNEL_LOAD_ADDR        0x20000000
 #define INITRD_LOAD_ADDR        0x40000000
 
+static const char *pnv_chip_core_typename(const PnvChip *o)
+{
+    const char *chip_type = object_class_get_name(object_get_class(OBJECT(o)));
+    int len = strlen(chip_type) - strlen(PNV_CHIP_TYPE_SUFFIX);
+    char *s = g_strdup_printf(PNV_CORE_TYPE_NAME("%.*s"), len, chip_type);
+    const char *core_type = object_class_get_name(object_class_by_name(s));
+    g_free(s);
+    return core_type;
+}
+
 /*
  * On Power Systems E880 (POWER8), the max cpus (threads) should be :
  *     4 * 4 sockets * 12 cores * 8 threads = 1536
@@ -92,8 +102,7 @@
     int cpus_offset = fdt_path_offset(fdt, "/cpus");
 
     if (cpus_offset < 0) {
-        cpus_offset = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
-                                      "cpus");
+        cpus_offset = fdt_add_subnode(fdt, 0, "cpus");
         if (cpus_offset) {
             _FDT((fdt_setprop_cell(fdt, cpus_offset, "#address-cells", 0x1)));
             _FDT((fdt_setprop_cell(fdt, cpus_offset, "#size-cells", 0x0)));
@@ -270,8 +279,7 @@
 
 static void powernv_populate_chip(PnvChip *chip, void *fdt)
 {
-    PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
-    char *typename = pnv_core_typename(pcc->cpu_model);
+    const char *typename = pnv_chip_core_typename(chip);
     size_t typesize = object_type_get_instance_size(typename);
     int i;
 
@@ -301,7 +309,6 @@
         powernv_populate_memory_node(fdt, chip->chip_id, chip->ram_start,
                                      chip->ram_size);
     }
-    g_free(typename);
 }
 
 static void powernv_populate_rtc(ISADevice *d, void *fdt, int lpc_off)
@@ -607,16 +614,13 @@
         }
     }
 
-    /* We need some cpu model to instantiate the PnvChip class */
-    if (machine->cpu_model == NULL) {
-        machine->cpu_model = "POWER8";
-    }
-
     /* Create the processor chips */
-    chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model);
+    i = strlen(machine->cpu_type) - strlen(POWERPC_CPU_TYPE_SUFFIX);
+    chip_typename = g_strdup_printf(PNV_CHIP_TYPE_NAME("%.*s"),
+                                    i, machine->cpu_type);
     if (!object_class_by_name(chip_typename)) {
-        error_report("invalid CPU model '%s' for %s machine",
-                     machine->cpu_model, MACHINE_GET_CLASS(machine)->name);
+        error_report("invalid CPU model '%.*s' for %s machine",
+                     i, machine->cpu_type, MACHINE_GET_CLASS(machine)->name);
         exit(1);
     }
 
@@ -716,7 +720,6 @@
     DeviceClass *dc = DEVICE_CLASS(klass);
     PnvChipClass *k = PNV_CHIP_CLASS(klass);
 
-    k->cpu_model = "POWER8E";
     k->chip_type = PNV_CHIP_POWER8E;
     k->chip_cfam_id = 0x221ef04980000000ull;  /* P8 Murano DD2.1 */
     k->cores_mask = POWER8E_CORE_MASK;
@@ -726,19 +729,11 @@
     dc->desc = "PowerNV Chip POWER8E";
 }
 
-static const TypeInfo pnv_chip_power8e_info = {
-    .name          = TYPE_PNV_CHIP_POWER8E,
-    .parent        = TYPE_PNV_CHIP,
-    .instance_size = sizeof(PnvChip),
-    .class_init    = pnv_chip_power8e_class_init,
-};
-
 static void pnv_chip_power8_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     PnvChipClass *k = PNV_CHIP_CLASS(klass);
 
-    k->cpu_model = "POWER8";
     k->chip_type = PNV_CHIP_POWER8;
     k->chip_cfam_id = 0x220ea04980000000ull; /* P8 Venice DD2.0 */
     k->cores_mask = POWER8_CORE_MASK;
@@ -748,19 +743,11 @@
     dc->desc = "PowerNV Chip POWER8";
 }
 
-static const TypeInfo pnv_chip_power8_info = {
-    .name          = TYPE_PNV_CHIP_POWER8,
-    .parent        = TYPE_PNV_CHIP,
-    .instance_size = sizeof(PnvChip),
-    .class_init    = pnv_chip_power8_class_init,
-};
-
 static void pnv_chip_power8nvl_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     PnvChipClass *k = PNV_CHIP_CLASS(klass);
 
-    k->cpu_model = "POWER8NVL";
     k->chip_type = PNV_CHIP_POWER8NVL;
     k->chip_cfam_id = 0x120d304980000000ull;  /* P8 Naples DD1.0 */
     k->cores_mask = POWER8_CORE_MASK;
@@ -770,19 +757,11 @@
     dc->desc = "PowerNV Chip POWER8NVL";
 }
 
-static const TypeInfo pnv_chip_power8nvl_info = {
-    .name          = TYPE_PNV_CHIP_POWER8NVL,
-    .parent        = TYPE_PNV_CHIP,
-    .instance_size = sizeof(PnvChip),
-    .class_init    = pnv_chip_power8nvl_class_init,
-};
-
 static void pnv_chip_power9_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     PnvChipClass *k = PNV_CHIP_CLASS(klass);
 
-    k->cpu_model = "POWER9";
     k->chip_type = PNV_CHIP_POWER9;
     k->chip_cfam_id = 0x100d104980000000ull; /* P9 Nimbus DD1.0 */
     k->cores_mask = POWER9_CORE_MASK;
@@ -792,13 +771,6 @@
     dc->desc = "PowerNV Chip POWER9";
 }
 
-static const TypeInfo pnv_chip_power9_info = {
-    .name          = TYPE_PNV_CHIP_POWER9,
-    .parent        = TYPE_PNV_CHIP,
-    .instance_size = sizeof(PnvChip),
-    .class_init    = pnv_chip_power9_class_init,
-};
-
 static void pnv_chip_core_sanitize(PnvChip *chip, Error **errp)
 {
     PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
@@ -857,7 +829,7 @@
 static void pnv_chip_icp_realize(PnvChip *chip, Error **errp)
 {
     PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
-    char *typename = pnv_core_typename(pcc->cpu_model);
+    const char *typename = pnv_chip_core_typename(chip);
     size_t typesize = object_type_get_instance_size(typename);
     int i, j;
     char *name;
@@ -882,8 +854,6 @@
             memory_region_add_subregion(&chip->icp_mmio, pir << 12, &icp->mmio);
         }
     }
-
-    g_free(typename);
 }
 
 static void pnv_chip_realize(DeviceState *dev, Error **errp)
@@ -891,7 +861,7 @@
     PnvChip *chip = PNV_CHIP(dev);
     Error *error = NULL;
     PnvChipClass *pcc = PNV_CHIP_GET_CLASS(chip);
-    char *typename = pnv_core_typename(pcc->cpu_model);
+    const char *typename = pnv_chip_core_typename(chip);
     size_t typesize = object_type_get_instance_size(typename);
     int i, core_hwid;
 
@@ -950,7 +920,6 @@
                                 &PNV_CORE(pnv_core)->xscom_regs);
         i++;
     }
-    g_free(typename);
 
     /* Create LPC controller */
     object_property_set_bool(OBJECT(&chip->lpc), true, "realized",
@@ -1003,15 +972,6 @@
     dc->desc = "PowerNV Chip";
 }
 
-static const TypeInfo pnv_chip_info = {
-    .name          = TYPE_PNV_CHIP,
-    .parent        = TYPE_SYS_BUS_DEVICE,
-    .class_init    = pnv_chip_class_init,
-    .instance_init = pnv_chip_init,
-    .class_size    = sizeof(PnvChipClass),
-    .abstract      = true,
-};
-
 static ICSState *pnv_ics_get(XICSFabric *xi, int irq)
 {
     PnvMachineState *pnv = POWERNV_MACHINE(xi);
@@ -1133,6 +1093,7 @@
     mc->init = ppc_powernv_init;
     mc->reset = ppc_powernv_reset;
     mc->max_cpus = MAX_CPUS;
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
     mc->block_default_type = IF_IDE; /* Pnv provides a AHCI device for
                                       * storage */
     mc->no_parallel = 1;
@@ -1146,27 +1107,40 @@
     powernv_machine_class_props_init(oc);
 }
 
-static const TypeInfo powernv_machine_info = {
-    .name          = TYPE_POWERNV_MACHINE,
-    .parent        = TYPE_MACHINE,
-    .instance_size = sizeof(PnvMachineState),
-    .instance_init = powernv_machine_initfn,
-    .class_init    = powernv_machine_class_init,
-    .interfaces = (InterfaceInfo[]) {
-        { TYPE_XICS_FABRIC },
-        { TYPE_INTERRUPT_STATS_PROVIDER },
-        { },
+#define DEFINE_PNV_CHIP_TYPE(type, class_initfn) \
+    {                                            \
+        .name          = type,                   \
+        .class_init    = class_initfn,           \
+        .parent        = TYPE_PNV_CHIP,          \
+    }
+
+static const TypeInfo types[] = {
+    {
+        .name          = TYPE_POWERNV_MACHINE,
+        .parent        = TYPE_MACHINE,
+        .instance_size = sizeof(PnvMachineState),
+        .instance_init = powernv_machine_initfn,
+        .class_init    = powernv_machine_class_init,
+        .interfaces = (InterfaceInfo[]) {
+            { TYPE_XICS_FABRIC },
+            { TYPE_INTERRUPT_STATS_PROVIDER },
+            { },
+        },
     },
+    {
+        .name          = TYPE_PNV_CHIP,
+        .parent        = TYPE_SYS_BUS_DEVICE,
+        .class_init    = pnv_chip_class_init,
+        .instance_init = pnv_chip_init,
+        .instance_size = sizeof(PnvChip),
+        .class_size    = sizeof(PnvChipClass),
+        .abstract      = true,
+    },
+    DEFINE_PNV_CHIP_TYPE(TYPE_PNV_CHIP_POWER9, pnv_chip_power9_class_init),
+    DEFINE_PNV_CHIP_TYPE(TYPE_PNV_CHIP_POWER8, pnv_chip_power8_class_init),
+    DEFINE_PNV_CHIP_TYPE(TYPE_PNV_CHIP_POWER8E, pnv_chip_power8e_class_init),
+    DEFINE_PNV_CHIP_TYPE(TYPE_PNV_CHIP_POWER8NVL,
+                         pnv_chip_power8nvl_class_init),
 };
 
-static void powernv_machine_register_types(void)
-{
-    type_register_static(&powernv_machine_info);
-    type_register_static(&pnv_chip_info);
-    type_register_static(&pnv_chip_power8e_info);
-    type_register_static(&pnv_chip_power8_info);
-    type_register_static(&pnv_chip_power8nvl_info);
-    type_register_static(&pnv_chip_power9_info);
-}
-
-type_init(powernv_machine_register_types)
+DEFINE_TYPES(types)
diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c
index 6726483..82ff440 100644
--- a/hw/ppc/pnv_core.c
+++ b/hw/ppc/pnv_core.c
@@ -27,6 +27,16 @@
 #include "hw/ppc/pnv_xscom.h"
 #include "hw/ppc/xics.h"
 
+static const char *pnv_core_cpu_typename(PnvCore *pc)
+{
+    const char *core_type = object_class_get_name(object_get_class(OBJECT(pc)));
+    int len = strlen(core_type) - strlen(PNV_CORE_TYPE_SUFFIX);
+    char *s = g_strdup_printf(POWERPC_CPU_TYPE_NAME("%.*s"), len, core_type);
+    const char *cpu_type = object_class_get_name(object_class_by_name(s));
+    g_free(s);
+    return cpu_type;
+}
+
 static void powernv_cpu_reset(void *opaque)
 {
     PowerPCCPU *cpu = opaque;
@@ -148,8 +158,7 @@
 {
     PnvCore *pc = PNV_CORE(OBJECT(dev));
     CPUCore *cc = CPU_CORE(OBJECT(dev));
-    PnvCoreClass *pcc = PNV_CORE_GET_CLASS(OBJECT(dev));
-    const char *typename = object_class_get_name(pcc->cpu_oc);
+    const char *typename = pnv_core_cpu_typename(pc);
     size_t size = object_type_get_instance_size(typename);
     Error *local_err = NULL;
     void *obj;
@@ -211,46 +220,30 @@
 static void pnv_core_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
-    PnvCoreClass *pcc = PNV_CORE_CLASS(oc);
 
     dc->realize = pnv_core_realize;
     dc->props = pnv_core_properties;
-    pcc->cpu_oc = cpu_class_by_name(TYPE_POWERPC_CPU, data);
 }
 
-static const TypeInfo pnv_core_info = {
-    .name           = TYPE_PNV_CORE,
-    .parent         = TYPE_CPU_CORE,
-    .instance_size  = sizeof(PnvCore),
-    .class_size     = sizeof(PnvCoreClass),
-    .abstract       = true,
-};
-
-static const char *pnv_core_models[] = {
-    "POWER8E", "POWER8", "POWER8NVL", "POWER9"
-};
-
-static void pnv_core_register_types(void)
-{
-    int i ;
-
-    type_register_static(&pnv_core_info);
-    for (i = 0; i < ARRAY_SIZE(pnv_core_models); ++i) {
-        TypeInfo ti = {
-            .parent = TYPE_PNV_CORE,
-            .instance_size = sizeof(PnvCore),
-            .class_init = pnv_core_class_init,
-            .class_data = (void *) pnv_core_models[i],
-        };
-        ti.name = pnv_core_typename(pnv_core_models[i]);
-        type_register(&ti);
-        g_free((void *)ti.name);
+#define DEFINE_PNV_CORE_TYPE(cpu_model)         \
+    {                                           \
+        .parent = TYPE_PNV_CORE,                \
+        .name = PNV_CORE_TYPE_NAME(cpu_model),  \
     }
-}
 
-type_init(pnv_core_register_types)
+static const TypeInfo pnv_core_infos[] = {
+    {
+        .name           = TYPE_PNV_CORE,
+        .parent         = TYPE_CPU_CORE,
+        .instance_size  = sizeof(PnvCore),
+        .class_size     = sizeof(PnvCoreClass),
+        .class_init = pnv_core_class_init,
+        .abstract       = true,
+    },
+    DEFINE_PNV_CORE_TYPE("power8e_v2.1"),
+    DEFINE_PNV_CORE_TYPE("power8_v2.0"),
+    DEFINE_PNV_CORE_TYPE("power8nvl_v1.0"),
+    DEFINE_PNV_CORE_TYPE("power9_v2.0"),
+};
 
-char *pnv_core_typename(const char *model)
-{
-    return g_strdup_printf(TYPE_PNV_CORE "-%s", model);
-}
+DEFINE_TYPES(pnv_core_infos)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 05da316..7ec35de 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1359,28 +1359,3 @@
         break;
     }
 }
-
-void ppc_cpu_parse_features(const char *cpu_model)
-{
-    CPUClass *cc;
-    ObjectClass *oc;
-    const char *typename;
-    gchar **model_pieces;
-
-    model_pieces = g_strsplit(cpu_model, ",", 2);
-    if (!model_pieces[0]) {
-        error_report("Invalid/empty CPU model name");
-        exit(1);
-    }
-
-    oc = cpu_class_by_name(TYPE_POWERPC_CPU, model_pieces[0]);
-    if (oc == NULL) {
-        error_report("Unable to find CPU definition: %s", model_pieces[0]);
-        exit(1);
-    }
-
-    typename = object_class_get_name(oc);
-    cc = CPU_CLASS(oc);
-    cc->parse_features(typename, model_pieces[1], &error_fatal);
-    g_strfreev(model_pieces);
-}
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index 8e58065..205ebce 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -1629,7 +1629,8 @@
     qemu_irq *pic, *irqs;
 
     memset(clk_setup, 0, sizeof(clk_setup));
-    cpu = ppc4xx_init("405cr", &clk_setup[PPC405CR_CPU_CLK],
+    cpu = ppc4xx_init(POWERPC_CPU_TYPE_NAME("405crc"),
+                      &clk_setup[PPC405CR_CPU_CLK],
                       &clk_setup[PPC405CR_TMR_CLK], sysclk);
     env = &cpu->env;
     /* Memory mapped devices registers */
@@ -1981,7 +1982,8 @@
 
     memset(clk_setup, 0, sizeof(clk_setup));
     /* init CPUs */
-    cpu = ppc4xx_init("405ep", &clk_setup[PPC405EP_CPU_CLK],
+    cpu = ppc4xx_init(POWERPC_CPU_TYPE_NAME("405ep"),
+                      &clk_setup[PPC405EP_CPU_CLK],
                       &tlb_clk_setup, sysclk);
     env = &cpu->env;
     clk_setup[PPC405EP_CPU_CLK].cb = tlb_clk_setup.cb;
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index f92d47f..693c215 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -182,11 +182,7 @@
     int success;
     int i;
 
-    /* Setup CPU. */
-    if (machine->cpu_model == NULL) {
-        machine->cpu_model = "440EP";
-    }
-    cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, machine->cpu_model));
+    cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
 
     if (env->mmu_model != POWERPC_MMU_BOOKE) {
@@ -297,6 +293,7 @@
 {
     mc->desc = "bamboo";
     mc->init = bamboo_init;
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440epb");
 }
 
 DEFINE_MACHINE("bamboo", bamboo_machine_init)
diff --git a/hw/ppc/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
index 6d7f785..2e96389 100644
--- a/hw/ppc/ppc4xx_devs.c
+++ b/hw/ppc/ppc4xx_devs.c
@@ -48,7 +48,7 @@
 
 /*****************************************************************************/
 /* Generic PowerPC 4xx processor instantiation */
-PowerPCCPU *ppc4xx_init(const char *cpu_model,
+PowerPCCPU *ppc4xx_init(const char *cpu_type,
                         clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
                         uint32_t sysclk)
 {
@@ -56,7 +56,7 @@
     CPUPPCState *env;
 
     /* init CPUs */
-    cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model));
+    cpu = POWERPC_CPU(cpu_create(cpu_type));
     env = &cpu->env;
 
     cpu_clk->cb = NULL; /* We don't care about CPU clock frequency changes */
diff --git a/hw/ppc/ppc4xx_pci.c b/hw/ppc/ppc4xx_pci.c
index 6953f8b..4765dce 100644
--- a/hw/ppc/ppc4xx_pci.c
+++ b/hw/ppc/ppc4xx_pci.c
@@ -359,6 +359,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init    = ppc4xx_host_bridge_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void ppc4xx_pcihost_class_init(ObjectClass *klass, void *data)
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 94138a4..6f8accc 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -517,11 +517,8 @@
     linux_boot = (kernel_filename != NULL);
 
     /* init CPUs */
-    if (machine->cpu_model == NULL)
-        machine->cpu_model = "602";
     for (i = 0; i < smp_cpus; i++) {
-        cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
-                                           machine->cpu_model));
+        cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
         env = &cpu->env;
 
         if (env->flags & POWERPC_FLAG_RTC_CLK) {
@@ -684,6 +681,7 @@
     mc->block_default_type = IF_IDE;
     mc->max_cpus = MAX_CPUS;
     mc->default_boot_order = "cad";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("602");
 }
 
 static int prep_set_cmos_checksum(DeviceState *dev, void *opaque)
@@ -718,10 +716,7 @@
     char boot_device;
 
     /* init CPU */
-    if (!machine->cpu_model) {
-        machine->cpu_model = "604";
-    }
-    cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, machine->cpu_model));
+    cpu = POWERPC_CPU(cpu_create(machine->cpu_type));
     env = &cpu->env;
     if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) {
         error_report("only 6xx bus is supported on this machine");
@@ -894,6 +889,7 @@
     mc->default_ram_size = 128 * M_BYTE;
     mc->block_default_type = IF_SCSI;
     mc->default_boot_order = "c";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("604");
 }
 
 DEFINE_MACHINE("40p", ibm_40p_machine_init)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index ff87f15..d682f01 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -353,8 +353,7 @@
 
         cpus_offset = fdt_path_offset(fdt, "/cpus");
         if (cpus_offset < 0) {
-            cpus_offset = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"),
-                                          "cpus");
+            cpus_offset = fdt_add_subnode(fdt, 0, "cpus");
             if (cpus_offset < 0) {
                 return cpus_offset;
             }
@@ -820,6 +819,13 @@
         return 1;
     }
 
+    if (size < sizeof(hdr) || size > FW_MAX_SIZE) {
+        error_report("SLOF provided an unexpected CAS buffer size "
+                     TARGET_FMT_lu " (min: %zu, max: %u)",
+                     size, sizeof(hdr), FW_MAX_SIZE);
+        exit(EXIT_FAILURE);
+    }
+
     size -= sizeof(hdr);
 
     /* Create skeleton */
@@ -2123,7 +2129,7 @@
 {
     MachineState *machine = MACHINE(spapr);
     MachineClass *mc = MACHINE_GET_CLASS(machine);
-    char *type = spapr_get_cpu_core_type(machine->cpu_model);
+    const char *type = spapr_get_cpu_core_type(machine->cpu_type);
     int smt = kvmppc_smt_threads();
     const CPUArchIdList *possible_cpus;
     int boot_cores_nr = smp_cpus / smp_threads;
@@ -2178,7 +2184,6 @@
             object_property_set_bool(core, true, "realized", &error_fatal);
         }
     }
-    g_free(type);
 }
 
 static void spapr_set_vsmt_mode(sPAPRMachineState *spapr, Error **errp)
@@ -2335,7 +2340,8 @@
     /* Set up Interrupt Controller before we create the VCPUs */
     xics_system_init(machine, XICS_IRQS_SPAPR, &error_fatal);
 
-    /* Set up containers for ibm,client-set-architecture negotiated options */
+    /* Set up containers for ibm,client-architecture-support negotiated options
+     */
     spapr->ov5 = spapr_ovec_new();
     spapr->ov5_cas = spapr_ovec_new();
 
@@ -2362,12 +2368,6 @@
     }
 
     /* init CPUs */
-    if (machine->cpu_model == NULL) {
-        machine->cpu_model = kvm_enabled() ? "host" : smc->tcg_default_cpu;
-    }
-
-    spapr_cpu_parse_features(spapr);
-
     spapr_set_vsmt_mode(spapr, &error_fatal);
 
     spapr_init_cpus(spapr);
@@ -3054,14 +3054,13 @@
         return;
     }
 
-    spapr_pending_dimm_unplugs_remove(spapr, ds);
-
     /*
      * Now that all the LMBs have been removed by the guest, call the
      * pc-dimm unplug handler to cleanup up the pc-dimm device.
      */
     pc_dimm_memory_unplug(dev, &spapr->hotplug_memory, mr);
     object_unparent(OBJECT(dev));
+    spapr_pending_dimm_unplugs_remove(spapr, ds);
 }
 
 static void spapr_memory_unplug_request(HotplugHandler *hotplug_dev,
@@ -3090,6 +3089,19 @@
         goto out;
     }
 
+    /*
+     * An existing pending dimm state for this DIMM means that there is an
+     * unplug operation in progress, waiting for the spapr_lmb_release
+     * callback to complete the job (BQL can't cover that far). In this case,
+     * bail out to avoid detaching DRCs that were already released.
+     */
+    if (spapr_pending_dimm_unplugs_find(spapr, dimm)) {
+        error_setg(&local_err,
+                   "Memory unplug already in progress for device %s",
+                   dev->id);
+        goto out;
+    }
+
     spapr_pending_dimm_unplugs_add(spapr, nr_lmbs, dimm);
 
     addr = addr_start;
@@ -3142,8 +3154,7 @@
     if (smc->pre_2_10_has_unused_icps) {
         sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
         sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(cc));
-        const char *typename = object_class_get_name(scc->cpu_class);
-        size_t size = object_type_get_instance_size(typename);
+        size_t size = object_type_get_instance_size(scc->cpu_type);
         int i;
 
         for (i = 0; i < cc->nr_threads; i++) {
@@ -3239,8 +3250,7 @@
 
     if (smc->pre_2_10_has_unused_icps) {
         sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(cc));
-        const char *typename = object_class_get_name(scc->cpu_class);
-        size_t size = object_type_get_instance_size(typename);
+        size_t size = object_type_get_instance_size(scc->cpu_type);
         int i;
 
         for (i = 0; i < cc->nr_threads; i++) {
@@ -3260,7 +3270,7 @@
     MachineClass *mc = MACHINE_GET_CLASS(hotplug_dev);
     Error *local_err = NULL;
     CPUCore *cc = CPU_CORE(dev);
-    char *base_core_type = spapr_get_cpu_core_type(machine->cpu_model);
+    const char *base_core_type = spapr_get_cpu_core_type(machine->cpu_type);
     const char *type = object_get_typename(OBJECT(dev));
     CPUArchId *core_slot;
     int index;
@@ -3306,7 +3316,6 @@
     numa_cpu_pre_plug(core_slot, dev, &local_err);
 
 out:
-    g_free(base_core_type);
     error_propagate(errp, local_err);
 }
 
@@ -3605,7 +3614,7 @@
     hc->unplug_request = spapr_machine_device_unplug_request;
 
     smc->dr_lmb_enabled = true;
-    smc->tcg_default_cpu = "POWER8";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
     mc->has_hotpluggable_cpus = true;
     smc->resize_hpt_default = SPAPR_RESIZE_HPT_ENABLED;
     fwc->get_dev_path = spapr_get_fw_dev_path;
@@ -3851,7 +3860,7 @@
     sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
 
     spapr_machine_2_8_class_options(mc);
-    smc->tcg_default_cpu = "POWER7";
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power7_v2.3");
     SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_7);
     smc->phb_placement = phb_placement_2_7;
 }
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 3e20b1d..3a4c174 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -21,57 +21,6 @@
 #include "sysemu/hw_accel.h"
 #include "qemu/error-report.h"
 
-void spapr_cpu_parse_features(sPAPRMachineState *spapr)
-{
-    /*
-     * Backwards compatibility hack:
-     *
-     *   CPUs had a "compat=" property which didn't make sense for
-     *   anything except pseries.  It was replaced by "max-cpu-compat"
-     *   machine option.  This supports old command lines like
-     *       -cpu POWER8,compat=power7
-     *   By stripping the compat option and applying it to the machine
-     *   before passing it on to the cpu level parser.
-     */
-    gchar **inpieces;
-    int i, j;
-    gchar *compat_str = NULL;
-
-    inpieces = g_strsplit(MACHINE(spapr)->cpu_model, ",", 0);
-
-    /* inpieces[0] is the actual model string */
-    i = 1;
-    j = 1;
-    while (inpieces[i]) {
-        if (g_str_has_prefix(inpieces[i], "compat=")) {
-            /* in case of multiple compat= options */
-            g_free(compat_str);
-            compat_str = inpieces[i];
-        } else {
-            j++;
-        }
-
-        i++;
-        /* Excise compat options from list */
-        inpieces[j] = inpieces[i];
-    }
-
-    if (compat_str) {
-        char *val = compat_str + strlen("compat=");
-        gchar *newprops = g_strjoinv(",", inpieces);
-
-        object_property_set_str(OBJECT(spapr), val, "max-cpu-compat",
-                                &error_fatal);
-
-        ppc_cpu_parse_features(newprops);
-        g_free(newprops);
-    } else {
-        ppc_cpu_parse_features(MACHINE(spapr)->cpu_model);
-    }
-
-    g_strfreev(inpieces);
-}
-
 static void spapr_cpu_reset(void *opaque)
 {
     PowerPCCPU *cpu = opaque;
@@ -112,37 +61,26 @@
  * Return the sPAPR CPU core type for @model which essentially is the CPU
  * model specified with -cpu cmdline option.
  */
-char *spapr_get_cpu_core_type(const char *model)
+const char *spapr_get_cpu_core_type(const char *cpu_type)
 {
-    char *core_type;
-    gchar **model_pieces = g_strsplit(model, ",", 2);
-    gchar *cpu_model = g_ascii_strdown(model_pieces[0], -1);
-    g_strfreev(model_pieces);
+    int len = strlen(cpu_type) - strlen(POWERPC_CPU_TYPE_SUFFIX);
+    char *core_type = g_strdup_printf(SPAPR_CPU_CORE_TYPE_NAME("%.*s"),
+                                      len, cpu_type);
+    ObjectClass *oc = object_class_by_name(core_type);
 
-    core_type = g_strdup_printf("%s-" TYPE_SPAPR_CPU_CORE, cpu_model);
-
-    /* Check whether it exists or whether we have to look up an alias name */
-    if (!object_class_by_name(core_type)) {
-        const char *realmodel;
-
-        g_free(core_type);
-        core_type = NULL;
-        realmodel = ppc_cpu_lookup_alias(cpu_model);
-        if (realmodel) {
-            core_type = spapr_get_cpu_core_type(realmodel);
-        }
+    g_free(core_type);
+    if (!oc) {
+        return NULL;
     }
-    g_free(cpu_model);
 
-    return core_type;
+    return object_class_get_name(oc);
 }
 
 static void spapr_cpu_core_unrealizefn(DeviceState *dev, Error **errp)
 {
     sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
     sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));
-    const char *typename = object_class_get_name(scc->cpu_class);
-    size_t size = object_type_get_instance_size(typename);
+    size_t size = object_type_get_instance_size(scc->cpu_type);
     CPUCore *cc = CPU_CORE(dev);
     int i;
 
@@ -199,22 +137,26 @@
 
 static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
 {
-    sPAPRMachineState *spapr;
+    /* We don't use SPAPR_MACHINE() in order to exit gracefully if the user
+     * tries to add a sPAPR CPU core to a non-pseries machine.
+     */
+    sPAPRMachineState *spapr =
+        (sPAPRMachineState *) object_dynamic_cast(qdev_get_machine(),
+                                                  TYPE_SPAPR_MACHINE);
     sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
     sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));
     CPUCore *cc = CPU_CORE(OBJECT(dev));
-    const char *typename = object_class_get_name(scc->cpu_class);
-    size_t size = object_type_get_instance_size(typename);
+    size_t size;
     Error *local_err = NULL;
     void *obj;
     int i, j;
 
-    spapr = (sPAPRMachineState *) qdev_get_machine();
-    if (!object_dynamic_cast((Object *) spapr, TYPE_SPAPR_MACHINE)) {
-        error_setg(errp, "spapr-cpu-core needs a pseries machine");
+    if (!spapr) {
+        error_setg(errp, TYPE_SPAPR_CPU_CORE " needs a pseries machine");
         return;
     }
 
+    size = object_type_get_instance_size(scc->cpu_type);
     sc->threads = g_malloc0(size * cc->nr_threads);
     for (i = 0; i < cc->nr_threads; i++) {
         char id[32];
@@ -223,7 +165,7 @@
 
         obj = sc->threads + i * size;
 
-        object_initialize(obj, size, typename);
+        object_initialize(obj, size, scc->cpu_type);
         cs = CPU(obj);
         cpu = POWERPC_CPU(cs);
         cs->cpu_index = cc->core_id + i;
@@ -268,42 +210,12 @@
     error_propagate(errp, local_err);
 }
 
-static const char *spapr_core_models[] = {
-    /* 970 */
-    "970_v2.2",
-
-    /* 970MP variants */
-    "970mp_v1.0",
-    "970mp_v1.1",
-
-    /* POWER5+ */
-    "power5+_v2.1",
-
-    /* POWER7 */
-    "power7_v2.3",
-
-    /* POWER7+ */
-    "power7+_v2.1",
-
-    /* POWER8 */
-    "power8_v2.0",
-
-    /* POWER8E */
-    "power8e_v2.1",
-
-    /* POWER8NVL */
-    "power8nvl_v1.0",
-
-    /* POWER9 */
-    "power9_v1.0",
-};
-
 static Property spapr_cpu_core_properties[] = {
     DEFINE_PROP_INT32("node-id", sPAPRCPUCore, node_id, CPU_UNSET_NUMA_NODE_ID),
     DEFINE_PROP_END_OF_LIST()
 };
 
-void spapr_cpu_core_class_init(ObjectClass *oc, void *data)
+static void spapr_cpu_core_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
     sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_CLASS(oc);
@@ -311,37 +223,39 @@
     dc->realize = spapr_cpu_core_realize;
     dc->unrealize = spapr_cpu_core_unrealizefn;
     dc->props = spapr_cpu_core_properties;
-    scc->cpu_class = cpu_class_by_name(TYPE_POWERPC_CPU, data);
-    g_assert(scc->cpu_class);
+    scc->cpu_type = data;
 }
 
-static const TypeInfo spapr_cpu_core_type_info = {
-    .name = TYPE_SPAPR_CPU_CORE,
-    .parent = TYPE_CPU_CORE,
-    .abstract = true,
-    .instance_size = sizeof(sPAPRCPUCore),
-    .class_size = sizeof(sPAPRCPUCoreClass),
+#define DEFINE_SPAPR_CPU_CORE_TYPE(cpu_model) \
+    {                                                   \
+        .parent = TYPE_SPAPR_CPU_CORE,                  \
+        .class_data = (void *) POWERPC_CPU_TYPE_NAME(cpu_model), \
+        .class_init = spapr_cpu_core_class_init,        \
+        .name = SPAPR_CPU_CORE_TYPE_NAME(cpu_model),    \
+    }
+
+static const TypeInfo spapr_cpu_core_type_infos[] = {
+    {
+        .name = TYPE_SPAPR_CPU_CORE,
+        .parent = TYPE_CPU_CORE,
+        .abstract = true,
+        .instance_size = sizeof(sPAPRCPUCore),
+        .class_size = sizeof(sPAPRCPUCoreClass),
+    },
+    DEFINE_SPAPR_CPU_CORE_TYPE("970_v2.2"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.0"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("970mp_v1.1"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power5+_v2.1"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power7_v2.3"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power7+_v2.1"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power8_v2.0"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power8e_v2.1"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power8nvl_v1.0"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power9_v1.0"),
+    DEFINE_SPAPR_CPU_CORE_TYPE("power9_v2.0"),
+#ifdef CONFIG_KVM
+    DEFINE_SPAPR_CPU_CORE_TYPE("host"),
+#endif
 };
 
-static void spapr_cpu_core_register_types(void)
-{
-    int i;
-
-    type_register_static(&spapr_cpu_core_type_info);
-
-    for (i = 0; i < ARRAY_SIZE(spapr_core_models); i++) {
-        TypeInfo type_info = {
-            .parent = TYPE_SPAPR_CPU_CORE,
-            .instance_size = sizeof(sPAPRCPUCore),
-            .class_init = spapr_cpu_core_class_init,
-            .class_data = (void *) spapr_core_models[i],
-        };
-
-        type_info.name = g_strdup_printf("%s-" TYPE_SPAPR_CPU_CORE,
-                                         spapr_core_models[i]);
-        type_register(&type_info);
-        g_free((void *)type_info.name);
-    }
-}
-
-type_init(spapr_cpu_core_register_types)
+DEFINE_TYPES(spapr_cpu_core_type_infos)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 8d72bb7..0d59d15 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -472,7 +472,7 @@
     target_ulong flags = args[0];
     int shift = args[1];
     sPAPRPendingHPT *pending = spapr->pending_hpt;
-    uint64_t current_ram_size = MACHINE(spapr)->ram_size;
+    uint64_t current_ram_size;
     int rc;
 
     if (spapr->resize_hpt == SPAPR_RESIZE_HPT_DISABLED) {
@@ -494,7 +494,7 @@
         return H_PARAMETER;
     }
 
-    current_ram_size = pc_existing_dimms_capacity(&error_fatal);
+    current_ram_size = MACHINE(spapr)->ram_size + get_plugged_memory_size();
 
     /* We only allow the guest to allocate an HPT one order above what
      * we'd normally give them (to stop a small guest claiming a huge
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 5049ced..5a3122a 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -1507,7 +1507,12 @@
 
 static void spapr_phb_realize(DeviceState *dev, Error **errp)
 {
-    sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
+    /* We don't use SPAPR_MACHINE() in order to exit gracefully if the user
+     * tries to add a sPAPR PHB to a non-pseries machine.
+     */
+    sPAPRMachineState *spapr =
+        (sPAPRMachineState *) object_dynamic_cast(qdev_get_machine(),
+                                                  TYPE_SPAPR_MACHINE);
     SysBusDevice *s = SYS_BUS_DEVICE(dev);
     sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
     PCIHostState *phb = PCI_HOST_BRIDGE(s);
@@ -1519,6 +1524,11 @@
     const unsigned windows_supported =
         sphb->ddw_enabled ? SPAPR_PCI_DMA_MAX_WINDOWS : 1;
 
+    if (!spapr) {
+        error_setg(errp, TYPE_SPAPR_PCI_HOST_BRIDGE " needs a pseries machine");
+        return;
+    }
+
     if (sphb->index != (uint32_t)-1) {
         sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
         Error *local_err = NULL;
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index ed9b406..5ac4f76 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -89,14 +89,14 @@
 
 static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size,
                                       int do_init,
-                                      const char *cpu_model,
+                                      const char *cpu_type,
                                       uint32_t sysclk)
 {
     PowerPCCPU *cpu;
     CPUPPCState *env;
     qemu_irq *irqs;
 
-    cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model));
+    cpu = POWERPC_CPU(cpu_create(cpu_type));
     env = &cpu->env;
 
     ppc_booke_timers_init(cpu, sysclk, 0/* no flags */);
@@ -211,11 +211,7 @@
     int i;
 
     /* init CPUs */
-    if (machine->cpu_model == NULL) {
-        machine->cpu_model = "440-Xilinx";
-    }
-
-    cpu = ppc440_init_xilinx(&ram_size, 1, machine->cpu_model, 400000000);
+    cpu = ppc440_init_xilinx(&ram_size, 1, machine->cpu_type, 400000000);
     env = &cpu->env;
 
     if (env->mmu_model != POWERPC_MMU_BOOKE) {
@@ -307,6 +303,7 @@
 {
     mc->desc = "Xilinx Virtex ML507 reference design";
     mc->init = virtex_init;
+    mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440-xilinx");
 }
 
 DEFINE_MACHINE("virtex-ml507", virtex_machine_init)
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index e295d88..419fc66 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -398,6 +398,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIESPState),
     .class_init = esp_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 typedef struct {
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index a67ee07..191505d 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2246,6 +2246,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(LSIState),
     .class_init    = lsi_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void lsi53c810_class_init(ObjectClass *klass, void *data)
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 0db68aa..d5eae62 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -2451,6 +2451,7 @@
     int osts;
     const VMStateDescription *vmsd;
     Property *props;
+    InterfaceInfo *interfaces;
 } MegasasInfo;
 
 static struct MegasasInfo megasas_devices[] = {
@@ -2467,6 +2468,10 @@
         .is_express = false,
         .vmsd = &vmstate_megasas_gen1,
         .props = megasas_properties_gen1,
+        .interfaces = (InterfaceInfo[]) {
+            { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+            { },
+        },
     },{
         .name = TYPE_MEGASAS_GEN2,
         .desc = "LSI MegaRAID SAS 2108",
@@ -2480,6 +2485,10 @@
         .is_express = true,
         .vmsd = &vmstate_megasas_gen2,
         .props = megasas_properties_gen2,
+        .interfaces = (InterfaceInfo[]) {
+            { INTERFACE_PCIE_DEVICE },
+            { }
+        },
     }
 };
 
@@ -2531,6 +2540,7 @@
         type_info.parent = TYPE_MEGASAS_BASE;
         type_info.class_data = (void *)info;
         type_info.class_init = megasas_class_init;
+        type_info.interfaces = info->interfaces;
 
         type_register(&type_info);
     }
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index d05fa9f..f6db1b0 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1439,6 +1439,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(MPTSASState),
     .class_init = mptsas1068_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void mptsas_register_types(void)
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index d807915..d564e5c 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1302,6 +1302,8 @@
     .class_init    = pvscsi_class_init,
     .interfaces = (InterfaceInfo[]) {
         { TYPE_HOTPLUG_HANDLER },
+        { INTERFACE_PCIE_DEVICE },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
         { }
     }
 };
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 6d6a791..b064a08 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1315,6 +1315,10 @@
     .parent = TYPE_PCI_DEVICE,
     .instance_size = sizeof(SDHCIState),
     .class_init = sdhci_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static Property sdhci_sysbus_properties[] = {
diff --git a/hw/sh4/sh_pci.c b/hw/sh4/sh_pci.c
index 38395c0..cbb01af 100644
--- a/hw/sh4/sh_pci.c
+++ b/hw/sh4/sh_pci.c
@@ -179,6 +179,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
     .class_init    = sh_pci_host_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void sh_pci_device_class_init(ObjectClass *klass, void *data)
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index c3280aa..8282651 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -275,6 +275,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(EbusState),
     .class_init    = ebus_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 #define TYPE_OPENPROM "openprom"
diff --git a/hw/tpm/Makefile.objs b/hw/tpm/Makefile.objs
index 64cecc3..41f0b7a 100644
--- a/hw/tpm/Makefile.objs
+++ b/hw/tpm/Makefile.objs
@@ -1,2 +1,3 @@
 common-obj-$(CONFIG_TPM_TIS) += tpm_tis.o
 common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o tpm_util.o
+common-obj-$(CONFIG_TPM_EMULATOR) += tpm_emulator.o tpm_util.o
diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
new file mode 100644
index 0000000..95e1e04
--- /dev/null
+++ b/hw/tpm/tpm_emulator.c
@@ -0,0 +1,587 @@
+/*
+ *  Emulator TPM driver
+ *
+ *  Copyright (c) 2017 Intel Corporation
+ *  Author: Amarnath Valluri <amarnath.valluri@intel.com>
+ *
+ *  Copyright (c) 2010 - 2013 IBM Corporation
+ *  Authors:
+ *    Stefan Berger <stefanb@us.ibm.com>
+ *
+ *  Copyright (C) 2011 IAIK, Graz University of Technology
+ *    Author: Andreas Niederl
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "qemu/sockets.h"
+#include "io/channel-socket.h"
+#include "sysemu/tpm_backend.h"
+#include "tpm_int.h"
+#include "hw/hw.h"
+#include "hw/i386/pc.h"
+#include "tpm_util.h"
+#include "tpm_ioctl.h"
+#include "migration/blocker.h"
+#include "qapi/error.h"
+#include "qapi/clone-visitor.h"
+#include "chardev/char-fe.h"
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdio.h>
+
+#define DEBUG_TPM 0
+
+#define DPRINTF(fmt, ...) do { \
+    if (DEBUG_TPM) { \
+        fprintf(stderr, "tpm-emulator:"fmt"\n", ## __VA_ARGS__); \
+    } \
+} while (0)
+
+#define TYPE_TPM_EMULATOR "tpm-emulator"
+#define TPM_EMULATOR(obj) \
+    OBJECT_CHECK(TPMEmulator, (obj), TYPE_TPM_EMULATOR)
+
+#define TPM_EMULATOR_IMPLEMENTS_ALL_CAPS(S, cap) (((S)->caps & (cap)) == (cap))
+
+static const TPMDriverOps tpm_emulator_driver;
+
+/* data structures */
+typedef struct TPMEmulator {
+    TPMBackend parent;
+
+    TPMEmulatorOptions *options;
+    CharBackend ctrl_chr;
+    QIOChannel *data_ioc;
+    TPMVersion tpm_version;
+    ptm_cap caps; /* capabilities of the TPM */
+    uint8_t cur_locty_number; /* last set locality */
+    Error *migration_blocker;
+} TPMEmulator;
+
+
+static int tpm_emulator_ctrlcmd(CharBackend *dev, unsigned long cmd, void *msg,
+                                size_t msg_len_in, size_t msg_len_out)
+{
+    uint32_t cmd_no = cpu_to_be32(cmd);
+    ssize_t n = sizeof(uint32_t) + msg_len_in;
+    uint8_t *buf = NULL;
+
+    buf = g_alloca(n);
+    memcpy(buf, &cmd_no, sizeof(cmd_no));
+    memcpy(buf + sizeof(cmd_no), msg, msg_len_in);
+
+    n = qemu_chr_fe_write_all(dev, buf, n);
+    if (n <= 0) {
+        return -1;
+    }
+
+    if (msg_len_out != 0) {
+        n = qemu_chr_fe_read_all(dev, msg, msg_len_out);
+        if (n <= 0) {
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+static int tpm_emulator_unix_tx_bufs(TPMEmulator *tpm_emu,
+                                     const uint8_t *in, uint32_t in_len,
+                                     uint8_t *out, uint32_t out_len,
+                                     bool *selftest_done,
+                                     Error **err)
+{
+    ssize_t ret;
+    bool is_selftest = false;
+    const struct tpm_resp_hdr *hdr = NULL;
+
+    if (selftest_done) {
+        *selftest_done = false;
+        is_selftest = tpm_util_is_selftest(in, in_len);
+    }
+
+    ret = qio_channel_write_all(tpm_emu->data_ioc, (char *)in, in_len, err);
+    if (ret != 0) {
+        return -1;
+    }
+
+    ret = qio_channel_read_all(tpm_emu->data_ioc, (char *)out, sizeof(*hdr),
+                               err);
+    if (ret != 0) {
+        return -1;
+    }
+
+    hdr = (struct tpm_resp_hdr *)out;
+    out += sizeof(*hdr);
+    ret = qio_channel_read_all(tpm_emu->data_ioc, (char *)out,
+                               be32_to_cpu(hdr->len) - sizeof(*hdr) , err);
+    if (ret != 0) {
+        return -1;
+    }
+
+    if (is_selftest) {
+        *selftest_done = (be32_to_cpu(hdr->errcode) == 0);
+    }
+
+    return 0;
+}
+
+static int tpm_emulator_set_locality(TPMEmulator *tpm_emu, uint8_t locty_number)
+{
+    ptm_loc loc;
+
+    DPRINTF("%s : locality: 0x%x", __func__, locty_number);
+
+    if (tpm_emu->cur_locty_number == locty_number) {
+        return 0;
+    }
+
+    DPRINTF("setting locality : 0x%x", locty_number);
+    loc.u.req.loc = locty_number;
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_SET_LOCALITY, &loc,
+                             sizeof(loc), sizeof(loc)) < 0) {
+        error_report("tpm-emulator: could not set locality : %s",
+                     strerror(errno));
+        return -1;
+    }
+
+    loc.u.resp.tpm_result = be32_to_cpu(loc.u.resp.tpm_result);
+    if (loc.u.resp.tpm_result != 0) {
+        error_report("tpm-emulator: TPM result for set locality : 0x%x",
+                     loc.u.resp.tpm_result);
+        return -1;
+    }
+
+    tpm_emu->cur_locty_number = locty_number;
+
+    return 0;
+}
+
+static void tpm_emulator_handle_request(TPMBackend *tb, TPMBackendCmd cmd)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
+    TPMLocality *locty = NULL;
+    bool selftest_done = false;
+    Error *err = NULL;
+
+    DPRINTF("processing command type %d", cmd);
+
+    switch (cmd) {
+    case TPM_BACKEND_CMD_PROCESS_CMD:
+        locty = tb->tpm_state->locty_data;
+        if (tpm_emulator_set_locality(tpm_emu,
+                                      tb->tpm_state->locty_number) < 0 ||
+            tpm_emulator_unix_tx_bufs(tpm_emu, locty->w_buffer.buffer,
+                                      locty->w_offset, locty->r_buffer.buffer,
+                                      locty->r_buffer.size, &selftest_done,
+                                      &err) < 0) {
+            tpm_util_write_fatal_error_response(locty->r_buffer.buffer,
+                                                locty->r_buffer.size);
+            error_report_err(err);
+        }
+
+        tb->recv_data_callback(tb->tpm_state, tb->tpm_state->locty_number,
+                               selftest_done);
+
+        break;
+    case TPM_BACKEND_CMD_INIT:
+    case TPM_BACKEND_CMD_END:
+    case TPM_BACKEND_CMD_TPM_RESET:
+        /* nothing to do */
+        break;
+    }
+}
+
+static int tpm_emulator_probe_caps(TPMEmulator *tpm_emu)
+{
+    DPRINTF("%s", __func__);
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_GET_CAPABILITY,
+                         &tpm_emu->caps, 0, sizeof(tpm_emu->caps)) < 0) {
+        error_report("tpm-emulator: probing failed : %s", strerror(errno));
+        return -1;
+    }
+
+    tpm_emu->caps = be64_to_cpu(tpm_emu->caps);
+
+    DPRINTF("capabilities : 0x%"PRIx64, tpm_emu->caps);
+
+    return 0;
+}
+
+static int tpm_emulator_check_caps(TPMEmulator *tpm_emu)
+{
+    ptm_cap caps = 0;
+    const char *tpm = NULL;
+
+    /* check for min. required capabilities */
+    switch (tpm_emu->tpm_version) {
+    case TPM_VERSION_1_2:
+        caps = PTM_CAP_INIT | PTM_CAP_SHUTDOWN | PTM_CAP_GET_TPMESTABLISHED |
+               PTM_CAP_SET_LOCALITY | PTM_CAP_SET_DATAFD;
+        tpm = "1.2";
+        break;
+    case TPM_VERSION_2_0:
+        caps = PTM_CAP_INIT | PTM_CAP_SHUTDOWN | PTM_CAP_GET_TPMESTABLISHED |
+               PTM_CAP_SET_LOCALITY | PTM_CAP_RESET_TPMESTABLISHED |
+               PTM_CAP_SET_DATAFD;
+        tpm = "2";
+        break;
+    case TPM_VERSION_UNSPEC:
+        error_report("tpm-emulator: TPM version has not been set");
+        return -1;
+    }
+
+    if (!TPM_EMULATOR_IMPLEMENTS_ALL_CAPS(tpm_emu, caps)) {
+        error_report("tpm-emulator: TPM does not implement minimum set of "
+                     "required capabilities for TPM %s (0x%x)", tpm, (int)caps);
+        return -1;
+    }
+
+    return 0;
+}
+
+static int tpm_emulator_startup_tpm(TPMBackend *tb)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
+    ptm_init init;
+    ptm_res res;
+
+    DPRINTF("%s", __func__);
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_INIT, &init, sizeof(init),
+                         sizeof(init)) < 0) {
+        error_report("tpm-emulator: could not send INIT: %s",
+                     strerror(errno));
+        goto err_exit;
+    }
+
+    res = be32_to_cpu(init.u.resp.tpm_result);
+    if (res) {
+        error_report("tpm-emulator: TPM result for CMD_INIT: 0x%x", res);
+        goto err_exit;
+    }
+    return 0;
+
+err_exit:
+    return -1;
+}
+
+static bool tpm_emulator_get_tpm_established_flag(TPMBackend *tb)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
+    ptm_est est;
+
+    DPRINTF("%s", __func__);
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_GET_TPMESTABLISHED, &est,
+                             0, sizeof(est)) < 0) {
+        error_report("tpm-emulator: Could not get the TPM established flag: %s",
+                     strerror(errno));
+        return false;
+    }
+    DPRINTF("established flag: %0x", est.u.resp.bit);
+
+    return (est.u.resp.bit != 0);
+}
+
+static int tpm_emulator_reset_tpm_established_flag(TPMBackend *tb,
+                                                   uint8_t locty)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
+    ptm_reset_est reset_est;
+    ptm_res res;
+
+    /* only a TPM 2.0 will support this */
+    if (tpm_emu->tpm_version != TPM_VERSION_2_0) {
+        return 0;
+    }
+
+    reset_est.u.req.loc = tpm_emu->cur_locty_number;
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_RESET_TPMESTABLISHED,
+                             &reset_est, sizeof(reset_est),
+                             sizeof(reset_est)) < 0) {
+        error_report("tpm-emulator: Could not reset the establishment bit: %s",
+                     strerror(errno));
+        return -1;
+    }
+
+    res = be32_to_cpu(reset_est.u.resp.tpm_result);
+    if (res) {
+        error_report("tpm-emulator: TPM result for rest establixhed flag: 0x%x",
+                     res);
+        return -1;
+    }
+
+    return 0;
+}
+
+static void tpm_emulator_cancel_cmd(TPMBackend *tb)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
+    ptm_res res;
+
+    if (!TPM_EMULATOR_IMPLEMENTS_ALL_CAPS(tpm_emu, PTM_CAP_CANCEL_TPM_CMD)) {
+        DPRINTF("Backend does not support CANCEL_TPM_CMD");
+        return;
+    }
+
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_CANCEL_TPM_CMD, &res, 0,
+                             sizeof(res)) < 0) {
+        error_report("tpm-emulator: Could not cancel command: %s",
+                     strerror(errno));
+    } else if (res != 0) {
+        error_report("tpm-emulator: Failed to cancel TPM: 0x%x",
+                     be32_to_cpu(res));
+    }
+}
+
+static TPMVersion tpm_emulator_get_tpm_version(TPMBackend *tb)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
+
+    return tpm_emu->tpm_version;
+}
+
+static int tpm_emulator_block_migration(TPMEmulator *tpm_emu)
+{
+    Error *err = NULL;
+
+    error_setg(&tpm_emu->migration_blocker,
+               "Migration disabled: TPM emulator not yet migratable");
+    migrate_add_blocker(tpm_emu->migration_blocker, &err);
+    if (err) {
+        error_report_err(err);
+        error_free(tpm_emu->migration_blocker);
+        tpm_emu->migration_blocker = NULL;
+
+        return -1;
+    }
+
+    return 0;
+}
+
+static int tpm_emulator_prepare_data_fd(TPMEmulator *tpm_emu)
+{
+    ptm_res res;
+    Error *err = NULL;
+    int fds[2] = { -1, -1 };
+
+    if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
+        error_report("tpm-emulator: Failed to create socketpair");
+        return -1;
+    }
+
+    qemu_chr_fe_set_msgfds(&tpm_emu->ctrl_chr, fds + 1, 1);
+
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_SET_DATAFD, &res, 0,
+                    sizeof(res)) || res != 0) {
+        error_report("tpm-emulator: Failed to send CMD_SET_DATAFD: %s",
+                     strerror(errno));
+        goto err_exit;
+    }
+
+    tpm_emu->data_ioc = QIO_CHANNEL(qio_channel_socket_new_fd(fds[0], &err));
+    if (err) {
+        error_prepend(&err, "tpm-emulator: Failed to create io channel: ");
+        error_report_err(err);
+        goto err_exit;
+    }
+
+    closesocket(fds[1]);
+
+    return 0;
+
+err_exit:
+    closesocket(fds[0]);
+    closesocket(fds[1]);
+    return -1;
+}
+
+static int tpm_emulator_handle_device_opts(TPMEmulator *tpm_emu, QemuOpts *opts)
+{
+    const char *value;
+
+    value = qemu_opt_get(opts, "chardev");
+    if (value) {
+        Error *err = NULL;
+        Chardev *dev = qemu_chr_find(value);
+
+        if (!dev) {
+            error_report("tpm-emulator: tpm chardev '%s' not found.", value);
+            goto err;
+        }
+
+        if (!qemu_chr_fe_init(&tpm_emu->ctrl_chr, dev, &err)) {
+            error_prepend(&err, "tpm-emulator: No valid chardev found at '%s':",
+                          value);
+            error_report_err(err);
+            goto err;
+        }
+
+        tpm_emu->options->chardev = g_strdup(value);
+    }
+
+    if (tpm_emulator_prepare_data_fd(tpm_emu) < 0) {
+        goto err;
+    }
+
+    /* FIXME: tpm_util_test_tpmdev() accepts only on socket fd, as it also used
+     * by passthrough driver, which not yet using GIOChannel.
+     */
+    if (tpm_util_test_tpmdev(QIO_CHANNEL_SOCKET(tpm_emu->data_ioc)->fd,
+                             &tpm_emu->tpm_version)) {
+        error_report("'%s' is not emulating TPM device. Error: %s",
+                      tpm_emu->options->chardev, strerror(errno));
+        goto err;
+    }
+
+    DPRINTF("TPM Version %s", tpm_emu->tpm_version == TPM_VERSION_1_2 ? "1.2" :
+            (tpm_emu->tpm_version == TPM_VERSION_2_0 ?  "2.0" : "Unspecified"));
+
+    if (tpm_emulator_probe_caps(tpm_emu) ||
+        tpm_emulator_check_caps(tpm_emu)) {
+        goto err;
+    }
+
+    return tpm_emulator_block_migration(tpm_emu);
+
+err:
+    DPRINTF("Startup error");
+    return -1;
+}
+
+static TPMBackend *tpm_emulator_create(QemuOpts *opts, const char *id)
+{
+    TPMBackend *tb = TPM_BACKEND(object_new(TYPE_TPM_EMULATOR));
+
+    tb->id = g_strdup(id);
+
+    if (tpm_emulator_handle_device_opts(TPM_EMULATOR(tb), opts)) {
+        goto err_exit;
+    }
+
+    return tb;
+
+err_exit:
+    object_unref(OBJECT(tb));
+
+    return NULL;
+}
+
+static TpmTypeOptions *tpm_emulator_get_tpm_options(TPMBackend *tb)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(tb);
+    TpmTypeOptions *options = g_new0(TpmTypeOptions, 1);
+
+    options->type = TPM_TYPE_OPTIONS_KIND_EMULATOR;
+    options->u.emulator.data = QAPI_CLONE(TPMEmulatorOptions, tpm_emu->options);
+
+    return options;
+}
+
+static const QemuOptDesc tpm_emulator_cmdline_opts[] = {
+    TPM_STANDARD_CMDLINE_OPTS,
+    {
+        .name = "chardev",
+        .type = QEMU_OPT_STRING,
+        .help = "Character device to use for out-of-band control messages",
+    },
+    { /* end of list */ },
+};
+
+static const TPMDriverOps tpm_emulator_driver = {
+    .type                     = TPM_TYPE_EMULATOR,
+    .opts                     = tpm_emulator_cmdline_opts,
+    .desc                     = "TPM emulator backend driver",
+
+    .create                   = tpm_emulator_create,
+    .startup_tpm              = tpm_emulator_startup_tpm,
+    .cancel_cmd               = tpm_emulator_cancel_cmd,
+    .get_tpm_established_flag = tpm_emulator_get_tpm_established_flag,
+    .reset_tpm_established_flag = tpm_emulator_reset_tpm_established_flag,
+    .get_tpm_version          = tpm_emulator_get_tpm_version,
+    .get_tpm_options          = tpm_emulator_get_tpm_options,
+};
+
+static void tpm_emulator_inst_init(Object *obj)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(obj);
+
+    DPRINTF("%s", __func__);
+    tpm_emu->options = g_new0(TPMEmulatorOptions, 1);
+    tpm_emu->cur_locty_number = ~0;
+}
+
+/*
+ * Gracefully shut down the external TPM
+ */
+static void tpm_emulator_shutdown(TPMEmulator *tpm_emu)
+{
+    ptm_res res;
+
+    if (tpm_emulator_ctrlcmd(&tpm_emu->ctrl_chr, CMD_SHUTDOWN, &res, 0,
+                             sizeof(res)) < 0) {
+        error_report("tpm-emulator: Could not cleanly shutdown the TPM: %s",
+                     strerror(errno));
+    } else if (res != 0) {
+        error_report("tpm-emulator: TPM result for sutdown: 0x%x",
+                     be32_to_cpu(res));
+    }
+}
+
+static void tpm_emulator_inst_finalize(Object *obj)
+{
+    TPMEmulator *tpm_emu = TPM_EMULATOR(obj);
+
+    tpm_emulator_shutdown(tpm_emu);
+
+    object_unref(OBJECT(tpm_emu->data_ioc));
+
+    qemu_chr_fe_deinit(&tpm_emu->ctrl_chr, false);
+
+    qapi_free_TPMEmulatorOptions(tpm_emu->options);
+
+    if (tpm_emu->migration_blocker) {
+        migrate_del_blocker(tpm_emu->migration_blocker);
+        error_free(tpm_emu->migration_blocker);
+    }
+}
+
+static void tpm_emulator_class_init(ObjectClass *klass, void *data)
+{
+    TPMBackendClass *tbc = TPM_BACKEND_CLASS(klass);
+    tbc->ops = &tpm_emulator_driver;
+    tbc->handle_request = tpm_emulator_handle_request;
+}
+
+static const TypeInfo tpm_emulator_info = {
+    .name = TYPE_TPM_EMULATOR,
+    .parent = TYPE_TPM_BACKEND,
+    .instance_size = sizeof(TPMEmulator),
+    .class_init = tpm_emulator_class_init,
+    .instance_init = tpm_emulator_inst_init,
+    .instance_finalize = tpm_emulator_inst_finalize,
+};
+
+static void tpm_emulator_register(void)
+{
+    type_register_static(&tpm_emulator_info);
+    tpm_register_driver(&tpm_emulator_driver);
+}
+
+type_init(tpm_emulator_register)
diff --git a/hw/tpm/tpm_ioctl.h b/hw/tpm/tpm_ioctl.h
new file mode 100644
index 0000000..33564b1
--- /dev/null
+++ b/hw/tpm/tpm_ioctl.h
@@ -0,0 +1,246 @@
+/*
+ * tpm_ioctl.h
+ *
+ * (c) Copyright IBM Corporation 2014, 2015.
+ *
+ * This file is licensed under the terms of the 3-clause BSD license
+ */
+#ifndef _TPM_IOCTL_H_
+#define _TPM_IOCTL_H_
+
+#include <stdint.h>
+#include <sys/uio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+
+/*
+ * Every response from a command involving a TPM command execution must hold
+ * the ptm_res as the first element.
+ * ptm_res corresponds to the error code of a command executed by the TPM.
+ */
+
+typedef uint32_t ptm_res;
+
+/* PTM_GET_TPMESTABLISHED: get the establishment bit */
+struct ptm_est {
+    union {
+        struct {
+            ptm_res tpm_result;
+            unsigned char bit; /* TPM established bit */
+        } resp; /* response */
+    } u;
+};
+
+/* PTM_RESET_TPMESTABLISHED: reset establishment bit */
+struct ptm_reset_est {
+    union {
+        struct {
+            uint8_t loc; /* locality to use */
+        } req; /* request */
+        struct {
+            ptm_res tpm_result;
+        } resp; /* response */
+    } u;
+};
+
+/* PTM_INIT */
+struct ptm_init {
+    union {
+        struct {
+            uint32_t init_flags; /* see definitions below */
+        } req; /* request */
+        struct {
+            ptm_res tpm_result;
+        } resp; /* response */
+    } u;
+};
+
+/* above init_flags */
+#define PTM_INIT_FLAG_DELETE_VOLATILE (1 << 0)
+    /* delete volatile state file after reading it */
+
+/* PTM_SET_LOCALITY */
+struct ptm_loc {
+    union {
+        struct {
+            uint8_t loc; /* locality to set */
+        } req; /* request */
+        struct {
+            ptm_res tpm_result;
+        } resp; /* response */
+    } u;
+};
+
+/* PTM_HASH_DATA: hash given data */
+struct ptm_hdata {
+    union {
+        struct {
+            uint32_t length;
+            uint8_t data[4096];
+        } req; /* request */
+        struct {
+            ptm_res tpm_result;
+        } resp; /* response */
+    } u;
+};
+
+/*
+ * size of the TPM state blob to transfer; x86_64 can handle 8k,
+ * ppc64le only ~7k; keep the response below a 4k page size
+ */
+#define PTM_STATE_BLOB_SIZE (3 * 1024)
+
+/*
+ * The following is the data structure to get state blobs from the TPM.
+ * If the size of the state blob exceeds the PTM_STATE_BLOB_SIZE, multiple reads
+ * with this ioctl and with adjusted offset are necessary. All bytes
+ * must be transferred and the transfer is done once the last byte has been
+ * returned.
+ * It is possible to use the read() interface for reading the data; however, the
+ * first bytes of the state blob will be part of the response to the ioctl(); a
+ * subsequent read() is only necessary if the total length (totlength) exceeds
+ * the number of received bytes. seek() is not supported.
+ */
+struct ptm_getstate {
+    union {
+        struct {
+            uint32_t state_flags; /* may be: PTM_STATE_FLAG_DECRYPTED */
+            uint32_t type;        /* which blob to pull */
+            uint32_t offset;      /* offset from where to read */
+        } req; /* request */
+        struct {
+            ptm_res tpm_result;
+            uint32_t state_flags; /* may be: PTM_STATE_FLAG_ENCRYPTED */
+            uint32_t totlength;   /* total length that will be transferred */
+            uint32_t length;      /* number of bytes in following buffer */
+            uint8_t  data[PTM_STATE_BLOB_SIZE];
+        } resp; /* response */
+    } u;
+};
+
+/* TPM state blob types */
+#define PTM_BLOB_TYPE_PERMANENT  1
+#define PTM_BLOB_TYPE_VOLATILE   2
+#define PTM_BLOB_TYPE_SAVESTATE  3
+
+/* state_flags above : */
+#define PTM_STATE_FLAG_DECRYPTED     1 /* on input:  get decrypted state */
+#define PTM_STATE_FLAG_ENCRYPTED     2 /* on output: state is encrypted */
+
+/*
+ * The following is the data structure to set state blobs in the TPM.
+ * If the size of the state blob exceeds the PTM_STATE_BLOB_SIZE, multiple
+ * 'writes' using this ioctl are necessary. The last packet is indicated
+ * by the length being smaller than the PTM_STATE_BLOB_SIZE.
+ * The very first packet may have a length indicator of '0' enabling
+ * a write() with all the bytes from a buffer. If the write() interface
+ * is used, a final ioctl with a non-full buffer must be made to indicate
+ * that all data were transferred (a write with 0 bytes would not work).
+ */
+struct ptm_setstate {
+    union {
+        struct {
+            uint32_t state_flags; /* may be PTM_STATE_FLAG_ENCRYPTED */
+            uint32_t type;        /* which blob to set */
+            uint32_t length;      /* length of the data;
+                                     use 0 on the first packet to
+                                     transfer using write() */
+            uint8_t data[PTM_STATE_BLOB_SIZE];
+        } req; /* request */
+        struct {
+            ptm_res tpm_result;
+        } resp; /* response */
+    } u;
+};
+
+/*
+ * PTM_GET_CONFIG: Data structure to get runtime configuration information
+ * such as which keys are applied.
+ */
+struct ptm_getconfig {
+    union {
+        struct {
+            ptm_res tpm_result;
+            uint32_t flags;
+        } resp; /* response */
+    } u;
+};
+
+#define PTM_CONFIG_FLAG_FILE_KEY        0x1
+#define PTM_CONFIG_FLAG_MIGRATION_KEY   0x2
+
+
+typedef uint64_t ptm_cap;
+typedef struct ptm_est ptm_est;
+typedef struct ptm_reset_est ptm_reset_est;
+typedef struct ptm_loc ptm_loc;
+typedef struct ptm_hdata ptm_hdata;
+typedef struct ptm_init ptm_init;
+typedef struct ptm_getstate ptm_getstate;
+typedef struct ptm_setstate ptm_setstate;
+typedef struct ptm_getconfig ptm_getconfig;
+
+/* capability flags returned by PTM_GET_CAPABILITY */
+#define PTM_CAP_INIT               (1)
+#define PTM_CAP_SHUTDOWN           (1 << 1)
+#define PTM_CAP_GET_TPMESTABLISHED (1 << 2)
+#define PTM_CAP_SET_LOCALITY       (1 << 3)
+#define PTM_CAP_HASHING            (1 << 4)
+#define PTM_CAP_CANCEL_TPM_CMD     (1 << 5)
+#define PTM_CAP_STORE_VOLATILE     (1 << 6)
+#define PTM_CAP_RESET_TPMESTABLISHED (1 << 7)
+#define PTM_CAP_GET_STATEBLOB      (1 << 8)
+#define PTM_CAP_SET_STATEBLOB      (1 << 9)
+#define PTM_CAP_STOP               (1 << 10)
+#define PTM_CAP_GET_CONFIG         (1 << 11)
+#define PTM_CAP_SET_DATAFD         (1 << 12)
+
+enum {
+    PTM_GET_CAPABILITY     = _IOR('P', 0, ptm_cap),
+    PTM_INIT               = _IOWR('P', 1, ptm_init),
+    PTM_SHUTDOWN           = _IOR('P', 2, ptm_res),
+    PTM_GET_TPMESTABLISHED = _IOR('P', 3, ptm_est),
+    PTM_SET_LOCALITY       = _IOWR('P', 4, ptm_loc),
+    PTM_HASH_START         = _IOR('P', 5, ptm_res),
+    PTM_HASH_DATA          = _IOWR('P', 6, ptm_hdata),
+    PTM_HASH_END           = _IOR('P', 7, ptm_res),
+    PTM_CANCEL_TPM_CMD     = _IOR('P', 8, ptm_res),
+    PTM_STORE_VOLATILE     = _IOR('P', 9, ptm_res),
+    PTM_RESET_TPMESTABLISHED = _IOWR('P', 10, ptm_reset_est),
+    PTM_GET_STATEBLOB      = _IOWR('P', 11, ptm_getstate),
+    PTM_SET_STATEBLOB      = _IOWR('P', 12, ptm_setstate),
+    PTM_STOP               = _IOR('P', 13, ptm_res),
+    PTM_GET_CONFIG         = _IOR('P', 14, ptm_getconfig),
+    PTM_SET_DATAFD         = _IOR('P', 15, ptm_res),
+};
+
+/*
+ * Commands used by the non-CUSE TPMs
+ *
+ * All messages container big-endian data.
+ *
+ * The return messages only contain the 'resp' part of the unions
+ * in the data structures above. Besides that the limits in the
+ * buffers above (ptm_hdata:u.req.data and ptm_get_state:u.resp.data
+ * and ptm_set_state:u.req.data) are 0xffffffff.
+ */
+enum {
+    CMD_GET_CAPABILITY = 1,
+    CMD_INIT,
+    CMD_SHUTDOWN,
+    CMD_GET_TPMESTABLISHED,
+    CMD_SET_LOCALITY,
+    CMD_HASH_START,
+    CMD_HASH_DATA,
+    CMD_HASH_END,
+    CMD_CANCEL_TPM_CMD,
+    CMD_STORE_VOLATILE,
+    CMD_RESET_TPMESTABLISHED,
+    CMD_GET_STATEBLOB,
+    CMD_SET_STATEBLOB,
+    CMD_STOP,
+    CMD_GET_CONFIG,
+    CMD_SET_DATAFD
+};
+
+#endif /* _TPM_IOCTL_H */
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index 9234eb3..e6ace28 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -30,7 +30,7 @@
 #include "tpm_int.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
-#include "sysemu/tpm_backend_int.h"
+#include "qapi/clone-visitor.h"
 #include "tpm_tis.h"
 #include "tpm_util.h"
 
@@ -46,29 +46,16 @@
 #define TPM_PASSTHROUGH(obj) \
     OBJECT_CHECK(TPMPassthruState, (obj), TYPE_TPM_PASSTHROUGH)
 
-static const TPMDriverOps tpm_passthrough_driver;
-
 /* data structures */
-typedef struct TPMPassthruThreadParams {
-    TPMState *tpm_state;
-
-    TPMRecvDataCB *recv_data_callback;
-    TPMBackend *tb;
-} TPMPassthruThreadParams;
-
 struct TPMPassthruState {
     TPMBackend parent;
 
-    TPMBackendThread tbt;
-
-    TPMPassthruThreadParams tpm_thread_params;
-
-    char *tpm_dev;
+    TPMPassthroughOptions *options;
+    const char *tpm_dev;
     int tpm_fd;
     bool tpm_executing;
     bool tpm_op_canceled;
     int cancel_fd;
-    bool had_startup_error;
 
     TPMVersion tpm_version;
 };
@@ -81,27 +68,6 @@
 
 static void tpm_passthrough_cancel_cmd(TPMBackend *tb);
 
-static int tpm_passthrough_unix_write(int fd, const uint8_t *buf, uint32_t len)
-{
-    int ret, remain;
-
-    remain = len;
-    while (remain > 0) {
-        ret = write(fd, buf, remain);
-        if (ret < 0) {
-            if (errno != EINTR && errno != EAGAIN) {
-                return -1;
-            }
-        } else if (ret == 0) {
-            break;
-        } else {
-            buf += ret;
-            remain -= ret;
-        }
-    }
-    return len - remain;
-}
-
 static int tpm_passthrough_unix_read(int fd, uint8_t *buf, uint32_t len)
 {
     int ret;
@@ -115,45 +81,12 @@
     }
     return ret;
 }
-
-static uint32_t tpm_passthrough_get_size_from_buffer(const uint8_t *buf)
-{
-    struct tpm_resp_hdr *resp = (struct tpm_resp_hdr *)buf;
-
-    return be32_to_cpu(resp->len);
-}
-
-/*
- * Write an error message in the given output buffer.
- */
-static void tpm_write_fatal_error_response(uint8_t *out, uint32_t out_len)
-{
-    if (out_len >= sizeof(struct tpm_resp_hdr)) {
-        struct tpm_resp_hdr *resp = (struct tpm_resp_hdr *)out;
-
-        resp->tag = cpu_to_be16(TPM_TAG_RSP_COMMAND);
-        resp->len = cpu_to_be32(sizeof(struct tpm_resp_hdr));
-        resp->errcode = cpu_to_be32(TPM_FAIL);
-    }
-}
-
-static bool tpm_passthrough_is_selftest(const uint8_t *in, uint32_t in_len)
-{
-    struct tpm_req_hdr *hdr = (struct tpm_req_hdr *)in;
-
-    if (in_len >= sizeof(*hdr)) {
-        return (be32_to_cpu(hdr->ordinal) == TPM_ORD_ContinueSelfTest);
-    }
-
-    return false;
-}
-
 static int tpm_passthrough_unix_tx_bufs(TPMPassthruState *tpm_pt,
                                         const uint8_t *in, uint32_t in_len,
                                         uint8_t *out, uint32_t out_len,
                                         bool *selftest_done)
 {
-    int ret;
+    ssize_t ret;
     bool is_selftest;
     const struct tpm_resp_hdr *hdr;
 
@@ -161,9 +94,9 @@
     tpm_pt->tpm_executing = true;
     *selftest_done = false;
 
-    is_selftest = tpm_passthrough_is_selftest(in, in_len);
+    is_selftest = tpm_util_is_selftest(in, in_len);
 
-    ret = tpm_passthrough_unix_write(tpm_pt->tpm_fd, in, in_len);
+    ret = qemu_write_full(tpm_pt->tpm_fd, (const void *)in, (size_t)in_len);
     if (ret != in_len) {
         if (!tpm_pt->tpm_op_canceled || errno != ECANCELED) {
             error_report("tpm_passthrough: error while transmitting data "
@@ -183,7 +116,7 @@
                          strerror(errno), errno);
         }
     } else if (ret < sizeof(struct tpm_resp_hdr) ||
-               tpm_passthrough_get_size_from_buffer(out) != ret) {
+               be32_to_cpu(((struct tpm_resp_hdr *)out)->len) != ret) {
         ret = -1;
         error_report("tpm_passthrough: received invalid response "
                      "packet from TPM");
@@ -196,7 +129,7 @@
 
 err_exit:
     if (ret < 0) {
-        tpm_write_fatal_error_response(out, out_len);
+        tpm_util_write_fatal_error_response(out, out_len);
     }
 
     tpm_pt->tpm_executing = false;
@@ -216,12 +149,9 @@
                                         selftest_done);
 }
 
-static void tpm_passthrough_worker_thread(gpointer data,
-                                          gpointer user_data)
+static void tpm_passthrough_handle_request(TPMBackend *tb, TPMBackendCmd cmd)
 {
-    TPMPassthruThreadParams *thr_parms = user_data;
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(thr_parms->tb);
-    TPMBackendCmd cmd = (TPMBackendCmd)data;
+    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
     bool selftest_done = false;
 
     DPRINTF("tpm_passthrough: processing command type %d\n", cmd);
@@ -229,12 +159,12 @@
     switch (cmd) {
     case TPM_BACKEND_CMD_PROCESS_CMD:
         tpm_passthrough_unix_transfer(tpm_pt,
-                                      thr_parms->tpm_state->locty_data,
+                                      tb->tpm_state->locty_data,
                                       &selftest_done);
 
-        thr_parms->recv_data_callback(thr_parms->tpm_state,
-                                      thr_parms->tpm_state->locty_number,
-                                      selftest_done);
+        tb->recv_data_callback(tb->tpm_state,
+                               tb->tpm_state->locty_number,
+                               selftest_done);
         break;
     case TPM_BACKEND_CMD_INIT:
     case TPM_BACKEND_CMD_END:
@@ -244,47 +174,11 @@
     }
 }
 
-/*
- * Start the TPM (thread). If it had been started before, then terminate
- * and start it again.
- */
-static int tpm_passthrough_startup_tpm(TPMBackend *tb)
-{
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
-
-    /* terminate a running TPM */
-    tpm_backend_thread_end(&tpm_pt->tbt);
-
-    tpm_backend_thread_create(&tpm_pt->tbt,
-                              tpm_passthrough_worker_thread,
-                              &tpm_pt->tpm_thread_params);
-
-    return 0;
-}
-
 static void tpm_passthrough_reset(TPMBackend *tb)
 {
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
-
     DPRINTF("tpm_passthrough: CALL TO TPM_RESET!\n");
 
     tpm_passthrough_cancel_cmd(tb);
-
-    tpm_backend_thread_end(&tpm_pt->tbt);
-
-    tpm_pt->had_startup_error = false;
-}
-
-static int tpm_passthrough_init(TPMBackend *tb, TPMState *s,
-                                TPMRecvDataCB *recv_data_cb)
-{
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
-
-    tpm_pt->tpm_thread_params.tpm_state = s;
-    tpm_pt->tpm_thread_params.recv_data_callback = recv_data_cb;
-    tpm_pt->tpm_thread_params.tb = tb;
-
-    return 0;
 }
 
 static bool tpm_passthrough_get_tpm_established_flag(TPMBackend *tb)
@@ -299,31 +193,6 @@
     return 0;
 }
 
-static bool tpm_passthrough_get_startup_error(TPMBackend *tb)
-{
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
-
-    return tpm_pt->had_startup_error;
-}
-
-static size_t tpm_passthrough_realloc_buffer(TPMSizedBuffer *sb)
-{
-    size_t wanted_size = 4096; /* Linux tpm.c buffer size */
-
-    if (sb->size != wanted_size) {
-        sb->buffer = g_realloc(sb->buffer, wanted_size);
-        sb->size = wanted_size;
-    }
-    return sb->size;
-}
-
-static void tpm_passthrough_deliver_request(TPMBackend *tb)
-{
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
-
-    tpm_backend_thread_deliver_request(&tpm_pt->tbt);
-}
-
 static void tpm_passthrough_cancel_cmd(TPMBackend *tb)
 {
     TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
@@ -351,11 +220,6 @@
     }
 }
 
-static const char *tpm_passthrough_create_desc(void)
-{
-    return "Passthrough TPM backend driver";
-}
-
 static TPMVersion tpm_passthrough_get_tpm_version(TPMBackend *tb)
 {
     TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
@@ -369,15 +233,14 @@
  * in Documentation/ABI/stable/sysfs-class-tpm.
  * From /dev/tpm0 create /sys/class/misc/tpm0/device/cancel
  */
-static int tpm_passthrough_open_sysfs_cancel(TPMBackend *tb)
+static int tpm_passthrough_open_sysfs_cancel(TPMPassthruState *tpm_pt)
 {
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
     int fd = -1;
     char *dev;
     char path[PATH_MAX];
 
-    if (tb->cancel_path) {
-        fd = qemu_open(tb->cancel_path, O_WRONLY);
+    if (tpm_pt->options->cancel_path) {
+        fd = qemu_open(tpm_pt->options->cancel_path, O_WRONLY);
         if (fd < 0) {
             error_report("Could not open TPM cancel path : %s",
                          strerror(errno));
@@ -392,7 +255,7 @@
                      dev) < sizeof(path)) {
             fd = qemu_open(path, O_WRONLY);
             if (fd >= 0) {
-                tb->cancel_path = g_strdup(path);
+                tpm_pt->options->cancel_path = g_strdup(path);
             } else {
                 error_report("tpm_passthrough: Could not open TPM cancel "
                              "path %s : %s", path, strerror(errno));
@@ -412,17 +275,18 @@
     const char *value;
 
     value = qemu_opt_get(opts, "cancel-path");
-    tb->cancel_path = g_strdup(value);
-
-    value = qemu_opt_get(opts, "path");
-    if (!value) {
-        value = TPM_PASSTHROUGH_DEFAULT_DEVICE;
+    if (value) {
+        tpm_pt->options->cancel_path = g_strdup(value);
+        tpm_pt->options->has_cancel_path = true;
     }
 
-    tpm_pt->tpm_dev = g_strdup(value);
+    value = qemu_opt_get(opts, "path");
+    if (value) {
+        tpm_pt->options->has_path = true;
+        tpm_pt->options->path = g_strdup(value);
+    }
 
-    tb->path = g_strdup(tpm_pt->tpm_dev);
-
+    tpm_pt->tpm_dev = value ? value : TPM_PASSTHROUGH_DEFAULT_DEVICE;
     tpm_pt->tpm_fd = qemu_open(tpm_pt->tpm_dev, O_RDWR);
     if (tpm_pt->tpm_fd < 0) {
         error_report("Cannot access TPM device using '%s': %s",
@@ -443,10 +307,8 @@
     tpm_pt->tpm_fd = -1;
 
  err_free_parameters:
-    g_free(tb->path);
-    tb->path = NULL;
-
-    g_free(tpm_pt->tpm_dev);
+    qapi_free_TPMPassthroughOptions(tpm_pt->options);
+    tpm_pt->options = NULL;
     tpm_pt->tpm_dev = NULL;
 
     return 1;
@@ -459,16 +321,12 @@
     TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
 
     tb->id = g_strdup(id);
-    /* let frontend set the fe_model to proper value */
-    tb->fe_model = -1;
-
-    tb->ops = &tpm_passthrough_driver;
 
     if (tpm_passthrough_handle_device_opts(opts, tb)) {
         goto err_exit;
     }
 
-    tpm_pt->cancel_fd = tpm_passthrough_open_sysfs_cancel(tb);
+    tpm_pt->cancel_fd = tpm_passthrough_open_sysfs_cancel(tpm_pt);
     if (tpm_pt->cancel_fd < 0) {
         goto err_exit;
     }
@@ -476,26 +334,20 @@
     return tb;
 
 err_exit:
-    g_free(tb->id);
+    object_unref(obj);
 
     return NULL;
 }
 
-static void tpm_passthrough_destroy(TPMBackend *tb)
+static TpmTypeOptions *tpm_passthrough_get_tpm_options(TPMBackend *tb)
 {
-    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(tb);
+    TpmTypeOptions *options = g_new0(TpmTypeOptions, 1);
 
-    tpm_passthrough_cancel_cmd(tb);
+    options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH;
+    options->u.passthrough.data = QAPI_CLONE(TPMPassthroughOptions,
+                                             TPM_PASSTHROUGH(tb)->options);
 
-    tpm_backend_thread_end(&tpm_pt->tbt);
-
-    qemu_close(tpm_pt->tpm_fd);
-    qemu_close(tpm_pt->cancel_fd);
-
-    g_free(tb->id);
-    g_free(tb->path);
-    g_free(tb->cancel_path);
-    g_free(tpm_pt->tpm_dev);
+    return options;
 }
 
 static const QemuOptDesc tpm_passthrough_cmdline_opts[] = {
@@ -516,27 +368,34 @@
 static const TPMDriverOps tpm_passthrough_driver = {
     .type                     = TPM_TYPE_PASSTHROUGH,
     .opts                     = tpm_passthrough_cmdline_opts,
-    .desc                     = tpm_passthrough_create_desc,
+    .desc                     = "Passthrough TPM backend driver",
     .create                   = tpm_passthrough_create,
-    .destroy                  = tpm_passthrough_destroy,
-    .init                     = tpm_passthrough_init,
-    .startup_tpm              = tpm_passthrough_startup_tpm,
-    .realloc_buffer           = tpm_passthrough_realloc_buffer,
     .reset                    = tpm_passthrough_reset,
-    .had_startup_error        = tpm_passthrough_get_startup_error,
-    .deliver_request          = tpm_passthrough_deliver_request,
     .cancel_cmd               = tpm_passthrough_cancel_cmd,
     .get_tpm_established_flag = tpm_passthrough_get_tpm_established_flag,
     .reset_tpm_established_flag = tpm_passthrough_reset_tpm_established_flag,
     .get_tpm_version          = tpm_passthrough_get_tpm_version,
+    .get_tpm_options          = tpm_passthrough_get_tpm_options,
 };
 
 static void tpm_passthrough_inst_init(Object *obj)
 {
+    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(obj);
+
+    tpm_pt->options = g_new0(TPMPassthroughOptions, 1);
+    tpm_pt->tpm_fd = -1;
+    tpm_pt->cancel_fd = -1;
 }
 
 static void tpm_passthrough_inst_finalize(Object *obj)
 {
+    TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(obj);
+
+    tpm_passthrough_cancel_cmd(TPM_BACKEND(obj));
+
+    qemu_close(tpm_pt->tpm_fd);
+    qemu_close(tpm_pt->cancel_fd);
+    qapi_free_TPMPassthroughOptions(tpm_pt->options);
 }
 
 static void tpm_passthrough_class_init(ObjectClass *klass, void *data)
@@ -544,6 +403,7 @@
     TPMBackendClass *tbc = TPM_BACKEND_CLASS(klass);
 
     tbc->ops = &tpm_passthrough_driver;
+    tbc->handle_request = tpm_passthrough_handle_request;
 }
 
 static const TypeInfo tpm_passthrough_info = {
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index a6440fe..d5118e7 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -963,6 +963,16 @@
     return tpm_backend_startup_tpm(s->be_driver);
 }
 
+static void tpm_tis_realloc_buffer(TPMSizedBuffer *sb)
+{
+    size_t wanted_size = 4096; /* Linux tpm.c buffer size */
+
+    if (sb->size != wanted_size) {
+        sb->buffer = g_realloc(sb->buffer, wanted_size);
+        sb->size = wanted_size;
+    }
+}
+
 /*
  * Get the TPMVersion of the backend device being used
  */
@@ -1010,9 +1020,9 @@
         tis->loc[c].state = TPM_TIS_STATE_IDLE;
 
         tis->loc[c].w_offset = 0;
-        tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].w_buffer);
+        tpm_tis_realloc_buffer(&tis->loc[c].w_buffer);
         tis->loc[c].r_offset = 0;
-        tpm_backend_realloc_buffer(s->be_driver, &tis->loc[c].r_buffer);
+        tpm_tis_realloc_buffer(&tis->loc[c].r_buffer);
     }
 
     tpm_tis_do_startup_tpm(s);
diff --git a/hw/tpm/tpm_util.c b/hw/tpm/tpm_util.c
index 7b35429..73d7796 100644
--- a/hw/tpm/tpm_util.c
+++ b/hw/tpm/tpm_util.c
@@ -24,6 +24,31 @@
 #include "tpm_int.h"
 
 /*
+ * Write an error message in the given output buffer.
+ */
+void tpm_util_write_fatal_error_response(uint8_t *out, uint32_t out_len)
+{
+    if (out_len >= sizeof(struct tpm_resp_hdr)) {
+        struct tpm_resp_hdr *resp = (struct tpm_resp_hdr *)out;
+
+        resp->tag = cpu_to_be16(TPM_TAG_RSP_COMMAND);
+        resp->len = cpu_to_be32(sizeof(struct tpm_resp_hdr));
+        resp->errcode = cpu_to_be32(TPM_FAIL);
+    }
+}
+
+bool tpm_util_is_selftest(const uint8_t *in, uint32_t in_len)
+{
+    struct tpm_req_hdr *hdr = (struct tpm_req_hdr *)in;
+
+    if (in_len >= sizeof(*hdr)) {
+        return (be32_to_cpu(hdr->ordinal) == TPM_ORD_ContinueSelfTest);
+    }
+
+    return false;
+}
+
+/*
  * A basic test of a TPM device. We expect a well formatted response header
  * (error response is fine) within one second.
  */
@@ -43,10 +68,10 @@
 
     n = write(fd, request, requestlen);
     if (n < 0) {
-        return errno;
+        return -errno;
     }
     if (n != requestlen) {
-        return EFAULT;
+        return -EFAULT;
     }
 
     FD_ZERO(&readfds);
@@ -55,18 +80,18 @@
     /* wait for a second */
     n = select(fd + 1, &readfds, NULL, NULL, &tv);
     if (n != 1) {
-        return errno;
+        return -errno;
     }
 
     n = read(fd, &buf, sizeof(buf));
     if (n < sizeof(struct tpm_resp_hdr)) {
-        return EFAULT;
+        return -EFAULT;
     }
 
     resp = (struct tpm_resp_hdr *)buf;
     /* check the header */
     if (be32_to_cpu(resp->len) != n) {
-        return EBADMSG;
+        return -EMSGSIZE;
     }
 
     *return_tag = be16_to_cpu(resp->tag);
diff --git a/hw/tpm/tpm_util.h b/hw/tpm/tpm_util.h
index df76245..2f7c961 100644
--- a/hw/tpm/tpm_util.h
+++ b/hw/tpm/tpm_util.h
@@ -24,6 +24,10 @@
 
 #include "sysemu/tpm_backend.h"
 
+void tpm_util_write_fatal_error_response(uint8_t *out, uint32_t out_len);
+
+bool tpm_util_is_selftest(const uint8_t *in, uint32_t in_len);
+
 int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_version);
 
 #endif /* TPM_TPM_UTIL_H */
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index 6dedcb8..8c0fc53 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -170,6 +170,10 @@
     .instance_finalize = usb_ehci_pci_finalize,
     .abstract = true,
     .class_init = ehci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void ehci_data_class_init(ObjectClass *klass, void *data)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 17beedd..d4c0293 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -2146,6 +2146,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(OHCIPCIState),
     .class_init    = ohci_pci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static Property ohci_sysbus_properties[] = {
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index e3562a4..836b11f 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1323,6 +1323,10 @@
     .class_size    = sizeof(UHCIPCIDeviceClass),
     .abstract = true,
     .class_init = uhci_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void uhci_data_class_init(ObjectClass *klass, void *data)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index d75c085..af3a9d8 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3670,6 +3670,11 @@
     .instance_size = sizeof(XHCIState),
     .class_init    = xhci_class_init,
     .abstract      = true,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { }
+    },
 };
 
 static void qemu_xhci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 14291c2..60ad5fb 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -1198,6 +1198,10 @@
     .name = "vfio-pci-igd-lpc-bridge",
     .parent = TYPE_PCI_DEVICE,
     .class_init = vfio_pci_igd_lpc_bridge_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void vfio_pci_igd_register_types(void)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 9e86db7..c977ee3 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3036,6 +3036,11 @@
     .class_init = vfio_pci_dev_class_init,
     .instance_init = vfio_instance_init,
     .instance_finalize = vfio_instance_finalize,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { }
+    },
 };
 
 static void register_vfio_pci_dev_type(void)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 5fd69f0..ddc42f0 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -375,8 +375,6 @@
     if (!log) {
         return;
     }
-    dev->log = NULL;
-    dev->log_size = 0;
 
     --log->refcnt;
     if (log->refcnt == 0) {
@@ -396,6 +394,9 @@
 
         g_free(log);
     }
+
+    dev->log = NULL;
+    dev->log_size = 0;
 }
 
 static bool vhost_dev_log_is_shared(struct vhost_dev *dev)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 8b0d6b6..e92837c 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -88,77 +88,19 @@
         qemu_put_be16(f, vdev->config_vector);
 }
 
-static void virtio_pci_load_modern_queue_state(VirtIOPCIQueue *vq,
-                                               QEMUFile *f)
-{
-    vq->num = qemu_get_be16(f);
-    vq->enabled = qemu_get_be16(f);
-    vq->desc[0] = qemu_get_be32(f);
-    vq->desc[1] = qemu_get_be32(f);
-    vq->avail[0] = qemu_get_be32(f);
-    vq->avail[1] = qemu_get_be32(f);
-    vq->used[0] = qemu_get_be32(f);
-    vq->used[1] = qemu_get_be32(f);
-}
-
-static bool virtio_pci_has_extra_state(DeviceState *d)
-{
-    VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
-
-    return proxy->flags & VIRTIO_PCI_FLAG_MIGRATE_EXTRA;
-}
-
-static int get_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size,
-                                       VMStateField *field)
-{
-    VirtIOPCIProxy *proxy = pv;
-    int i;
-
-    proxy->dfselect = qemu_get_be32(f);
-    proxy->gfselect = qemu_get_be32(f);
-    proxy->guest_features[0] = qemu_get_be32(f);
-    proxy->guest_features[1] = qemu_get_be32(f);
-    for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
-        virtio_pci_load_modern_queue_state(&proxy->vqs[i], f);
+static const VMStateDescription vmstate_virtio_pci_modern_queue_state = {
+    .name = "virtio_pci/modern_queue_state",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT16(num, VirtIOPCIQueue),
+        VMSTATE_UNUSED(1), /* enabled was stored as be16 */
+        VMSTATE_BOOL(enabled, VirtIOPCIQueue),
+        VMSTATE_UINT32_ARRAY(desc, VirtIOPCIQueue, 2),
+        VMSTATE_UINT32_ARRAY(avail, VirtIOPCIQueue, 2),
+        VMSTATE_UINT32_ARRAY(used, VirtIOPCIQueue, 2),
+        VMSTATE_END_OF_LIST()
     }
-
-    return 0;
-}
-
-static void virtio_pci_save_modern_queue_state(VirtIOPCIQueue *vq,
-                                               QEMUFile *f)
-{
-    qemu_put_be16(f, vq->num);
-    qemu_put_be16(f, vq->enabled);
-    qemu_put_be32(f, vq->desc[0]);
-    qemu_put_be32(f, vq->desc[1]);
-    qemu_put_be32(f, vq->avail[0]);
-    qemu_put_be32(f, vq->avail[1]);
-    qemu_put_be32(f, vq->used[0]);
-    qemu_put_be32(f, vq->used[1]);
-}
-
-static int put_virtio_pci_modern_state(QEMUFile *f, void *pv, size_t size,
-                                       VMStateField *field, QJSON *vmdesc)
-{
-    VirtIOPCIProxy *proxy = pv;
-    int i;
-
-    qemu_put_be32(f, proxy->dfselect);
-    qemu_put_be32(f, proxy->gfselect);
-    qemu_put_be32(f, proxy->guest_features[0]);
-    qemu_put_be32(f, proxy->guest_features[1]);
-    for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
-        virtio_pci_save_modern_queue_state(&proxy->vqs[i], f);
-    }
-
-    return 0;
-}
-
-static const VMStateInfo vmstate_info_virtio_pci_modern_state = {
-    .name = "virtqueue_state",
-    .get = get_virtio_pci_modern_state,
-    .put = put_virtio_pci_modern_state,
 };
 
 static bool virtio_pci_modern_state_needed(void *opaque)
@@ -168,21 +110,18 @@
     return virtio_pci_modern(proxy);
 }
 
-static const VMStateDescription vmstate_virtio_pci_modern_state = {
+static const VMStateDescription vmstate_virtio_pci_modern_state_sub = {
     .name = "virtio_pci/modern_state",
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = &virtio_pci_modern_state_needed,
     .fields = (VMStateField[]) {
-        {
-            .name         = "modern_state",
-            .version_id   = 0,
-            .field_exists = NULL,
-            .size         = 0,
-            .info         = &vmstate_info_virtio_pci_modern_state,
-            .flags        = VMS_SINGLE,
-            .offset       = 0,
-        },
+        VMSTATE_UINT32(dfselect, VirtIOPCIProxy),
+        VMSTATE_UINT32(gfselect, VirtIOPCIProxy),
+        VMSTATE_UINT32_ARRAY(guest_features, VirtIOPCIProxy, 2),
+        VMSTATE_STRUCT_ARRAY(vqs, VirtIOPCIProxy, VIRTIO_QUEUE_MAX, 0,
+                             vmstate_virtio_pci_modern_queue_state,
+                             VirtIOPCIQueue),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -196,11 +135,18 @@
         VMSTATE_END_OF_LIST()
     },
     .subsections = (const VMStateDescription*[]) {
-        &vmstate_virtio_pci_modern_state,
+        &vmstate_virtio_pci_modern_state_sub,
         NULL
     }
 };
 
+static bool virtio_pci_has_extra_state(DeviceState *d)
+{
+    VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
+
+    return proxy->flags & VIRTIO_PCI_FLAG_MIGRATE_EXTRA;
+}
+
 static void virtio_pci_save_extra_state(DeviceState *d, QEMUFile *f)
 {
     VirtIOPCIProxy *proxy = to_virtio_pci_proxy(d);
@@ -545,6 +491,24 @@
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
+static MemoryRegion *virtio_address_space_lookup(VirtIOPCIProxy *proxy,
+                                                 hwaddr *off, int len)
+{
+    int i;
+    VirtIOPCIRegion *reg;
+
+    for (i = 0; i < ARRAY_SIZE(proxy->regs); ++i) {
+        reg = &proxy->regs[i];
+        if (*off >= reg->offset &&
+            *off + len <= reg->offset + reg->size) {
+            *off -= reg->offset;
+            return &reg->mr;
+        }
+    }
+
+    return NULL;
+}
+
 /* Below are generic functions to do memcpy from/to an address space,
  * without byteswaps, with input validation.
  *
@@ -558,63 +522,72 @@
  * Note: host pointer must be aligned.
  */
 static
-void virtio_address_space_write(AddressSpace *as, hwaddr addr,
+void virtio_address_space_write(VirtIOPCIProxy *proxy, hwaddr addr,
                                 const uint8_t *buf, int len)
 {
-    uint32_t val;
+    uint64_t val;
+    MemoryRegion *mr;
 
     /* address_space_* APIs assume an aligned address.
      * As address is under guest control, handle illegal values.
      */
     addr &= ~(len - 1);
 
+    mr = virtio_address_space_lookup(proxy, &addr, len);
+    if (!mr) {
+        return;
+    }
+
     /* Make sure caller aligned buf properly */
     assert(!(((uintptr_t)buf) & (len - 1)));
 
     switch (len) {
     case 1:
         val = pci_get_byte(buf);
-        address_space_stb(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL);
         break;
     case 2:
-        val = pci_get_word(buf);
-        address_space_stw_le(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL);
+        val = cpu_to_le16(pci_get_word(buf));
         break;
     case 4:
-        val = pci_get_long(buf);
-        address_space_stl_le(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL);
+        val = cpu_to_le32(pci_get_long(buf));
         break;
     default:
         /* As length is under guest control, handle illegal values. */
-        break;
+        return;
     }
+    memory_region_dispatch_write(mr, addr, val, len, MEMTXATTRS_UNSPECIFIED);
 }
 
 static void
-virtio_address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int len)
+virtio_address_space_read(VirtIOPCIProxy *proxy, hwaddr addr,
+                          uint8_t *buf, int len)
 {
-    uint32_t val;
+    uint64_t val;
+    MemoryRegion *mr;
 
     /* address_space_* APIs assume an aligned address.
      * As address is under guest control, handle illegal values.
      */
     addr &= ~(len - 1);
 
+    mr = virtio_address_space_lookup(proxy, &addr, len);
+    if (!mr) {
+        return;
+    }
+
     /* Make sure caller aligned buf properly */
     assert(!(((uintptr_t)buf) & (len - 1)));
 
+    memory_region_dispatch_read(mr, addr, &val, len, MEMTXATTRS_UNSPECIFIED);
     switch (len) {
     case 1:
-        val = address_space_ldub(as, addr, MEMTXATTRS_UNSPECIFIED, NULL);
         pci_set_byte(buf, val);
         break;
     case 2:
-        val = address_space_lduw_le(as, addr, MEMTXATTRS_UNSPECIFIED, NULL);
-        pci_set_word(buf, val);
+        pci_set_word(buf, le16_to_cpu(val));
         break;
     case 4:
-        val = address_space_ldl_le(as, addr, MEMTXATTRS_UNSPECIFIED, NULL);
-        pci_set_long(buf, val);
+        pci_set_long(buf, le32_to_cpu(val));
         break;
     default:
         /* As length is under guest control, handle illegal values. */
@@ -650,8 +623,7 @@
 
         if (len == 1 || len == 2 || len == 4) {
             assert(len <= sizeof cfg->pci_cfg_data);
-            virtio_address_space_write(&proxy->modern_as, off,
-                                       cfg->pci_cfg_data, len);
+            virtio_address_space_write(proxy, off, cfg->pci_cfg_data, len);
         }
     }
 }
@@ -675,8 +647,7 @@
 
         if (len == 1 || len == 2 || len == 4) {
             assert(len <= sizeof cfg->pci_cfg_data);
-            virtio_address_space_read(&proxy->modern_as, off,
-                                      cfg->pci_cfg_data, len);
+            virtio_address_space_read(proxy, off, cfg->pci_cfg_data, len);
         }
     }
 
@@ -1783,15 +1754,6 @@
                        /* PCI BAR regions must be powers of 2 */
                        pow2ceil(proxy->notify.offset + proxy->notify.size));
 
-    memory_region_init_alias(&proxy->modern_cfg,
-                             OBJECT(proxy),
-                             "virtio-pci-cfg",
-                             &proxy->modern_bar,
-                             0,
-                             memory_region_size(&proxy->modern_bar));
-
-    address_space_init(&proxy->modern_as, &proxy->modern_cfg, "virtio-pci-cfg-as");
-
     if (proxy->disable_legacy == ON_OFF_AUTO_AUTO) {
         proxy->disable_legacy = pcie_port ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF;
     }
@@ -1860,10 +1822,7 @@
 
 static void virtio_pci_exit(PCIDevice *pci_dev)
 {
-    VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
-
     msix_uninit_exclusive_bar(pci_dev);
-    address_space_destroy(&proxy->modern_as);
 }
 
 static void virtio_pci_reset(DeviceState *qdev)
@@ -1958,6 +1917,11 @@
     .class_init    = virtio_pci_class_init,
     .class_size    = sizeof(VirtioPCIClass),
     .abstract      = true,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_PCIE_DEVICE },
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { }
+    },
 };
 
 /* virtio-blk-pci */
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 69f5959..12d3a90 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -155,15 +155,18 @@
 struct VirtIOPCIProxy {
     PCIDevice pci_dev;
     MemoryRegion bar;
-    VirtIOPCIRegion common;
-    VirtIOPCIRegion isr;
-    VirtIOPCIRegion device;
-    VirtIOPCIRegion notify;
-    VirtIOPCIRegion notify_pio;
+    union {
+        struct {
+            VirtIOPCIRegion common;
+            VirtIOPCIRegion isr;
+            VirtIOPCIRegion device;
+            VirtIOPCIRegion notify;
+            VirtIOPCIRegion notify_pio;
+        };
+        VirtIOPCIRegion regs[5];
+    };
     MemoryRegion modern_bar;
     MemoryRegion io_bar;
-    MemoryRegion modern_cfg;
-    AddressSpace modern_as;
     uint32_t legacy_io_bar_idx;
     uint32_t msix_bar_idx;
     uint32_t modern_io_bar_idx;
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 311929e..5884ce3 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -834,7 +834,7 @@
     int64_t len;
     VirtIODevice *vdev = vq->vdev;
     VirtQueueElement *elem = NULL;
-    unsigned out_num, in_num;
+    unsigned out_num, in_num, elem_entries;
     hwaddr addr[VIRTQUEUE_MAX_SIZE];
     struct iovec iov[VIRTQUEUE_MAX_SIZE];
     VRingDesc desc;
@@ -852,7 +852,7 @@
     smp_rmb();
 
     /* When we start there are none of either input nor output. */
-    out_num = in_num = 0;
+    out_num = in_num = elem_entries = 0;
 
     max = vq->vring.num;
 
@@ -922,7 +922,7 @@
         }
 
         /* If we've got too many, that implies a descriptor loop. */
-        if ((in_num + out_num) > max) {
+        if (++elem_entries > max) {
             virtio_error(vdev, "Looped descriptor");
             goto err_undo_map;
         }
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
index 49b3cd1..e596b08 100644
--- a/hw/watchdog/wdt_i6300esb.c
+++ b/hw/watchdog/wdt_i6300esb.c
@@ -463,6 +463,10 @@
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(I6300State),
     .class_init    = i6300esb_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
 };
 
 static void i6300esb_register_types(void)
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index 375efa6..9bba717 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -964,6 +964,11 @@
     .instance_size = sizeof(XenPCIPassthroughState),
     .instance_finalize = xen_pci_passthrough_finalize,
     .class_init = xen_pci_passthrough_class_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { INTERFACE_PCIE_DEVICE },
+        { },
+    },
 };
 
 static void xen_pci_passthrough_register_types(void)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 7e8a206..885c08e 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -354,10 +354,17 @@
     int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);
 
     /**
-     * Drain and stop any internal sources of requests in the driver, and
-     * remain so until next I/O callback (e.g. bdrv_co_writev) is called.
+     * bdrv_co_drain_begin is called if implemented in the beginning of a
+     * drain operation to drain and stop any internal sources of requests in
+     * the driver.
+     * bdrv_co_drain_end is called if implemented at the end of the drain.
+     *
+     * They should be used by the driver to e.g. manage scheduled I/O
+     * requests, or toggle an internal state. After the end of the drain new
+     * requests will continue normally.
      */
-    void coroutine_fn (*bdrv_co_drain)(BlockDriverState *bs);
+    void coroutine_fn (*bdrv_co_drain_begin)(BlockDriverState *bs);
+    void coroutine_fn (*bdrv_co_drain_end)(BlockDriverState *bs);
 
     void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *child,
                            Error **errp);
diff --git a/include/block/nbd.h b/include/block/nbd.h
index 707fd37..a6df5ce 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -63,15 +63,22 @@
 };
 typedef struct NBDReply NBDReply;
 
+typedef struct NBDSimpleReply {
+    uint32_t magic;  /* NBD_SIMPLE_REPLY_MAGIC */
+    uint32_t error;
+    uint64_t handle;
+} QEMU_PACKED NBDSimpleReply;
+
 /* Transmission (export) flags: sent from server to client during handshake,
    but describe what will happen during transmission */
-#define NBD_FLAG_HAS_FLAGS      (1 << 0)        /* Flags are there */
-#define NBD_FLAG_READ_ONLY      (1 << 1)        /* Device is read-only */
-#define NBD_FLAG_SEND_FLUSH     (1 << 2)        /* Send FLUSH */
-#define NBD_FLAG_SEND_FUA       (1 << 3)        /* Send FUA (Force Unit Access) */
-#define NBD_FLAG_ROTATIONAL     (1 << 4)        /* Use elevator algorithm - rotational media */
-#define NBD_FLAG_SEND_TRIM      (1 << 5)        /* Send TRIM (discard) */
-#define NBD_FLAG_SEND_WRITE_ZEROES (1 << 6)     /* Send WRITE_ZEROES */
+#define NBD_FLAG_HAS_FLAGS         (1 << 0) /* Flags are there */
+#define NBD_FLAG_READ_ONLY         (1 << 1) /* Device is read-only */
+#define NBD_FLAG_SEND_FLUSH        (1 << 2) /* Send FLUSH */
+#define NBD_FLAG_SEND_FUA          (1 << 3) /* Send FUA (Force Unit Access) */
+#define NBD_FLAG_ROTATIONAL        (1 << 4) /* Use elevator algorithm -
+                                               rotational media */
+#define NBD_FLAG_SEND_TRIM         (1 << 5) /* Send TRIM (discard) */
+#define NBD_FLAG_SEND_WRITE_ZEROES (1 << 6) /* Send WRITE_ZEROES */
 
 /* New-style handshake (global) flags, sent from server to client, and
    control what will happen during handshake phase. */
diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h
new file mode 100644
index 0000000..c3aa856
--- /dev/null
+++ b/include/hw/misc/vmcoreinfo.h
@@ -0,0 +1,46 @@
+/*
+ * Virtual Machine coreinfo device
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * Authors: Marc-André Lureau <marcandre.lureau@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+#ifndef VMCOREINFO_H
+#define VMCOREINFO_H
+
+#include "hw/qdev.h"
+
+#define VMCOREINFO_DEVICE "vmcoreinfo"
+#define VMCOREINFO(obj) OBJECT_CHECK(VMCoreInfoState, (obj), VMCOREINFO_DEVICE)
+
+#define VMCOREINFO_FORMAT_NONE 0x0
+#define VMCOREINFO_FORMAT_ELF 0x1
+
+/* all fields are little-endian */
+typedef struct FWCfgVMCoreInfo {
+    uint16_t host_format; /* set on reset */
+    uint16_t guest_format;
+    uint32_t size;
+    uint64_t paddr;
+} QEMU_PACKED FWCfgVMCoreInfo;
+
+typedef struct VMCoreInfoState {
+    DeviceClass parent_obj;
+
+    bool has_vmcoreinfo;
+    FWCfgVMCoreInfo vmcoreinfo;
+} VMCoreInfoState;
+
+/* returns NULL unless there is exactly one device */
+static inline VMCoreInfoState *vmcoreinfo_find(void)
+{
+    Object *o = object_resolve_path_type("", VMCOREINFO_DEVICE, NULL);
+
+    return o ? VMCOREINFO(o) : NULL;
+}
+
+#endif
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index f50d068..7ccbae5 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -45,6 +45,7 @@
 } QEMU_PACKED FWCfgDmaAccess;
 
 typedef void (*FWCfgCallback)(void *opaque);
+typedef void (*FWCfgWriteCallback)(void *opaque, off_t start, size_t len);
 
 struct FWCfgState {
     /*< private >*/
@@ -183,6 +184,7 @@
  * @s: fw_cfg device being modified
  * @filename: name of new fw_cfg file item
  * @select_cb: callback function when selecting
+ * @write_cb: callback function after a write
  * @callback_opaque: argument to be passed into callback function
  * @data: pointer to start of item data
  * @len: size of item data
@@ -202,6 +204,7 @@
  */
 void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
                               FWCfgCallback select_cb,
+                              FWCfgWriteCallback write_cb,
                               void *callback_opaque,
                               void *data, size_t len, bool read_only);
 
diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h
index d400a81..fd900fc 100644
--- a/include/hw/or-irq.h
+++ b/include/hw/or-irq.h
@@ -38,7 +38,6 @@
     DeviceState parent_obj;
 
     qemu_irq out_irq;
-    qemu_irq *in_irqs;
     bool levels[MAX_OR_LINES];
     uint16_t num_lines;
 };
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index aa7ef9c..8d02a0a 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -198,6 +198,12 @@
 #define PCI_DEVICE_GET_CLASS(obj) \
      OBJECT_GET_CLASS(PCIDeviceClass, (obj), TYPE_PCI_DEVICE)
 
+/* Implemented by devices that can be plugged on PCI Express buses */
+#define INTERFACE_PCIE_DEVICE "pci-express-device"
+
+/* Implemented by devices that can be plugged on Conventional PCI buses */
+#define INTERFACE_CONVENTIONAL_PCI_DEVICE "conventional-pci-device"
+
 typedef struct PCIINTxRoute {
     enum {
         PCI_INTX_ENABLED,
diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
index 9c5437d..59524cd 100644
--- a/include/hw/ppc/pnv.h
+++ b/include/hw/ppc/pnv.h
@@ -69,7 +69,6 @@
     SysBusDeviceClass parent_class;
 
     /*< public >*/
-    const char *cpu_model;
     PnvChipType  chip_type;
     uint64_t     chip_cfam_id;
     uint64_t     cores_mask;
@@ -80,19 +79,22 @@
     uint32_t (*core_pir)(PnvChip *chip, uint32_t core_id);
 } PnvChipClass;
 
-#define TYPE_PNV_CHIP_POWER8E TYPE_PNV_CHIP "-POWER8E"
+#define PNV_CHIP_TYPE_SUFFIX "-" TYPE_PNV_CHIP
+#define PNV_CHIP_TYPE_NAME(cpu_model) cpu_model PNV_CHIP_TYPE_SUFFIX
+
+#define TYPE_PNV_CHIP_POWER8E PNV_CHIP_TYPE_NAME("power8e_v2.1")
 #define PNV_CHIP_POWER8E(obj) \
     OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8E)
 
-#define TYPE_PNV_CHIP_POWER8 TYPE_PNV_CHIP "-POWER8"
+#define TYPE_PNV_CHIP_POWER8 PNV_CHIP_TYPE_NAME("power8_v2.0")
 #define PNV_CHIP_POWER8(obj) \
     OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8)
 
-#define TYPE_PNV_CHIP_POWER8NVL TYPE_PNV_CHIP "-POWER8NVL"
+#define TYPE_PNV_CHIP_POWER8NVL PNV_CHIP_TYPE_NAME("power8nvl_v1.0")
 #define PNV_CHIP_POWER8NVL(obj) \
     OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8NVL)
 
-#define TYPE_PNV_CHIP_POWER9 TYPE_PNV_CHIP "-POWER9"
+#define TYPE_PNV_CHIP_POWER9 PNV_CHIP_TYPE_NAME("power9_v2.0")
 #define PNV_CHIP_POWER9(obj) \
     OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER9)
 
diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h
index 2955a41..e337af7 100644
--- a/include/hw/ppc/pnv_core.h
+++ b/include/hw/ppc/pnv_core.h
@@ -42,9 +42,9 @@
 
 typedef struct PnvCoreClass {
     DeviceClass parent_class;
-    ObjectClass *cpu_oc;
 } PnvCoreClass;
 
-extern char *pnv_core_typename(const char *model);
+#define PNV_CORE_TYPE_SUFFIX "-" TYPE_PNV_CORE
+#define PNV_CORE_TYPE_NAME(cpu_model) cpu_model PNV_CORE_TYPE_SUFFIX
 
 #endif /* _PPC_PNV_CORE_H */
diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
index 4e7fe11..ff0ac30 100644
--- a/include/hw/ppc/ppc.h
+++ b/include/hw/ppc/ppc.h
@@ -105,6 +105,4 @@
 
 /* ppc_booke.c */
 void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags);
-
-void ppc_cpu_parse_features(const char *cpu_model);
 #endif
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index c1b365f..9d21ca9 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -60,7 +60,6 @@
     /*< public >*/
     bool dr_lmb_enabled;       /* enable dynamic-reconfig/hotplug of LMBs */
     bool use_ohci_by_default;  /* use USB-OHCI instead of XHCI */
-    const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */
     bool pre_2_10_has_unused_icps;
     void (*phb_placement)(sPAPRMachineState *spapr, uint32_t index,
                           uint64_t *buid, hwaddr *pio, 
@@ -659,7 +658,6 @@
                                             uint32_t count, uint32_t index);
 void spapr_hotplug_req_remove_by_count_indexed(sPAPRDRConnectorType drc_type,
                                                uint32_t count, uint32_t index);
-void spapr_cpu_parse_features(sPAPRMachineState *spapr);
 int spapr_hpt_shift_for_ramsize(uint64_t ramsize);
 void spapr_reallocate_hpt(sPAPRMachineState *spapr, int shift,
                           Error **errp);
diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h
index 93051e9..f2d48d6 100644
--- a/include/hw/ppc/spapr_cpu_core.h
+++ b/include/hw/ppc/spapr_cpu_core.h
@@ -21,6 +21,8 @@
 #define SPAPR_CPU_CORE_GET_CLASS(obj) \
      OBJECT_GET_CLASS(sPAPRCPUCoreClass, (obj), TYPE_SPAPR_CPU_CORE)
 
+#define SPAPR_CPU_CORE_TYPE_NAME(model) model "-" TYPE_SPAPR_CPU_CORE
+
 typedef struct sPAPRCPUCore {
     /*< private >*/
     CPUCore parent_obj;
@@ -32,9 +34,8 @@
 
 typedef struct sPAPRCPUCoreClass {
     DeviceClass parent_class;
-    ObjectClass *cpu_class;
+    const char *cpu_type;
 } sPAPRCPUCoreClass;
 
-char *spapr_get_cpu_core_type(const char *model);
-void spapr_cpu_core_class_init(ObjectClass *oc, void *data);
+const char *spapr_get_cpu_core_type(const char *cpu_type);
 #endif
diff --git a/include/io/channel-websock.h b/include/io/channel-websock.h
index ff32d86..a7e5e92 100644
--- a/include/io/channel-websock.h
+++ b/include/io/channel-websock.h
@@ -59,9 +59,8 @@
     Buffer encinput;
     Buffer encoutput;
     Buffer rawinput;
-    Buffer rawoutput;
-    Buffer ping_reply;
     size_t payload_remain;
+    size_t pong_remain;
     QIOChannelWebsockMask mask;
     guint io_tag;
     Error *io_err;
diff --git a/include/qemu/futex.h b/include/qemu/futex.h
index bb7dc9e..91ae889 100644
--- a/include/qemu/futex.h
+++ b/include/qemu/futex.h
@@ -11,6 +11,9 @@
  *
  */
 
+#ifndef QEMU_FUTEX_H
+#define QEMU_FUTEX_H
+
 #include <sys/syscall.h>
 #include <linux/futex.h>
 
@@ -34,3 +37,5 @@
         }
     }
 }
+
+#endif /* QEMU_FUTEX_H */
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 980d2b3..3dbc69b 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -83,6 +83,7 @@
 typedef struct PS2State PS2State;
 typedef struct QEMUBH QEMUBH;
 typedef struct QemuConsole QemuConsole;
+typedef struct QemuDmaBuf QemuDmaBuf;
 typedef struct QEMUFile QEMUFile;
 typedef struct QemuOpt QemuOpt;
 typedef struct QemuOpts QemuOpts;
diff --git a/include/qom/object.h b/include/qom/object.h
index a707b67..dc73d59 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -79,6 +79,28 @@
  * #TypeInfo describes information about the type including what it inherits
  * from, the instance and class size, and constructor/destructor hooks.
  *
+ * Alternatively several static types could be registered using helper macro
+ * DEFINE_TYPES()
+ *
+ * <example>
+ *   <programlisting>
+ * static const TypeInfo device_types_info[] = {
+ *     {
+ *         .name = TYPE_MY_DEVICE_A,
+ *         .parent = TYPE_DEVICE,
+ *         .instance_size = sizeof(MyDeviceA),
+ *     },
+ *     {
+ *         .name = TYPE_MY_DEVICE_B,
+ *         .parent = TYPE_DEVICE,
+ *         .instance_size = sizeof(MyDeviceB),
+ *     },
+ * };
+ *
+ * DEFINE_TYPES(device_types_info)
+ *   </programlisting>
+ * </example>
+ *
  * Every type has an #ObjectClass associated with it.  #ObjectClass derivatives
  * are instantiated dynamically but there is only ever one instance for any
  * given type.  The #ObjectClass typically holds a table of function pointers
@@ -789,6 +811,30 @@
 Type type_register(const TypeInfo *info);
 
 /**
+ * type_register_static_array:
+ * @infos: The array of the new type #TypeInfo structures.
+ * @nr_infos: number of entries in @infos
+ *
+ * @infos and all of the strings it points to should exist for the life time
+ * that the type is registered.
+ */
+void type_register_static_array(const TypeInfo *infos, int nr_infos);
+
+/**
+ * DEFINE_TYPES:
+ * @type_array: The array containing #TypeInfo structures to register
+ *
+ * @type_array should be static constant that exists for the life time
+ * that the type is registered.
+ */
+#define DEFINE_TYPES(type_array)                                            \
+static void do_qemu_init_ ## type_array(void)                               \
+{                                                                           \
+    type_register_static_array(type_array, ARRAY_SIZE(type_array));         \
+}                                                                           \
+type_init(do_qemu_init_ ## type_array)
+
+/**
  * object_class_dynamic_cast_assert:
  * @klass: The #ObjectClass to attempt to cast.
  * @typename: The QOM typename of the class to cast to.
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
index 2672a15..df43bd0 100644
--- a/include/sysemu/dump.h
+++ b/include/sysemu/dump.h
@@ -192,6 +192,8 @@
                                   * this could be used to calculate
                                   * how much work we have
                                   * finished. */
+    uint8_t *guest_note;         /* ELF note content */
+    size_t guest_note_size;
 } DumpState;
 
 uint16_t cpu_to_dump16(DumpState *s, uint16_t val);
diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index b0a9731..2c798a1 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -29,8 +29,32 @@
 
 typedef struct TPMBackendClass TPMBackendClass;
 typedef struct TPMBackend TPMBackend;
-
 typedef struct TPMDriverOps TPMDriverOps;
+typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty, bool selftest_done);
+
+typedef enum TPMBackendCmd {
+    TPM_BACKEND_CMD_INIT = 1,
+    TPM_BACKEND_CMD_PROCESS_CMD,
+    TPM_BACKEND_CMD_END,
+    TPM_BACKEND_CMD_TPM_RESET,
+} TPMBackendCmd;
+
+struct TPMBackend {
+    Object parent;
+
+    /*< protected >*/
+    bool opened;
+    TPMState *tpm_state;
+    GThreadPool *thread_pool;
+    TPMRecvDataCB *recv_data_callback;
+    bool had_startup_error;
+
+    /* <public> */
+    char *id;
+    enum TpmModel fe_model;
+
+    QLIST_ENTRY(TPMBackend) list;
+};
 
 struct TPMBackendClass {
     ObjectClass parent_class;
@@ -38,25 +62,10 @@
     const TPMDriverOps *ops;
 
     void (*opened)(TPMBackend *s, Error **errp);
+
+    void (*handle_request)(TPMBackend *s, TPMBackendCmd cmd);
 };
 
-struct TPMBackend {
-    Object parent;
-
-    /*< protected >*/
-    bool opened;
-
-    char *id;
-    enum TpmModel fe_model;
-    char *path;
-    char *cancel_path;
-    const TPMDriverOps *ops;
-
-    QLIST_ENTRY(TPMBackend) list;
-};
-
-typedef void (TPMRecvDataCB)(TPMState *, uint8_t locty, bool selftest_done);
-
 typedef struct TPMSizedBuffer {
     uint32_t size;
     uint8_t  *buffer;
@@ -66,21 +75,14 @@
     enum TpmType type;
     const QemuOptDesc *opts;
     /* get a descriptive text of the backend to display to the user */
-    const char *(*desc)(void);
+    const char *desc;
 
     TPMBackend *(*create)(QemuOpts *opts, const char *id);
-    void (*destroy)(TPMBackend *t);
 
     /* initialize the backend */
-    int (*init)(TPMBackend *t, TPMState *s, TPMRecvDataCB *datacb);
+    int (*init)(TPMBackend *t);
     /* start up the TPM on the backend */
     int (*startup_tpm)(TPMBackend *t);
-    /* returns true if nothing will ever answer TPM requests */
-    bool (*had_startup_error)(TPMBackend *t);
-
-    size_t (*realloc_buffer)(TPMSizedBuffer *sb);
-
-    void (*deliver_request)(TPMBackend *t);
 
     void (*reset)(TPMBackend *t);
 
@@ -91,6 +93,8 @@
     int (*reset_tpm_established_flag)(TPMBackend *t, uint8_t locty);
 
     TPMVersion (*get_tpm_version)(TPMBackend *t);
+
+    TpmTypeOptions *(*get_tpm_options)(TPMBackend *t);
 };
 
 
@@ -103,20 +107,6 @@
 enum TpmType tpm_backend_get_type(TPMBackend *s);
 
 /**
- * tpm_backend_get_desc:
- * @s: the backend
- *
- * Returns a human readable description of the backend.
- */
-const char *tpm_backend_get_desc(TPMBackend *s);
-
-/**
- * tpm_backend_destroy:
- * @s: the backend to destroy
- */
-void tpm_backend_destroy(TPMBackend *s);
-
-/**
  * tpm_backend_init:
  * @s: the backend to initialized
  * @state: TPMState
@@ -148,16 +138,6 @@
 bool tpm_backend_had_startup_error(TPMBackend *s);
 
 /**
- * tpm_backend_realloc_buffer:
- * @s: the backend
- * @sb: the TPMSizedBuffer to re-allocated to the size suitable for the
- *      backend.
- *
- * This function returns the size of the allocated buffer
- */
-size_t tpm_backend_realloc_buffer(TPMBackend *s, TPMSizedBuffer *sb);
-
-/**
  * tpm_backend_deliver_request:
  * @s: the backend to send the request to
  *
@@ -223,6 +203,16 @@
  */
 TPMVersion tpm_backend_get_tpm_version(TPMBackend *s);
 
+/**
+ * tpm_backend_query_tpm:
+ * @s: the backend
+ *
+ * Query backend tpm info
+ *
+ * Returns newly allocated TPMInfo
+ */
+TPMInfo *tpm_backend_query_tpm(TPMBackend *s);
+
 TPMBackend *qemu_find_tpm(const char *id);
 
 const TPMDriverOps *tpm_get_backend_driver(const char *type);
diff --git a/include/sysemu/tpm_backend_int.h b/include/sysemu/tpm_backend_int.h
deleted file mode 100644
index 00639dd..0000000
--- a/include/sysemu/tpm_backend_int.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  common TPM backend driver functions
- *
- *  Copyright (c) 2012-2013 IBM Corporation
- *  Authors:
- *    Stefan Berger <stefanb@us.ibm.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>
- */
-
-#ifndef TPM_BACKEND_INT_H
-#define TPM_BACKEND_INT_H
-
-typedef struct TPMBackendThread {
-    GThreadPool *pool;
-} TPMBackendThread;
-
-void tpm_backend_thread_deliver_request(TPMBackendThread *tbt);
-void tpm_backend_thread_create(TPMBackendThread *tbt,
-                               GFunc func, gpointer user_data);
-void tpm_backend_thread_end(TPMBackendThread *tbt);
-
-typedef enum TPMBackendCmd {
-    TPM_BACKEND_CMD_INIT = 1,
-    TPM_BACKEND_CMD_PROCESS_CMD,
-    TPM_BACKEND_CMD_END,
-    TPM_BACKEND_CMD_TPM_RESET,
-} TPMBackendCmd;
-
-#endif /* TPM_BACKEND_INT_H */
diff --git a/include/ui/console.h b/include/ui/console.h
index 6966e4b..580dfc5 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -5,12 +5,14 @@
 #include "qom/object.h"
 #include "qapi/qmp/qdict.h"
 #include "qemu/notify.h"
+#include "qemu/typedefs.h"
 #include "qapi-types.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 
 #ifdef CONFIG_OPENGL
 # include <epoxy/gl.h>
+# include "ui/shader.h"
 #endif
 
 /* keyboard/mouse support */
@@ -180,6 +182,15 @@
     int minor_ver;
 };
 
+struct QemuDmaBuf {
+    int       fd;
+    uint32_t  width;
+    uint32_t  height;
+    uint32_t  stride;
+    uint32_t  fourcc;
+    uint32_t  texture;
+};
+
 typedef struct DisplayChangeListenerOps {
     const char *dpy_name;
 
@@ -220,6 +231,13 @@
                                    uint32_t backing_height,
                                    uint32_t x, uint32_t y,
                                    uint32_t w, uint32_t h);
+    void (*dpy_gl_scanout_dmabuf)(DisplayChangeListener *dcl,
+                                  QemuDmaBuf *dmabuf);
+    void (*dpy_gl_cursor_dmabuf)(DisplayChangeListener *dcl,
+                                 QemuDmaBuf *dmabuf,
+                                 uint32_t pos_x, uint32_t pos_y);
+    void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl,
+                                  QemuDmaBuf *dmabuf);
     void (*dpy_gl_update)(DisplayChangeListener *dcl,
                           uint32_t x, uint32_t y, uint32_t w, uint32_t h);
 
@@ -288,6 +306,13 @@
                             uint32_t backing_id, bool backing_y_0_top,
                             uint32_t backing_width, uint32_t backing_height,
                             uint32_t x, uint32_t y, uint32_t w, uint32_t h);
+void dpy_gl_scanout_dmabuf(QemuConsole *con,
+                           QemuDmaBuf *dmabuf);
+void dpy_gl_cursor_dmabuf(QemuConsole *con,
+                          QemuDmaBuf *dmabuf,
+                          uint32_t pos_x, uint32_t pos_y);
+void dpy_gl_release_dmabuf(QemuConsole *con,
+                           QemuDmaBuf *dmabuf);
 void dpy_gl_update(QemuConsole *con,
                    uint32_t x, uint32_t y, uint32_t w, uint32_t h);
 
@@ -298,6 +323,7 @@
 QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con);
 
 bool console_has_gl(QemuConsole *con);
+bool console_has_gl_dmabuf(QemuConsole *con);
 
 static inline int surface_stride(DisplaySurface *s)
 {
@@ -390,22 +416,19 @@
 DisplaySurface *qemu_console_surface(QemuConsole *con);
 
 /* console-gl.c */
-typedef struct ConsoleGLState ConsoleGLState;
 #ifdef CONFIG_OPENGL
-ConsoleGLState *console_gl_init_context(void);
-void console_gl_fini_context(ConsoleGLState *gls);
 bool console_gl_check_format(DisplayChangeListener *dcl,
                              pixman_format_code_t format);
-void surface_gl_create_texture(ConsoleGLState *gls,
+void surface_gl_create_texture(QemuGLShader *gls,
                                DisplaySurface *surface);
-void surface_gl_update_texture(ConsoleGLState *gls,
+void surface_gl_update_texture(QemuGLShader *gls,
                                DisplaySurface *surface,
                                int x, int y, int w, int h);
-void surface_gl_render_texture(ConsoleGLState *gls,
+void surface_gl_render_texture(QemuGLShader *gls,
                                DisplaySurface *surface);
-void surface_gl_destroy_texture(ConsoleGLState *gls,
+void surface_gl_destroy_texture(QemuGLShader *gls,
                                DisplaySurface *surface);
-void surface_gl_setup_viewport(ConsoleGLState *gls,
+void surface_gl_setup_viewport(QemuGLShader *gls,
                                DisplaySurface *surface,
                                int ww, int wh);
 #endif
diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
index 81cb255..747233c 100644
--- a/include/ui/egl-helpers.h
+++ b/include/ui/egl-helpers.h
@@ -24,6 +24,10 @@
 void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip);
 void egl_fb_read(void *dst, egl_fb *src);
 
+void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip);
+void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip,
+                       int x, int y);
+
 #ifdef CONFIG_OPENGL_DMABUF
 
 extern int qemu_egl_rn_fd;
@@ -33,6 +37,9 @@
 int egl_rendernode_init(const char *rendernode);
 int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);
 
+void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
+void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
+
 #endif
 
 EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
diff --git a/include/ui/gtk.h b/include/ui/gtk.h
index 2f7b720..849c896 100644
--- a/include/ui/gtk.h
+++ b/include/ui/gtk.h
@@ -47,7 +47,7 @@
     double scale_x;
     double scale_y;
 #if defined(CONFIG_OPENGL)
-    ConsoleGLState *gls;
+    QemuGLShader *gls;
     EGLContext ectx;
     EGLSurface esurface;
     int glupdates;
diff --git a/include/ui/input.h b/include/ui/input.h
index c488585..f8cee43 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -38,12 +38,11 @@
 void qemu_input_event_sync(void);
 void qemu_input_event_sync_impl(void);
 
-InputEvent *qemu_input_event_new_key(KeyValue *key, bool down);
 void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down);
 void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down);
 void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down);
 void qemu_input_event_send_key_delay(uint32_t delay_ms);
-int qemu_input_key_number_to_qcode(uint8_t nr);
+int qemu_input_key_number_to_qcode(unsigned int nr);
 int qemu_input_key_value_to_number(const KeyValue *value);
 int qemu_input_key_value_to_qcode(const KeyValue *value);
 int qemu_input_key_value_to_scancode(const KeyValue *value, bool down,
@@ -69,4 +68,13 @@
 void qemu_add_mouse_mode_change_notifier(Notifier *notify);
 void qemu_remove_mouse_mode_change_notifier(Notifier *notify);
 
+extern const guint qemu_input_map_linux_to_qcode_len;
+extern const guint16 qemu_input_map_linux_to_qcode[];
+
+extern const guint qemu_input_map_qcode_to_qnum_len;
+extern const guint16 qemu_input_map_qcode_to_qnum[];
+
+extern const guint qemu_input_map_qnum_to_qcode_len;
+extern const guint16 qemu_input_map_qnum_to_qcode[];
+
 #endif /* INPUT_H */
diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h
index 454367a..b29cf80 100644
--- a/include/ui/sdl2.h
+++ b/include/ui/sdl2.h
@@ -26,7 +26,7 @@
     int idle_counter;
     SDL_GLContext winctx;
 #ifdef CONFIG_OPENGL
-    ConsoleGLState *gls;
+    QemuGLShader *gls;
     egl_fb guest_fb;
     egl_fb win_fb;
     bool y0_top;
diff --git a/include/ui/shader.h b/include/ui/shader.h
index f7d8618..4c5acb2 100644
--- a/include/ui/shader.h
+++ b/include/ui/shader.h
@@ -3,13 +3,11 @@
 
 #include <epoxy/gl.h>
 
-GLuint qemu_gl_init_texture_blit(GLint texture_blit_prog);
-void qemu_gl_run_texture_blit(GLint texture_blit_prog,
-                              GLint texture_blit_vao);
+typedef struct QemuGLShader QemuGLShader;
 
-GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src);
-GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag);
-GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src,
-                                           const GLchar *frag_src);
+void qemu_gl_run_texture_blit(QemuGLShader *gls, bool flip);
+
+QemuGLShader *qemu_gl_init_shader(void);
+void qemu_gl_fini_shader(QemuGLShader *gls);
 
 #endif /* QEMU_SHADER_H */
diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h
index 4ba9444..aaf2019 100644
--- a/include/ui/spice-display.h
+++ b/include/ui/spice-display.h
@@ -119,7 +119,7 @@
     /* opengl rendering */
     QEMUBH *gl_unblock_bh;
     QEMUTimer *gl_unblock_timer;
-    ConsoleGLState *gls;
+    QemuGLShader *gls;
     int gl_updates;
     bool have_scanout;
     bool have_surface;
diff --git a/io/channel-websock.c b/io/channel-websock.c
index d1d471f..87ebdeb 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -24,11 +24,12 @@
 #include "io/channel-websock.h"
 #include "crypto/hash.h"
 #include "trace.h"
+#include "qemu/iov.h"
 
 #include <time.h>
 
 
-/* Max amount to allow in rawinput/rawoutput buffers */
+/* Max amount to allow in rawinput/encoutput buffers */
 #define QIO_CHANNEL_WEBSOCK_MAX_BUFFER 8192
 
 #define QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN 24
@@ -151,9 +152,10 @@
     QIO_CHANNEL_WEBSOCK_OPCODE_PONG = 0xA
 };
 
-static void qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc,
-                                                   const char *resmsg,
-                                                   ...)
+static void GCC_FMT_ATTR(2, 3)
+qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc,
+                                       const char *resmsg,
+                                       ...)
 {
     va_list vargs;
     char *response;
@@ -223,6 +225,7 @@
         goto bad_request;
     }
     *nl = '\0';
+    trace_qio_channel_websock_http_greeting(ioc, buffer);
 
     tmp = strchr(buffer, ' ');
     if (!tmp) {
@@ -339,7 +342,7 @@
     char combined_key[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
                       QIO_CHANNEL_WEBSOCK_GUID_LEN + 1];
     char *accept = NULL;
-    char *date = qio_channel_websock_date_str();
+    char *date = NULL;
 
     g_strlcpy(combined_key, key, QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN + 1);
     g_strlcat(combined_key, QIO_CHANNEL_WEBSOCK_GUID,
@@ -358,6 +361,7 @@
         return;
     }
 
+    date = qio_channel_websock_date_str();
     qio_channel_websock_handshake_send_res(
         ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept);
 
@@ -373,6 +377,9 @@
     size_t nhdrs = G_N_ELEMENTS(hdrs);
     const char *protocols = NULL, *version = NULL, *key = NULL,
         *host = NULL, *connection = NULL, *upgrade = NULL;
+    char **connectionv;
+    bool upgraded = false;
+    size_t i;
 
     nhdrs = qio_channel_websock_extract_headers(ioc, buffer, hdrs, nhdrs, errp);
     if (!nhdrs) {
@@ -421,6 +428,9 @@
         goto bad_request;
     }
 
+    trace_qio_channel_websock_http_request(ioc, protocols, version,
+                                           host, connection, upgrade, key);
+
     if (!g_strrstr(protocols, QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY)) {
         error_setg(errp, "No '%s' protocol is supported by client '%s'",
                    QIO_CHANNEL_WEBSOCK_PROTOCOL_BINARY, protocols);
@@ -439,7 +449,16 @@
         goto bad_request;
     }
 
-    if (strcasecmp(connection, QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE) != 0) {
+    connectionv = g_strsplit(connection, ",", 0);
+    for (i = 0; connectionv != NULL && connectionv[i] != NULL; i++) {
+        g_strstrip(connectionv[i]);
+        if (strcasecmp(connectionv[i],
+                       QIO_CHANNEL_WEBSOCK_CONNECTION_UPGRADE) == 0) {
+            upgraded = true;
+        }
+    }
+    g_strfreev(connectionv);
+    if (!upgraded) {
         error_setg(errp, "No connection upgrade requested '%s'", connection);
         goto bad_request;
     }
@@ -582,49 +601,48 @@
 }
 
 
-static void qio_channel_websock_encode_buffer(QIOChannelWebsock *ioc,
-                                              Buffer *output,
-                                              uint8_t opcode, Buffer *buffer)
+static void qio_channel_websock_encode(QIOChannelWebsock *ioc,
+                                       uint8_t opcode,
+                                       const struct iovec *iov,
+                                       size_t niov,
+                                       size_t size)
 {
     size_t header_size;
+    size_t i;
     union {
         char buf[QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT];
         QIOChannelWebsockHeader ws;
     } header;
 
+    assert(size <= iov_size(iov, niov));
+
     header.ws.b0 = QIO_CHANNEL_WEBSOCK_HEADER_FIELD_FIN |
         (opcode & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE);
-    if (buffer->offset < QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_7_BIT) {
-        header.ws.b1 = (uint8_t)buffer->offset;
+    if (size < QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_7_BIT) {
+        header.ws.b1 = (uint8_t)size;
         header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_7_BIT;
-    } else if (buffer->offset <
-               QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_16_BIT) {
+    } else if (size < QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_16_BIT) {
         header.ws.b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT;
-        header.ws.u.s16.l16 = cpu_to_be16((uint16_t)buffer->offset);
+        header.ws.u.s16.l16 = cpu_to_be16((uint16_t)size);
         header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_16_BIT;
     } else {
         header.ws.b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_64_BIT;
-        header.ws.u.s64.l64 = cpu_to_be64(buffer->offset);
+        header.ws.u.s64.l64 = cpu_to_be64(size);
         header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT;
     }
     header_size -= QIO_CHANNEL_WEBSOCK_HEADER_LEN_MASK;
 
-    trace_qio_channel_websock_encode(ioc, opcode, header_size, buffer->offset);
-    buffer_reserve(output, header_size + buffer->offset);
-    buffer_append(output, header.buf, header_size);
-    buffer_append(output, buffer->buffer, buffer->offset);
-}
-
-
-static void qio_channel_websock_encode(QIOChannelWebsock *ioc)
-{
-    if (!ioc->rawoutput.offset) {
-        return;
+    trace_qio_channel_websock_encode(ioc, opcode, header_size, size);
+    buffer_reserve(&ioc->encoutput, header_size + size);
+    buffer_append(&ioc->encoutput, header.buf, header_size);
+    for (i = 0; i < niov && size != 0; i++) {
+        size_t want = iov[i].iov_len;
+        if (want > size) {
+            want = size;
+        }
+        buffer_append(&ioc->encoutput, iov[i].iov_base, want);
+        size -= want;
     }
-    qio_channel_websock_encode_buffer(
-        ioc, &ioc->encoutput, QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME,
-        &ioc->rawoutput);
-    buffer_reset(&ioc->rawoutput);
 }
 
 
@@ -634,17 +652,22 @@
 static void qio_channel_websock_write_close(QIOChannelWebsock *ioc,
                                             uint16_t code, const char *reason)
 {
-    buffer_reserve(&ioc->rawoutput, 2 + (reason ? strlen(reason) : 0));
-    *(uint16_t *)(ioc->rawoutput.buffer + ioc->rawoutput.offset) =
-        cpu_to_be16(code);
-    ioc->rawoutput.offset += 2;
+    struct iovec iov[2] = {
+        { .iov_base = &code, .iov_len = sizeof(code) },
+    };
+    size_t niov = 1;
+    size_t size = iov[0].iov_len;
+
+    cpu_to_be16s(&code);
+
     if (reason) {
-        buffer_append(&ioc->rawoutput, reason, strlen(reason));
+        iov[1].iov_base = (void *)reason;
+        iov[1].iov_len = strlen(reason);
+        size += iov[1].iov_len;
+        niov++;
     }
-    qio_channel_websock_encode_buffer(
-        ioc, &ioc->encoutput, QIO_CHANNEL_WEBSOCK_OPCODE_CLOSE,
-        &ioc->rawoutput);
-    buffer_reset(&ioc->rawoutput);
+    qio_channel_websock_encode(ioc, QIO_CHANNEL_WEBSOCK_OPCODE_CLOSE,
+                               iov, niov, size);
     qio_channel_websock_write_wire(ioc, NULL);
     qio_channel_shutdown(ioc->master, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);
 }
@@ -813,9 +836,10 @@
         error_setg(errp, "websocket closed by peer");
         if (payload_len) {
             /* echo client status */
-            qio_channel_websock_encode_buffer(
-                ioc, &ioc->encoutput, QIO_CHANNEL_WEBSOCK_OPCODE_CLOSE,
-                &ioc->encinput);
+            struct iovec iov = { .iov_base = ioc->encinput.buffer,
+                                 .iov_len = ioc->encinput.offset };
+            qio_channel_websock_encode(ioc, QIO_CHANNEL_WEBSOCK_OPCODE_CLOSE,
+                                       &iov, 1, iov.iov_len);
             qio_channel_websock_write_wire(ioc, NULL);
             qio_channel_shutdown(ioc->master, QIO_CHANNEL_SHUTDOWN_BOTH, NULL);
         } else {
@@ -825,11 +849,15 @@
         }
         return -1;
     } else if (ioc->opcode == QIO_CHANNEL_WEBSOCK_OPCODE_PING) {
-        /* ping frames produce an immediate reply */
-        buffer_reset(&ioc->ping_reply);
-        qio_channel_websock_encode_buffer(
-            ioc, &ioc->ping_reply, QIO_CHANNEL_WEBSOCK_OPCODE_PONG,
-            &ioc->encinput);
+        /* ping frames produce an immediate reply, as long as we've not still
+         * got a previous pong queued, in which case we drop the new pong */
+        if (ioc->pong_remain == 0) {
+            struct iovec iov = { .iov_base = ioc->encinput.buffer,
+                                 .iov_len = ioc->encinput.offset };
+            qio_channel_websock_encode(ioc, QIO_CHANNEL_WEBSOCK_OPCODE_PONG,
+                                       &iov, 1, iov.iov_len);
+            ioc->pong_remain = ioc->encoutput.offset;
+        }
     }   /* pong frames are ignored */
 
     if (payload_len) {
@@ -887,8 +915,6 @@
     buffer_free(&ioc->encinput);
     buffer_free(&ioc->encoutput);
     buffer_free(&ioc->rawinput);
-    buffer_free(&ioc->rawoutput);
-    buffer_free(&ioc->ping_reply);
     object_unref(OBJECT(ioc->master));
     if (ioc->io_tag) {
         g_source_remove(ioc->io_tag);
@@ -946,13 +972,6 @@
     ssize_t ret;
     ssize_t done = 0;
 
-    /* ping replies take priority over binary data */
-    if (!ioc->ping_reply.offset) {
-        qio_channel_websock_encode(ioc);
-    } else if (!ioc->encoutput.offset) {
-        buffer_move_empty(&ioc->encoutput, &ioc->ping_reply);
-    }
-
     while (ioc->encoutput.offset > 0) {
         ret = qio_channel_write(ioc->master,
                                 (char *)ioc->encoutput.buffer,
@@ -968,6 +987,11 @@
         }
         buffer_advance(&ioc->encoutput, ret);
         done += ret;
+        if (ioc->pong_remain < ret) {
+            ioc->pong_remain = 0;
+        } else {
+            ioc->pong_remain -= ret;
+        }
     }
     return done;
 }
@@ -1026,7 +1050,7 @@
         return;
     }
 
-    if (ioc->encoutput.offset || ioc->ping_reply.offset) {
+    if (ioc->encoutput.offset) {
         cond |= G_IO_OUT;
     }
     if (ioc->encinput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER &&
@@ -1100,8 +1124,8 @@
                                           Error **errp)
 {
     QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK(ioc);
-    size_t i;
-    ssize_t done = 0;
+    ssize_t want = iov_size(iov, niov);
+    ssize_t avail;
     ssize_t ret;
 
     if (wioc->io_err) {
@@ -1114,24 +1138,21 @@
         return -1;
     }
 
-    for (i = 0; i < niov; i++) {
-        size_t want = iov[i].iov_len;
-        if ((want + wioc->rawoutput.offset) > QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
-            want = (QIO_CHANNEL_WEBSOCK_MAX_BUFFER - wioc->rawoutput.offset);
-        }
-        if (want == 0) {
-            goto done;
-        }
-
-        buffer_reserve(&wioc->rawoutput, want);
-        buffer_append(&wioc->rawoutput, iov[i].iov_base, want);
-        done += want;
-        if (want < iov[i].iov_len) {
-            break;
-        }
+    avail = wioc->encoutput.offset >= QIO_CHANNEL_WEBSOCK_MAX_BUFFER ?
+        0 : (QIO_CHANNEL_WEBSOCK_MAX_BUFFER - wioc->encoutput.offset);
+    if (want > avail) {
+        want = avail;
     }
 
- done:
+    if (want) {
+        qio_channel_websock_encode(wioc,
+                                   QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME,
+                                   iov, niov, want);
+    }
+
+    /* Even if want == 0, we'll try write_wire in case there's
+     * pending data we could usefully flush out
+     */
     ret = qio_channel_websock_write_wire(wioc, errp);
     if (ret < 0 &&
         ret != QIO_CHANNEL_ERR_BLOCK) {
@@ -1141,11 +1162,11 @@
 
     qio_channel_websock_set_watch(wioc);
 
-    if (done == 0) {
+    if (want == 0) {
         return QIO_CHANNEL_ERR_BLOCK;
     }
 
-    return done;
+    return want;
 }
 
 static int qio_channel_websock_set_blocking(QIOChannel *ioc,
@@ -1208,7 +1229,7 @@
     if (wsource->wioc->rawinput.offset || wsource->wioc->io_eof) {
         cond |= G_IO_IN;
     }
-    if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
+    if (wsource->wioc->encoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
         cond |= G_IO_OUT;
     }
 
diff --git a/io/trace-events b/io/trace-events
index 801b5dc..f70bad7 100644
--- a/io/trace-events
+++ b/io/trace-events
@@ -48,6 +48,8 @@
 qio_channel_websock_handshake_reply(void *ioc) "Websock handshake reply ioc=%p"
 qio_channel_websock_handshake_fail(void *ioc, const char *msg) "Websock handshake fail ioc=%p err=%s"
 qio_channel_websock_handshake_complete(void *ioc) "Websock handshake complete ioc=%p"
+qio_channel_websock_http_greeting(void *ioc, const char *greeting) "Websocket HTTP request ioc=%p greeting='%s'"
+qio_channel_websock_http_request(void *ioc, const char *protocols, const char *version, const char *host, const char *connection, const char *upgrade, const char *key) "Websocket HTTP request ioc=%p protocols='%s' version='%s' host='%s' connection='%s' upgrade='%s' key='%s'"
 qio_channel_websock_header_partial_decode(void *ioc, size_t payloadlen, unsigned char fin, unsigned char opcode, unsigned char has_mask) "Websocket header decoded ioc=%p payload-len=%zu fin=0x%x opcode=0x%x has_mask=0x%x"
 qio_channel_websock_header_full_decode(void *ioc, size_t headerlen, size_t payloadlen, uint32_t mask) "Websocket header decoded ioc=%p header-len=%zu payload-len=%zu mask=0x%x"
 qio_channel_websock_payload_decode(void *ioc, uint8_t opcode, size_t payload_remain) "Websocket header decoded ioc=%p opcode=0x%x payload-remain=%zu"
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index e6997ff..35cad6f 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -173,6 +173,11 @@
   IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
   IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
 
+  IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
+  IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
+  IOCTL(RNDZAPENTCNT, 0, TYPE_NULL)
+  IOCTL(RNDCLEARPOOL, 0, TYPE_NULL)
+
   IOCTL(CDROMPAUSE, 0, TYPE_NULL)
   IOCTL(CDROMSTART, 0, TYPE_NULL)
   IOCTL(CDROMSTOP, 0, TYPE_NULL)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a25bbff..9bf901f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -59,6 +59,7 @@
 #include <linux/icmp.h>
 #include <linux/icmpv6.h>
 #include <linux/errqueue.h>
+#include <linux/random.h>
 #include "qemu-common.h"
 #ifdef CONFIG_TIMERFD
 #include <sys/timerfd.h>
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index e405d1d..450960b 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1060,6 +1060,13 @@
 
 #define TARGET_SIOCGIWNAME     0x8B01          /* get name == wireless protocol */
 
+/* From <linux/random.h> */
+
+#define TARGET_RNDGETENTCNT    TARGET_IOR('R', 0x00, int)
+#define TARGET_RNDADDTOENTCNT  TARGET_IOW('R', 0x01, int)
+#define TARGET_RNDZAPENTCNT    TARGET_IO('R', 0x04)
+#define TARGET_RNDCLEARPOOL    TARGET_IO('R', 0x06)
+
 /* From <linux/fs.h> */
 
 #define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
diff --git a/nbd/client.c b/nbd/client.c
index 68a0bc1..cd5a2c8 100644
--- a/nbd/client.c
+++ b/nbd/client.c
@@ -931,7 +931,7 @@
     }
 
     /* Reply
-       [ 0 ..  3]    magic   (NBD_REPLY_MAGIC)
+       [ 0 ..  3]    magic   (NBD_SIMPLE_REPLY_MAGIC)
        [ 4 ..  7]    error   (0 == no error)
        [ 7 .. 15]    handle
      */
@@ -949,7 +949,7 @@
     }
     trace_nbd_receive_reply(magic, reply->error, reply->handle);
 
-    if (magic != NBD_REPLY_MAGIC) {
+    if (magic != NBD_SIMPLE_REPLY_MAGIC) {
         error_setg(errp, "invalid magic (got 0x%" PRIx32 ")", magic);
         return -EINVAL;
     }
diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
index 8a609a2..11a130d 100644
--- a/nbd/nbd-internal.h
+++ b/nbd/nbd-internal.h
@@ -46,23 +46,23 @@
 /* Size of oldstyle negotiation */
 #define NBD_OLDSTYLE_NEGOTIATE_SIZE (8 + 8 + 8 + 4 + 124)
 
-#define NBD_REQUEST_MAGIC       0x25609513
-#define NBD_REPLY_MAGIC         0x67446698
-#define NBD_OPTS_MAGIC          0x49484156454F5054LL
-#define NBD_CLIENT_MAGIC        0x0000420281861253LL
-#define NBD_REP_MAGIC           0x0003e889045565a9LL
+#define NBD_REQUEST_MAGIC           0x25609513
+#define NBD_SIMPLE_REPLY_MAGIC      0x67446698
+#define NBD_OPTS_MAGIC              0x49484156454F5054LL
+#define NBD_CLIENT_MAGIC            0x0000420281861253LL
+#define NBD_REP_MAGIC               0x0003e889045565a9LL
 
-#define NBD_SET_SOCK            _IO(0xab, 0)
-#define NBD_SET_BLKSIZE         _IO(0xab, 1)
-#define NBD_SET_SIZE            _IO(0xab, 2)
-#define NBD_DO_IT               _IO(0xab, 3)
-#define NBD_CLEAR_SOCK          _IO(0xab, 4)
-#define NBD_CLEAR_QUE           _IO(0xab, 5)
-#define NBD_PRINT_DEBUG         _IO(0xab, 6)
-#define NBD_SET_SIZE_BLOCKS     _IO(0xab, 7)
-#define NBD_DISCONNECT          _IO(0xab, 8)
-#define NBD_SET_TIMEOUT         _IO(0xab, 9)
-#define NBD_SET_FLAGS           _IO(0xab, 10)
+#define NBD_SET_SOCK                _IO(0xab, 0)
+#define NBD_SET_BLKSIZE             _IO(0xab, 1)
+#define NBD_SET_SIZE                _IO(0xab, 2)
+#define NBD_DO_IT                   _IO(0xab, 3)
+#define NBD_CLEAR_SOCK              _IO(0xab, 4)
+#define NBD_CLEAR_QUE               _IO(0xab, 5)
+#define NBD_PRINT_DEBUG             _IO(0xab, 6)
+#define NBD_SET_SIZE_BLOCKS         _IO(0xab, 7)
+#define NBD_DISCONNECT              _IO(0xab, 8)
+#define NBD_SET_TIMEOUT             _IO(0xab, 9)
+#define NBD_SET_FLAGS               _IO(0xab, 10)
 
 /* NBD errors are based on errno numbers, so there is a 1:1 mapping,
  * but only a limited set of errno values is specified in the protocol.
diff --git a/nbd/server.c b/nbd/server.c
index 993ade3..3df3548 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -902,26 +902,6 @@
     return 0;
 }
 
-static int nbd_send_reply(QIOChannel *ioc, NBDReply *reply, Error **errp)
-{
-    uint8_t buf[NBD_REPLY_SIZE];
-
-    reply->error = system_errno_to_nbd_errno(reply->error);
-
-    trace_nbd_send_reply(reply->error, reply->handle);
-
-    /* Reply
-       [ 0 ..  3]    magic   (NBD_REPLY_MAGIC)
-       [ 4 ..  7]    error   (0 == no error)
-       [ 7 .. 15]    handle
-     */
-    stl_be_p(buf, NBD_REPLY_MAGIC);
-    stl_be_p(buf + 4, reply->error);
-    stq_be_p(buf + 8, reply->handle);
-
-    return nbd_write(ioc, buf, sizeof(buf), errp);
-}
-
 #define MAX_NBD_REQUESTS 16
 
 void nbd_client_get(NBDClient *client)
@@ -1047,7 +1027,7 @@
 {
     AioContext *ctx;
     BlockBackend *blk;
-    NBDExport *exp = g_malloc0(sizeof(NBDExport));
+    NBDExport *exp = g_new0(NBDExport, 1);
     uint64_t perm;
     int ret;
 
@@ -1208,38 +1188,51 @@
     }
 }
 
-static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len,
-                             Error **errp)
+static int coroutine_fn nbd_co_send_iov(NBDClient *client, struct iovec *iov,
+                                        unsigned niov, Error **errp)
 {
-    NBDClient *client = req->client;
     int ret;
 
     g_assert(qemu_in_coroutine());
-
-    trace_nbd_co_send_reply(reply->handle, reply->error, len);
-
     qemu_co_mutex_lock(&client->send_lock);
     client->send_coroutine = qemu_coroutine_self();
 
-    if (!len) {
-        ret = nbd_send_reply(client->ioc, reply, errp);
-    } else {
-        qio_channel_set_cork(client->ioc, true);
-        ret = nbd_send_reply(client->ioc, reply, errp);
-        if (ret == 0) {
-            ret = nbd_write(client->ioc, req->data, len, errp);
-            if (ret < 0) {
-                ret = -EIO;
-            }
-        }
-        qio_channel_set_cork(client->ioc, false);
-    }
+    ret = qio_channel_writev_all(client->ioc, iov, niov, errp) < 0 ? -EIO : 0;
 
     client->send_coroutine = NULL;
     qemu_co_mutex_unlock(&client->send_lock);
+
     return ret;
 }
 
+static inline void set_be_simple_reply(NBDSimpleReply *reply, uint64_t error,
+                                       uint64_t handle)
+{
+    stl_be_p(&reply->magic, NBD_SIMPLE_REPLY_MAGIC);
+    stl_be_p(&reply->error, error);
+    stq_be_p(&reply->handle, handle);
+}
+
+static int nbd_co_send_simple_reply(NBDClient *client,
+                                    uint64_t handle,
+                                    uint32_t error,
+                                    void *data,
+                                    size_t len,
+                                    Error **errp)
+{
+    NBDSimpleReply reply;
+    int nbd_err = system_errno_to_nbd_errno(error);
+    struct iovec iov[] = {
+        {.iov_base = &reply, .iov_len = sizeof(reply)},
+        {.iov_base = data, .iov_len = len}
+    };
+
+    trace_nbd_co_send_simple_reply(handle, nbd_err, len);
+    set_be_simple_reply(&reply, nbd_err, handle);
+
+    return nbd_co_send_iov(client, iov, len ? 2 : 1, errp);
+}
+
 /* nbd_co_receive_request
  * Collect a client request. Return 0 if request looks valid, -EIO to drop
  * connection right away, and any other negative value to report an error to
@@ -1331,7 +1324,6 @@
     NBDExport *exp = client->exp;
     NBDRequestData *req;
     NBDRequest request = { 0 };    /* GCC thinks it can be used uninitialized */
-    NBDReply reply;
     int ret;
     int flags;
     int reply_data_len = 0;
@@ -1351,11 +1343,7 @@
         goto disconnect;
     }
 
-    reply.handle = request.handle;
-    reply.error = 0;
-
     if (ret < 0) {
-        reply.error = -ret;
         goto reply;
     }
 
@@ -1374,7 +1362,6 @@
             ret = blk_co_flush(exp->blk);
             if (ret < 0) {
                 error_setg_errno(&local_err, -ret, "flush failed");
-                reply.error = -ret;
                 break;
             }
         }
@@ -1383,7 +1370,6 @@
                         req->data, request.len);
         if (ret < 0) {
             error_setg_errno(&local_err, -ret, "reading from file failed");
-            reply.error = -ret;
             break;
         }
 
@@ -1392,7 +1378,7 @@
         break;
     case NBD_CMD_WRITE:
         if (exp->nbdflags & NBD_FLAG_READ_ONLY) {
-            reply.error = EROFS;
+            ret = -EROFS;
             break;
         }
 
@@ -1404,14 +1390,13 @@
                          req->data, request.len, flags);
         if (ret < 0) {
             error_setg_errno(&local_err, -ret, "writing to file failed");
-            reply.error = -ret;
         }
 
         break;
     case NBD_CMD_WRITE_ZEROES:
         if (exp->nbdflags & NBD_FLAG_READ_ONLY) {
             error_setg(&local_err, "Server is read-only, return error");
-            reply.error = EROFS;
+            ret = -EROFS;
             break;
         }
 
@@ -1426,7 +1411,6 @@
                                 request.len, flags);
         if (ret < 0) {
             error_setg_errno(&local_err, -ret, "writing to file failed");
-            reply.error = -ret;
         }
 
         break;
@@ -1438,7 +1422,6 @@
         ret = blk_co_flush(exp->blk);
         if (ret < 0) {
             error_setg_errno(&local_err, -ret, "flush failed");
-            reply.error = -ret;
         }
 
         break;
@@ -1447,25 +1430,27 @@
                               request.len);
         if (ret < 0) {
             error_setg_errno(&local_err, -ret, "discard failed");
-            reply.error = -ret;
         }
 
         break;
     default:
         error_setg(&local_err, "invalid request type (%" PRIu32 ") received",
                    request.type);
-        reply.error = EINVAL;
+        ret = -EINVAL;
     }
 
 reply:
     if (local_err) {
-        /* If we are here local_err is not fatal error, already stored in
-         * reply.error */
+        /* If we get here, local_err was not a fatal error, and should be sent
+         * to the client. */
         error_report_err(local_err);
         local_err = NULL;
     }
 
-    if (nbd_co_send_reply(req, &reply, reply_data_len, &local_err) < 0) {
+    if (nbd_co_send_simple_reply(req->client, request.handle,
+                                 ret < 0 ? -ret : 0,
+                                 req->data, reply_data_len, &local_err) < 0)
+    {
         error_prepend(&local_err, "Failed to send reply: ");
         goto disconnect;
     }
@@ -1539,7 +1524,7 @@
     NBDClient *client;
     Coroutine *co;
 
-    client = g_malloc0(sizeof(NBDClient));
+    client = g_new0(NBDClient, 1);
     client->refcount = 1;
     client->exp = exp;
     client->tlscreds = tlscreds;
diff --git a/nbd/trace-events b/nbd/trace-events
index 48a4f27..e27614f 100644
--- a/nbd/trace-events
+++ b/nbd/trace-events
@@ -51,10 +51,9 @@
 nbd_negotiate_new_style_size_flags(uint64_t size, unsigned flags) "advertising size %" PRIu64 " and flags 0x%x"
 nbd_negotiate_success(void) "Negotiation succeeded"
 nbd_receive_request(uint32_t magic, uint16_t flags, uint16_t type, uint64_t from, uint32_t len) "Got request: { magic = 0x%" PRIx32 ", .flags = 0x%" PRIx16 ", .type = 0x%" PRIx16 ", from = %" PRIu64 ", len = %" PRIu32 " }"
-nbd_send_reply(int32_t error, uint64_t handle) "Sending response to client: { .error = %" PRId32 ", handle = %" PRIu64 " }"
 nbd_blk_aio_attached(const char *name, void *ctx) "Export %s: Attaching clients to AIO context %p\n"
 nbd_blk_aio_detach(const char *name, void *ctx) "Export %s: Detaching clients from AIO context %p\n"
-nbd_co_send_reply(uint64_t handle, uint32_t error, int len) "Send reply: handle = %" PRIu64 ", error = %" PRIu32 ", len = %d"
+nbd_co_send_simple_reply(uint64_t handle, uint32_t error, int len) "Send simple reply: handle = %" PRIu64 ", error = %" PRIu32 ", len = %d"
 nbd_co_receive_request_decode_type(uint64_t handle, uint16_t type, const char *name) "Decoding type: handle = %" PRIu64 ", type = %" PRIu16 " (%s)"
 nbd_co_receive_request_payload_received(uint64_t handle, uint32_t len) "Payload received: handle = %" PRIu64 ", len = %" PRIu32
 nbd_co_receive_request_cmd_write(uint32_t len) "Reading %" PRIu32 " byte(s)"
diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 90e2c92..ce0dc23 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -213,6 +213,12 @@
     MirrorState *s = FILTER_MIRROR(nf);
     Chardev *chr;
 
+    if (s->outdev == NULL) {
+        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "filter-mirror parameter"\
+                  " 'outdev' cannot be empty");
+        return;
+    }
+
     chr = qemu_chr_find(s->outdev);
     if (chr == NULL) {
         error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
diff --git a/os-posix.c b/os-posix.c
index 92e9d85..b9c2343 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -25,7 +25,6 @@
 
 #include "qemu/osdep.h"
 #include <sys/wait.h>
-/*needed for MAP_POPULATE before including qemu-options.h */
 #include <pwd.h>
 #include <grp.h>
 #include <libgen.h>
diff --git a/pc-bios/keymaps/Makefile b/pc-bios/keymaps/Makefile
new file mode 100644
index 0000000..f0e44fd
--- /dev/null
+++ b/pc-bios/keymaps/Makefile
@@ -0,0 +1,56 @@
+
+KEYMAP	:= $(shell which qemu-keymap 2>/dev/null)
+
+MAPS	:= ar bepo cz da de de-ch en-us en-gb es et fi fo \
+	   fr fr-be fr-ca fr-ch \
+	   hr hu is it ja lt lv mk nl no pl pt pt-br ru th tr
+
+ar	: MAP_FLAGS :=	-l ar
+bepo	: MAP_FLAGS :=	-l fr -v dvorak
+cz	: MAP_FLAGS :=	-l cz
+da	: MAP_FLAGS :=	-l dk
+de	: MAP_FLAGS :=	-l de
+de-ch	: MAP_FLAGS :=	-l ch
+en-us	: MAP_FLAGS :=	-l us
+en-gb	: MAP_FLAGS :=	-l gb
+es	: MAP_FLAGS :=	-l es
+et	: MAP_FLAGS :=	-l et
+fi	: MAP_FLAGS :=	-l fi
+fo	: MAP_FLAGS :=	-l fo
+fr	: MAP_FLAGS :=	-l fr
+fr-be	: MAP_FLAGS :=	-l be
+fr-ca	: MAP_FLAGS :=	-l ca -v fr
+fr-ch	: MAP_FLAGS :=	-l ch -v fr
+hr	: MAP_FLAGS :=	-l hr
+hu	: MAP_FLAGS :=	-l hu
+is	: MAP_FLAGS :=	-l is
+it	: MAP_FLAGS :=	-l it
+ja	: MAP_FLAGS :=	-l jp -m jp106
+lt	: MAP_FLAGS :=	-l lt
+lv	: MAP_FLAGS :=	-l lv
+mk	: MAP_FLAGS :=	-l mk
+nl	: MAP_FLAGS :=	-l nl
+no	: MAP_FLAGS :=	-l no
+pl	: MAP_FLAGS :=	-l pl
+pt	: MAP_FLAGS :=	-l pt
+pt-br	: MAP_FLAGS :=	-l br
+ru	: MAP_FLAGS :=	-l ru
+th	: MAP_FLAGS :=	-l th
+tr	: MAP_FLAGS :=	-l tr
+
+ifeq ($(KEYMAP),)
+
+all:
+	@echo "nothing to do (qemu-keymap not found)"
+
+else
+
+all: $(MAPS)
+
+clean:
+	rm -f $(MAPS)
+
+$(MAPS): $(KEYMAP) Makefile
+	$(KEYMAP) -f $@ $(MAP_FLAGS)
+
+endif
diff --git a/pc-bios/keymaps/ar b/pc-bios/keymaps/ar
index c430c03..a763c9a 100644
--- a/pc-bios/keymaps/ar
+++ b/pc-bios/keymaps/ar
@@ -1,98 +1,753 @@
-# generated from XKB map ar
-include common
-map 0x401
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : ar
+#    variant : -
+#    options : -
+
+# name: "Arabic"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 at 0x03 shift
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 asciicircum 0x07 shift
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 ampersand 0x08 shift
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
-parenleft 0x0a shift
-parenright 0x0b shift
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
+parenright 0x0a shift
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
+parenleft 0x0b shift
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
-Arabic_dad 0x10 altgr
-Arabic_fatha 0x10 shift altgr
-Arabic_sad 0x11 altgr
-Arabic_fathatan 0x11 shift altgr
-Arabic_theh 0x12 altgr
-Arabic_damma 0x12 shift altgr
-Arabic_qaf 0x13 altgr
-Arabic_dammatan 0x13 shift altgr
-Arabic_feh 0x14 altgr
-UFEF9 0x14 shift altgr
-Arabic_ghain 0x15 altgr
-Arabic_hamzaunderalef 0x15 shift altgr
-Arabic_ain 0x16 altgr
-grave 0x16 shift altgr
-Arabic_ha 0x17 altgr
-division 0x17 shift altgr
-Arabic_khah 0x18 altgr
-multiply 0x18 shift altgr
-Arabic_hah 0x19 altgr
-Arabic_semicolon 0x19 shift altgr
-bracketleft 0x1a
-braceleft 0x1a shift
-Arabic_jeem 0x1a altgr
-bracketright 0x1b
-braceright 0x1b shift
-Arabic_dal 0x1b altgr
-Arabic_sheen 0x1e altgr
-backslash 0x1e shift altgr
-Arabic_seen 0x1f altgr
-Arabic_yeh 0x20 altgr
-bracketleft 0x20 shift altgr
-Arabic_beh 0x21 altgr
-bracketright 0x21 shift altgr
-Arabic_lam 0x22 altgr
-UFEF7 0x22 shift altgr
-Arabic_alef 0x23 altgr
-Arabic_hamzaonalef 0x23 shift altgr
-Arabic_teh 0x24 altgr
-Arabic_tatweel 0x24 shift altgr
-Arabic_noon 0x25 altgr
-Arabic_comma 0x25 shift altgr
-Arabic_meem 0x26 altgr
-slash 0x26 shift altgr
-semicolon 0x27
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+Arabic_dad 0x10
+Arabic_fatha 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+Arabic_sad 0x11
+Arabic_fathatan 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+Arabic_theh 0x12
+Arabic_damma 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+Arabic_qaf 0x13
+Arabic_dammatan 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+Arabic_feh 0x14
+UFEF9 0x14 shift
+Arabic_veh 0x14 altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+Arabic_ghain 0x15
+Arabic_hamzaunderalef 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+Arabic_ain 0x16
+grave 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+Arabic_ha 0x17
+division 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+Arabic_khah 0x18
+multiply 0x18 shift
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+Arabic_hah 0x19
+Arabic_semicolon 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+Arabic_jeem 0x1a
+less 0x1a shift
+Arabic_tcheh 0x1a altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+Arabic_dal 0x1b
+greater 0x1b shift
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+Arabic_sheen 0x1e
+Arabic_kasra 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+Arabic_seen 0x1f
+Arabic_kasratan 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+Arabic_yeh 0x20
+bracketright 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+Arabic_beh 0x21
+bracketleft 0x21 shift
+Arabic_peh 0x21 altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+Arabic_lam 0x22
+UFEF7 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+Arabic_alef 0x23
+Arabic_hamzaonalef 0x23 shift
+U0671 0x23 altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+Arabic_teh 0x24
+Arabic_tatweel 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+Arabic_noon 0x25
+Arabic_comma 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+Arabic_meem 0x26
+slash 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+Arabic_kaf 0x27
 colon 0x27 shift
-Arabic_kaf 0x27 altgr
-apostrophe 0x28
+Arabic_gaf 0x27 altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+Arabic_tah 0x28
 quotedbl 0x28 shift
-Arabic_tah 0x28 altgr
-grave 0x29
-asciitilde 0x29 shift
-Arabic_thal 0x29 altgr
-Arabic_shadda 0x29 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+Arabic_thal 0x29
+Arabic_shadda 0x29 shift
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 backslash 0x2b
 bar 0x2b shift
-less 0x2b altgr
-greater 0x2b shift altgr
-Arabic_hamzaonyeh 0x2c altgr
-asciitilde 0x2c shift altgr
-Arabic_hamza 0x2d altgr
-Arabic_sukun 0x2d shift altgr
-Arabic_hamzaonwaw 0x2e altgr
-Arabic_kasra 0x2e shift altgr
-Arabic_ra 0x2f altgr
-Arabic_kasratan 0x2f shift altgr
-UFEFB 0x30 altgr
-UFEF5 0x30 shift altgr
-Arabic_alefmaksura 0x31 altgr
-Arabic_maddaonalef 0x31 shift altgr
-Arabic_tehmarbuta 0x32 altgr
-apostrophe 0x32 shift altgr
-comma 0x33
-less 0x33 shift
-Arabic_waw 0x33 altgr
-period 0x34
-greater 0x34 shift
-Arabic_zain 0x34 altgr
-slash 0x35
-question 0x35 shift
-Arabic_zah 0x35 altgr
-Arabic_question_mark 0x35 shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+Arabic_hamzaonyeh 0x2c
+asciitilde 0x2c shift
+guillemotright 0x2c altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+Arabic_hamza 0x2d
+Arabic_sukun 0x2d shift
+guillemotleft 0x2d altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+Arabic_hamzaonwaw 0x2e
+braceright 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+Arabic_ra 0x2f
+braceleft 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+UFEFB 0x30
+UFEF5 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+Arabic_alefmaksura 0x31
+Arabic_maddaonalef 0x31 shift
+Arabic_superscript_alef 0x31 altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+Arabic_tehmarbuta 0x32
+apostrophe 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
+Arabic_waw 0x33
+comma 0x33 shift
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
+Arabic_zain 0x34
+period 0x34 shift
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+Arabic_zah 0x35
+Arabic_question_mark 0x35 shift
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+bar 0x56
+brokenbar 0x56 shift
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/bepo b/pc-bios/keymaps/bepo
index d40041a..dbe8daa 100644
--- a/pc-bios/keymaps/bepo
+++ b/pc-bios/keymaps/bepo
@@ -1,333 +1,781 @@
-include common
-
-# Bépo : Improved ergonomic french keymap using Dvorak method.
-# Built by community on 'Dvorak Fr / Bépo' :
-# see http://www.clavier-dvorak.org/wiki/ to join and help.
 #
-# Bépo layout (1.0rc2 version) for a pc105 keyboard (french) :
-# ┌────┐
-# │ S A│   S = Shift,  A = AltGr + Shift
-# │ s a│   s = normal, a = AltGr
-# └────┘
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : fr
+#    variant : dvorak
+#    options : -
+
+# name: "French (Dvorak)"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+equal 0x02
+1 0x02 shift
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+slash 0x03
+2 0x03 shift
+plusminus 0x03 altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+minus 0x04
+3 0x04 shift
+onequarter 0x04 altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+egrave 0x05
+4 0x05 shift
+onehalf 0x05 altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+backslash 0x06
+5 0x06 shift
+threequarters 0x06 altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+dead_circumflex 0x07
+6 0x07 shift
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+parenleft 0x08
+7 0x08 shift
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+ISO_Level3_Latch 0x09
+8 0x09 shift
+grave 0x09 altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+parenright 0x0a
+9 0x0a shift
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+quotedbl 0x0b
+0 0x0b shift
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
+bracketleft 0x0c
+plus 0x0c shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+bracketright 0x0d
+percent 0x0d shift
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+colon 0x10
+question 0x10 shift
+ae 0x10 altgr
+AE 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+apostrophe 0x11
+less 0x11 shift
+dollar 0x11 altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+eacute 0x12
+greater 0x12 shift
+Eacute 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+g 0x13
+G 0x13 shift
+EuroSign 0x13 altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+period 0x14
+exclam 0x14 shift
+degree 0x14 altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+h 0x15
+H 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+v 0x16
+V 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+c 0x17
+C 0x17 shift
+ccedilla 0x17 altgr
+Ccedilla 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+m 0x18
+M 0x18 shift
+mu 0x18 altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+k 0x19
+K 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+z 0x1a
+Z 0x1a shift
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+dead_diaeresis 0x1b
+ampersand 0x1b shift
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+o 0x1e
+O 0x1e shift
+ograve 0x1e altgr
+Ograve 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+a 0x1f
+A 0x1f shift
+agrave 0x1f altgr
+Agrave 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+u 0x20
+U 0x20 shift
+ugrave 0x20 altgr
+Ugrave 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+e 0x21
+E 0x21 shift
+egrave 0x21 altgr
+Egrave 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+b 0x22
+B 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+f 0x23
+F 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+s 0x24
+S 0x24 shift
+guillemotleft 0x24 altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+t 0x25
+T 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+n 0x26
+N 0x26 shift
+guillemotright 0x26 altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+d 0x27
+D 0x27 shift
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+w 0x28
+W 0x28 shift
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+underscore 0x29
+asterisk 0x29 shift
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
+asciitilde 0x2b
+numbersign 0x2b shift
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+semicolon 0x2c
+bar 0x2c shift
+oe 0x2c altgr
+OE 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+q 0x2d
+Q 0x2d shift
+braceleft 0x2d altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+comma 0x2e
+at 0x2e shift
+braceright 0x2e altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+i 0x2f
+I 0x2f shift
+igrave 0x2f altgr
+Igrave 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+y 0x30
+Y 0x30 shift
+sterling 0x30 altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+x 0x31
+X 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+r 0x32
+R 0x32 shift
+masculine 0x32 altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
+l 0x33
+L 0x33 shift
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
+p 0x34
+P 0x34 shift
+section 0x34 altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+j 0x35
+J 0x35 shift
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+nobreakspace 0x39 altgr
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+agrave 0x56
+ccedilla 0x56 shift
+Agrave 0x56 altgr
+Ccedilla 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
 #
-# ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━┓
-# │ # ¶ │ 1 „ │ 2 “ │ 3 ” │ 4 ≤ │ 5 ≥ │ 6   │ 7 ¬ │ 8 ¼ │ 9 ½ │ 0 ¾ │ ° ′ │ ` ″ ┃ ⌫ Retour┃
-# │ $ – │ " — │ « < │ » > │ ( [ │ ) ] │ @ ^ │ + ± │ - − │ / ÷ │ * × │ = ≠ │ % ‰ ┃  arrière┃
-# ┢━━━━━┷━┱───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┺━┳━━━━━━━┫
-# ┃       ┃ B ¦ │ É ˝ │ P § │ O Œ │ È ` │ !   │ V   │ D Ð │ L   │ J IJ │ Z Ə │ W   ┃Entrée ┃
-# ┃Tab ↹  ┃ b | │ é ˊ │ p & │ o œ │ è ` │ ˆ ¡ │ v ˇ │ d ð │ l / │ j ij │ z ə │ w ̆ ┃   ⏎   ┃
-# ┣━━━━━━━┻┱────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┺┓      ┃
-# ┃        ┃ A Æ │ U Ù │ I ˙ │ E ¤ │ ; ̛ │ C ſ │ T Þ │ S ẞ │ R ™ │ N   │ M º │ Ç , ┃      ┃
-# ┃Maj ⇬   ┃ a æ │ u ù │ i ̈ │ e € │ , ’ │ c © │ t þ │ s ß │ r ® │ n ˜ │ m ¯ │ ç ¸ ┃      ┃
-# ┣━━━━━━━┳┹────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┲┷━━━━━┻━━━━━━┫
-# ┃       ┃ Ê   │ À   │ Y ‘ │ X ’ │ : · │ K   │ ? ̉ │ Q ̣ │ G   │ H ‡ │ F ª ┃             ┃
-# ┃Shift ⇧┃ ê / │ à \ │ y { │ x } │ . … │ k ~ │ ' ¿ │ q ˚ │ g µ │ h † │ f ˛ ┃Shift ⇧      ┃
-# ┣━━━━━━━╋━━━━━┷━┳━━━┷━━━┱─┴─────┴─────┴─────┴─────┴─────┴───┲━┷━━━━━╈━━━━━┻━┳━━━━━━━┳━━━┛
-# ┃       ┃       ┃       ┃ Espace inséc.   Espace inséc. fin ┃       ┃       ┃       ┃
-# ┃Ctrl   ┃Meta   ┃Alt    ┃ ␣ (Espace)      _               ␣ ┃AltGr ⇮┃Menu   ┃Ctrl   ┃
-# ┗━━━━━━━┻━━━━━━━┻━━━━━━━┹───────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┛
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
 
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
 
-# First row
-## keycode  41 = dollar numbersign       U+2013  U+00b6
-dollar        0x29
-numbersign    0x29  shift
-U2013         0x29        altgr
-U00b6         0x29  shift altgr
-
-## keycode   2 = +quotedbl +one          U+2014  U+201e
-quotedbl      0x2
-one           0x2  shift
-U2014         0x2        altgr
-U201e         0x2  shift altgr
-
-## keycode   3 = +guillemotleft  +two     less    U+201c
-guillemotleft  0x3
-two           0x3  shift
-less          0x3        altgr
-U201c         0x3  shift altgr
-
-## keycode   4 = +guillemotright +three  greater U+201d
-guillemotright  0x4
-three         0x4  shift
-greater       0x4        altgr
-U201d         0x4  shift altgr
-
-## keycode   5 = +parenleft +four        bracketleft  U+2264
-parenleft     0x5
-four          0x5  shift
-bracketleft   0x5        altgr
-U2264         0x5  shift altgr
-
-## keycode   6 = +parenright +five       bracketright  U+2265
-parenright    0x6
-five          0x6  shift
-bracketright  0x6        altgr
-U2265         0x6  shift altgr
-
-## keycode   7 = +at       +six          asciicircum
-at            0x7
-six           0x7  shift
-asciicircum   0x7        altgr
-
-## keycode   8 = +plus     +seven        U+00b1  U+00ac
-plus          0x8
-seven         0x8  shift
-U00b1         0x8        altgr
-U00ac         0x8  shift altgr
-
-## keycode   9 = +minus    +eight        U+2212  U+00bc
-minus         0x9
-eight         0x9  shift
-U2212         0x9        altgr
-U00bc         0x9  shift altgr
-
-## keycode  10 = +slash    +nine         U+00f7  U+00bd
-slash         0xa
-nine          0xa  shift
-U00f7         0xa        altgr
-U00bd         0xa  shift altgr
-
-## keycode  11 = +asterisk +zero         U+00d7  U+00be
-asterisk      0xb
-zero          0xb  shift
-U00d7         0xb        altgr
-U00be         0xb  shift altgr
-
-## keycode  12 = equal     U+00b0        U+2260  U+2032
-equal         0xc
-U00b0         0xc  shift
-U2260         0xc        altgr
-U2032         0xc  shift altgr
-
-## keycode  13 = percent   grave         U+2030  U+2033
-percent       0xd
-grave         0xd  shift
-U2030         0xd        altgr
-U2033         0xd  shift altgr
-
-
-# Second row
-
-# simplified letter definitions notation :
-## keycode 16 = b
-b             0x10  addupper
-## keycode 18 = p
-p             0x12  addupper
-## keycode 19 = o
-o             0x13  addupper
-## keycode 22 = v
-v             0x16  addupper
-## keycode 23 = d
-d             0x17  addupper
-## keycode 24 = l
-l             0x18  addupper
-## keycode 25 = j
-j             0x19  addupper
-## keycode 26 = z
-z             0x1a  addupper
-## keycode 27 = w
-w             0x1b  addupper
-
-# then, add specific definitions
-##                    AltGr keycode  16 = bar
-bar           0x10        altgr
-##              Shift AltGr keycode  16 = brokenbar
-brokenbar     0x10  shift altgr
-
-## keycode 17 = +eacute +Eacute dead_acute
-eacute        0x11
-Eacute        0x11  shift
-dead_acute    0x11        altgr
-
-##                    AltGr keycode  18 = ampersand
-ampersand     0x12        altgr
-##              Shift AltGr keycode  18 = U+00a7
-U00a7         0x12  shift altgr
-
-##                    AltGr keycode  19 = +U+0153
-U+0153        0x13        altgr
-##              Shift AltGr keycode  19 = +U+0152
-U+0152        0x13  shift altgr
-
-## keycode 20 = +egrave +Egrave dead_grave grave # no Meta !
-egrave        0x14
-Egrave        0x14  shift
-dead_grave    0x14        altgr
-
-## keycode 21 = dead_circumflex exclam exclamdown
-dead_circumflex  0x15
-exclam        0x15  shift
-exclamdown    0x15        altgr
-
-##                    AltGr keycode  22 = dead_caron
-dead_caron    0x16        altgr
-
-##                    AltGr keycode  23 = eth
-eth           0x17        altgr
-##              Shift AltGr keycode  23 = ETH
-ETH           0x17  shift altgr
-
-##                    AltGr keycode  25 = +U+0133
-U+0133        0x19        altgr
-##              Shift AltGr keycode  25 = +U+0132
-U+0132        0x19  shift altgr
-
-##                    AltGr keycode  26 = +U+0259
-U+0259        0x1a        altgr
-##              Shift AltGr keycode  26 = +U+018f
-U+018f        0x1a  shift altgr
-
-
-
-# Third row
-
-# simplified letter definitions notation :
-## keycode 30 = a
-a             0x1e  addupper
-## keycode 31 = u
-u             0x1f  addupper
-## keycode 32 = i
-i             0x20  addupper
-## keycode 33 = e
-e             0x21  addupper
-## keycode 35 = c
-c             0x23  addupper
-## keycode 36 = t
-t             0x24  addupper
-## keycode 37 = s
-s             0x25  addupper
-## keycode 38 = r
-r             0x26  addupper
-## keycode 39 = n
-n             0x27  addupper
-## keycode 40 = m
-m             0x28  addupper
-
-# then, add specific definitions
-##                    AltGr keycode  30 = +ae
-ae            0x1e        altgr
-##              Shift AltGr keycode  30 = +AE
-AE            0x1e  shift altgr
-
-##                    AltGr keycode  31 = +ugrave
-ugrave        0x1f        altgr
-##              Shift AltGr keycode  31 = +Ugrave
-Ugrave        0x1f  shift altgr
-
-##                    AltGr keycode  32 = dead_diaeresis
-dead_diaeresis  0x20        altgr
-
-
-##                    AltGr keycode  33 = U+20ac
-U20ac         0x21        altgr
-
-## keycode 34 = comma semicolon U+2019 +U+031b
-comma         0x22
-semicolon     0x22  shift
-U2019         0x22        altgr
-U+031b        0x22  shift altgr
-
-##                    AltGr keycode  35 = copyright
-copyright     0x23        altgr
-##              Shift AltGr keycode  35 = U+017f
-U017f         0x23  shift altgr
-
-##                    AltGr keycode  36 = +thorn
-thorn         0x24        altgr
-##              Shift AltGr keycode  36 = +THORN
-THORN         0x24  shift altgr
-
-##                    AltGr keycode  37 = +ssharp
-ssharp        0x25        altgr
-##              Shift AltGr keycode  37 = U+1e9e
-U1e9e         0x25  shift altgr
-
-##                    AltGr keycode  38 = registered
-registered    0x26        altgr
-##              Shift AltGr keycode  38 = U+2122
-U2122         0x26  shift altgr
-
-##                    AltGr keycode  39 = dead_tilde
-dead_tilde    0x27        altgr
-
-##              Shift AltGr keycode  40 = masculine
-masculine     0x28  shift altgr
-
-## keycode 43 = +ccedilla +Ccedilla dead_cedilla
-ccedilla      0x2b
-Ccedilla      0x2b  shift
-dead_cedilla  0x2b        altgr
-
-
-# Fourth row
-
-# simplified letter definitions notation :
-## keycode 45 = y
-y             0x2d  addupper
-## keycode 46 = x
-x             0x2e  addupper
-## keycode 48 = k
-k             0x30  addupper
-## keycode 50 = q
-q             0x32  addupper
-## keycode 51 = g
-g             0x33  addupper
-## keycode 52 = h
-h             0x34  addupper
-## keycode 53 = f
-f             0x35  addupper
-
-# then, add specific definitions
-## keycode 86 = +ecircumflex +Ecircumflex slash slash
-ecircumflex   0x56
-Ecircumflex   0x56  shift
-
-## keycode 44 = +agrave +Agrave backslash
-agrave        0x2c
-Agrave        0x2c  shift
-backslash     0x2c        altgr
-
-##                    AltGr keycode  45 = braceleft
-braceleft     0x2d        altgr
-##              Shift AltGr keycode  45 = U+2018
-U2018         0x2d  shift altgr
-
-##                    AltGr keycode  46 = braceright
-braceright    0x2e        altgr
-
-## keycode 47 = period colon U+2026 periodcentered
-period        0x2f
-colon         0x2f  shift
-U2026         0x2f        altgr
-periodcentered  0x2f  shift altgr
-
-##                    AltGr keycode  48 = asciitilde
-asciitilde    0x30        altgr
-##              Shift AltGr keycode  48 = U+2328
-U2328         0x30  shift altgr
-
-## keycode 49 = apostrophe question questiondown +U+0309
-apostrophe    0x31
-question      0x31  shift
-questiondown  0x31        altgr
-U+0309        0x31  shift altgr
-
-##                    AltGr keycode  51 = mu
-mu            0x33        altgr
-
-##                    AltGr keycode  52 = U+2020
-U2020         0x34        altgr
-##              Shift AltGr keycode  52 = U+2021
-U2021         0x34  shift altgr
-
-##              Shift AltGr keycode  53 = ordfeminine
-ordfeminine   0x35  shift altgr
-
-
-
-## keycode 57 = space nobreakspace underscore U+202f
-space         0x39
-nobreakspace  0x39  shift
-underscore    0x39        altgr
-U202f         0x39  shift altgr
+# quirks section end
diff --git a/pc-bios/keymaps/cz b/pc-bios/keymaps/cz
index 6584bfb..46b3775 100644
--- a/pc-bios/keymaps/cz
+++ b/pc-bios/keymaps/cz
@@ -1,94 +1,837 @@
-include common
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : cz
+#    variant : -
+#    options : -
 
-# Czech qwertz layout
-# comments are czech descriptions of the characters
+# name: "Czech"
 
-# -----------
-#  First row
-# -----------
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
 
-# strednik, kolecko
-semicolon 0x29
-dead_abovering 0x29 shift
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
 
-# numbers
-plus 0x2
-1 0x2 shift
-ecaron 0x3
-2 0x3 shift
-scaron 0x4
-3 0x4 shift
-ccaron 0x5
-4 0x5 shift
-rcaron 0x6
-5 0x6 shift
-zcaron 0x7
-6 0x7 shift
-yacute 0x8
-7 0x8 shift
-aacute 0x9
-8 0x9 shift
-iacute 0xa
-9 0xa shift
-eacute 0xb
-0 0xb shift
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+plus 0x02
+1 0x02 shift
+exclam 0x02 altgr
+dead_tilde 0x02 shift altgr
 
-# rovnitko
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+ecaron 0x03
+2 0x03 shift
+at 0x03 altgr
+dead_caron 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+scaron 0x04
+3 0x04 shift
+numbersign 0x04 altgr
+dead_circumflex 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+ccaron 0x05
+4 0x05 shift
+dollar 0x05 altgr
+dead_breve 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+rcaron 0x06
+5 0x06 shift
+percent 0x06 altgr
+dead_abovering 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+zcaron 0x07
+6 0x07 shift
+asciicircum 0x07 altgr
+dead_ogonek 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+yacute 0x08
+7 0x08 shift
+ampersand 0x08 altgr
+dead_grave 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+aacute 0x09
+8 0x09 shift
+asterisk 0x09 altgr
+dead_abovedot 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+iacute 0x0a
+9 0x0a shift
+braceleft 0x0a altgr
+dead_acute 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+eacute 0x0b
+0 0x0b shift
+braceright 0x0b altgr
+dead_doubleacute 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 equal 0x0c
 percent 0x0c shift
+backslash 0x0c altgr
+dead_diaeresis 0x0c shift altgr
 
-# carka, hacek
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 dead_acute 0x0d
 dead_caron 0x0d shift
+dead_macron 0x0d altgr
+dead_cedilla 0x0d shift altgr
 
-# ------------
-#  Second row
-# ------------
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
 
-z 0x15 addupper
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
 
-# u s carkou, zpetne lomitko
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+backslash 0x10 altgr
+Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+bar 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
+EuroSign 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+paragraph 0x13 altgr
+registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+tslash 0x14 altgr
+Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+z 0x15
+Z 0x15 shift
+leftarrow 0x15 altgr
+yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+downarrow 0x16 altgr
+uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+rightarrow 0x17 altgr
+idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+oslash 0x18 altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+thorn 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 uacute 0x1a
 slash 0x1a shift
+bracketleft 0x1a altgr
+division 0x1a shift altgr
 
-# prava zavorka, leva zavorka
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 parenright 0x1b
 parenleft 0x1b shift
+bracketright 0x1b altgr
+multiply 0x1b shift altgr
 
-# -----------
-#  Third row
-# -----------
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
 
-# u s krouzkem, uvozovky
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+asciitilde 0x1e altgr
+AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+dstroke 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+Dstroke 0x20 altgr
+ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+bracketleft 0x21 altgr
+ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+bracketright 0x22 altgr
+ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+grave 0x23 altgr
+Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+apostrophe 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+lstroke 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+Lstroke 0x26 altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 uring 0x27
 quotedbl 0x27 shift
+dollar 0x27 altgr
+dead_doubleacute 0x27 shift altgr
 
-# paragraf, vykricnik
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 section 0x28
 exclam 0x28 shift
+apostrophe 0x28 altgr
+ssharp 0x28 shift altgr
 
-# vodorovna dvojtecka, apostrof
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+semicolon 0x29
+dead_abovering 0x29 shift
+grave 0x29 altgr
+asciitilde 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 dead_diaeresis 0x2b
 apostrophe 0x2b shift
+backslash 0x2b altgr
+bar 0x2b shift altgr
 
-# ------------
-#  Fourth row
-# ------------
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+y 0x2c
+Y 0x2c shift
+degree 0x2c altgr
+less 0x2c shift altgr
 
-# zpetne lomitko, roura
-backslash 0x2b
-bar 0x2b shift
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+numbersign 0x2d altgr
+greater 0x2d shift altgr
 
-y 0x2c addupper
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+ampersand 0x2e altgr
+copyright 0x2e shift altgr
 
-# carka, otaznik
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+at 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+braceleft 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+braceright 0x31 altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+asciicircum 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 question 0x33 shift
+less 0x33 altgr
+multiply 0x33 shift altgr
 
-# tecka, dvojtecka
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
+greater 0x34 altgr
+division 0x34 shift altgr
 
-# minus, podtrzitko
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
+asterisk 0x35 altgr
+dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+backslash 0x56
+bar 0x56 shift
+slash 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/da b/pc-bios/keymaps/da
index 3884dcf..f7cdad7 100644
--- a/pc-bios/keymaps/da
+++ b/pc-bios/keymaps/da
@@ -1,120 +1,836 @@
-# generated from XKB map dk
-include common
-map 0x406
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : dk
+#    variant : -
+#    options : -
+
+# name: "Danish"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 exclamdown 0x02 altgr
 onesuperior 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 at 0x03 altgr
 twosuperior 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 sterling 0x04 altgr
 threesuperior 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 currency 0x05 shift
 dollar 0x05 altgr
 onequarter 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 cent 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
 yen 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
 division 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 bracketleft 0x09 altgr
 guillemotleft 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
 guillemotright 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 plus 0x0c
 question 0x0c shift
 plusminus 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 dead_acute 0x0d
 dead_grave 0x0d shift
 bar 0x0d altgr
 brokenbar 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
 lstroke 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
 cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 registered 0x13 altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 thorn 0x14 altgr
 THORN 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oe 0x18 altgr
 OE 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 aring 0x1a
 Aring 0x1a shift
 dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dead_diaeresis 0x1b
 dead_circumflex 0x1b shift
 dead_tilde 0x1b altgr
 dead_caron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ordfeminine 0x1e altgr
 masculine 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
 section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 ae 0x27
 AE 0x27 shift
+dead_acute 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 oslash 0x28
-Ooblique 0x28 shift
+Oslash 0x28 shift
+dead_circumflex 0x28 altgr
 dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 onehalf 0x29
 section 0x29 shift
 threequarters 0x29 altgr
 paragraph 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 apostrophe 0x2b
 asterisk 0x2b shift
 dead_doubleacute 0x2b altgr
 multiply 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 copyright 0x2e altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
 dead_cedilla 0x33 altgr
 dead_ogonek 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
 periodcentered 0x34 altgr
 dead_abovedot 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
-hyphen 0x35 altgr
-macron 0x35 shift altgr
-nobreakspace 0x39 altgr
+dead_belowdot 0x35 altgr
+dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 less 0x56
 greater 0x56 shift
 backslash 0x56 altgr
 notsign 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/de b/pc-bios/keymaps/de
index ed929c7..d0b4715 100644
--- a/pc-bios/keymaps/de
+++ b/pc-bios/keymaps/de
@@ -1,114 +1,839 @@
-# generated from XKB map de
-include common
-map 0x407
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : de
+#    variant : -
+#    options : -
+
+# name: "German"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 twosuperior 0x03 altgr
 oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 section 0x04 shift
 threesuperior 0x04 altgr
 sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 onequarter 0x05 altgr
 currency 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-threequarters 0x07 altgr
+notsign 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
+degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 ssharp 0x0c
 question 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
-acute 0x0d
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 dead_acute 0x0d
-grave 0x0d shift
 dead_grave 0x0d shift
 dead_cedilla 0x0d altgr
 dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
 at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+lstroke 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
-z 0x15 addupper
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+z 0x15
+Z 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 udiaeresis 0x1a
 Udiaeresis 0x1a shift
 dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 plus 0x1b
 asterisk 0x1b shift
 asciitilde 0x1b altgr
-dead_tilde 0x1b altgr
-dead_macron 0x1b shift altgr
+macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+U017F 0x1f altgr
+U1E9E 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_belowdot 0x24 altgr
+dead_abovedot 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 odiaeresis 0x27
 Odiaeresis 0x27 shift
 dead_doubleacute 0x27 altgr
+dead_belowdot 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 adiaeresis 0x28
 Adiaeresis 0x28 shift
+dead_circumflex 0x28 altgr
 dead_caron 0x28 shift altgr
-asciicircum 0x29
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 dead_circumflex 0x29
 degree 0x29 shift
-notsign 0x29 altgr
+U2032 0x29 altgr
+U2033 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 numbersign 0x2b
 apostrophe 0x2b shift
+rightsinglequotemark 0x2b altgr
 dead_breve 0x2b shift altgr
-y 0x2c addupper
-guillemotleft 0x2c altgr
-guillemotright 0x2d altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+y 0x2c
+Y 0x2c shift
+guillemotright 0x2c altgr
+U203A 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+guillemotleft 0x2d altgr
+U2039 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
-leftdoublequotemark 0x2f altgr
-rightdoublequotemark 0x30 altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+doublelowquotemark 0x2f altgr
+singlelowquotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+leftdoublequotemark 0x30 altgr
+leftsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+rightdoublequotemark 0x31 altgr
+rightsinglequotemark 0x31 shift altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
-horizconnector 0x33 altgr
+periodcentered 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
-periodcentered 0x34 altgr
+U2026 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
-dead_belowdot 0x35 altgr
-dead_abovedot 0x35 shift altgr
+endash 0x35 altgr
+emdash 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/de-ch b/pc-bios/keymaps/de-ch
index 852f8b8..ad37f6c 100644
--- a/pc-bios/keymaps/de-ch
+++ b/pc-bios/keymaps/de-ch
@@ -1,169 +1,836 @@
-# rdesktop Swiss-German (de-ch) keymap file
-# 2003-06-03 by noldi@tristar.ch
 #
-include common
-map 0x00000807
-#
-# Scan Code 1
-section 0x29
-degree 0x29 shift
-notsign 0x29 altgr inhibit
-#
-# Scan Code 2
-plus 0x2 shift
-brokenbar 0x02 altgr
-#
-# Scan Code 3
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : ch
+#    variant : -
+#    options : -
+
+# name: "German (Switzerland)"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
+plus 0x02 shift
+bar 0x02 altgr
+exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 at 0x03 altgr
-#
-# Scan Code 4
+oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 asterisk 0x04 shift
 numbersign 0x04 altgr
-#
-# Scan Code 5
+sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 ccedilla 0x05 shift
-onequarter 0x05 altgr inhibit
-#
-# Scan Code 6
+onequarter 0x05 altgr
+dollar 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
-onehalf 0x06 altgr inhibit
-#
-# Scan Code 7
+onehalf 0x06 altgr
+threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
 notsign 0x07 altgr
-#
-# Scan Code 8
+fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 bar 0x08 altgr
-#
-# Scan Code 9
+seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 cent 0x09 altgr
-#
-# Scan Code 10
+trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
-#
-# Scan Code 11
+bracketright 0x0a altgr
+plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
-braceright 0x0b altgr inhibit
-#
-# Scan Code 12
+braceright 0x0b altgr
+degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 apostrophe 0x0c
 question 0x0c shift
 dead_acute 0x0c altgr
-#
-# Scan Code 13
+questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 dead_circumflex 0x0d
 dead_grave 0x0d shift
 dead_tilde 0x0d altgr
-#
-# Scan Code 19
+dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
+Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+lstroke 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
-#
-# Scan Code 22
-z 0x15 addupper
-#
-# Scan Code 27
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+paragraph 0x13 altgr
+registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+tslash 0x14 altgr
+Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+z 0x15
+Z 0x15 shift
+leftarrow 0x15 altgr
+yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+downarrow 0x16 altgr
+uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+rightarrow 0x17 altgr
+idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+oe 0x18 altgr
+OE 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+thorn 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 udiaeresis 0x1a
 egrave 0x1a shift
 bracketleft 0x1a altgr
-#
-# Scan Code 28
+dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dead_diaeresis 0x1b
 exclam 0x1b shift
 bracketright 0x1b altgr
-#
-# Scan Code 40
+dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+ae 0x1e altgr
+AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+eth 0x20 altgr
+ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+dstroke 0x21 altgr
+ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+eng 0x22 altgr
+ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+hstroke 0x23 altgr
+Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 odiaeresis 0x27
 eacute 0x27 shift
-#
-# Scan Code 41
+dead_acute 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 adiaeresis 0x28
 agrave 0x28 shift
 braceleft 0x28 altgr
-#
-# Scan Code 42 (only on international keyboards)
+dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+section 0x29
+degree 0x29 shift
+notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 dollar 0x2b
 sterling 0x2b shift
 braceright 0x2b altgr
-#
-# Scan Code 45 (only on international keyboards)
-backslash 0x56 altgr
-#
-# Scan Code 46
-y 0x2c addupper
-#
-# Scan Code 53
+dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+y 0x2c
+Y 0x2c shift
+guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+cent 0x2e altgr
+copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+mu 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
-#
-# Scan Code 54
+horizconnector 0x33 altgr
+multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
-#
-# Scan Code 55
+periodcentered 0x34 altgr
+division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
+dead_belowdot 0x35 altgr
+dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+backslash 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
 #
-# Suppress Windows unsupported AltGr keys
+# quirks section start
 #
-# Scan Code 17
-paragraph 0x10 altgr inhibit
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
 #
-# Scan Code 21
-tslash 0x14 altgr inhibit
-#
-# Scan Code 22
-leftarrow 0x15 altgr inhibit
-#
-# Scan Code 23
-downarrow 0x16 altgr inhibit
-#
-# Scan Code 24
-rightarrow 0x17 altgr inhibit
-#
-# Scan Code 25
-oslash 0x18 altgr inhibit
-#
-# Scan Code 26
-thorn 0x19 altgr inhibit
-#
-# Scan Code 31
-ae 0x1e altgr inhibit
-#
-# Scan Code 32
-ssharp 0x1f altgr inhibit
-#
-# Scan Code 33
-eth 0x20 altgr inhibit
-#
-# Scan Code 34
-dstroke 0x21 altgr inhibit
-#
-# Scan Code 35
-eng 0x22 altgr inhibit
-#
-# Scan Code 36
-hstroke 0x23 altgr inhibit
-#
-# Scan Code 38
-kra 0x25 altgr inhibit
-#
-# Scan Code 39
-lstroke 0x26 altgr inhibit
-#
-# Scan Code 46
-guillemotleft 0x2c altgr inhibit
-#
-# Scan Code 47
-guillemotright 0x2d altgr inhibit
-#
-# Scan Code 49
-leftdoublequotemark 0x2f altgr inhibit
-#
-# Scan Code 50
-rightdoublequotemark 0x30 altgr inhibit
-#
-# Scan Code 52
-mu 0x32 altgr inhibit
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/en-gb b/pc-bios/keymaps/en-gb
index b45f06c..999cca7 100644
--- a/pc-bios/keymaps/en-gb
+++ b/pc-bios/keymaps/en-gb
@@ -1,119 +1,835 @@
-# generated from XKB map gb
-include common
-map 0x809
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : gb
+#    variant : -
+#    options : -
+
+# name: "English (UK)"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 twosuperior 0x03 altgr
 oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 sterling 0x04 shift
 threesuperior 0x04 altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 EuroSign 0x05 altgr
+onequarter 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 asciicircum 0x07 shift
 threequarters 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 ampersand 0x08 shift
 braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
 bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenleft 0x0a shift
 bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 parenright 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
 dead_cedilla 0x0d altgr
 dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
 at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
 lstroke 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 bracketleft 0x1a
 braceleft 0x1a shift
 dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 bracketright 0x1b
 braceright 0x1b shift
 dead_tilde 0x1b altgr
 dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
 section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 semicolon 0x27
 colon 0x27 shift
 dead_acute 0x27 altgr
 dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 apostrophe 0x28
 at 0x28 shift
 dead_circumflex 0x28 altgr
 dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 grave 0x29
 notsign 0x29 shift
 bar 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 numbersign 0x2b
 asciitilde 0x2b shift
 dead_grave 0x2b altgr
 dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
 less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
 greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 less 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 greater 0x34 shift
 periodcentered 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 slash 0x35
 question 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 backslash 0x56
 bar 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+Multi_key 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/en-us b/pc-bios/keymaps/en-us
index f5784bb..a70e03a 100644
--- a/pc-bios/keymaps/en-us
+++ b/pc-bios/keymaps/en-us
@@ -1,35 +1,747 @@
-# generated from XKB map us
-include common
-map 0x409
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : us
+#    variant : -
+#    options : -
+
+# name: "English (US)"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 at 0x03 shift
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 asciicircum 0x07 shift
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 ampersand 0x08 shift
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenleft 0x0a shift
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 parenright 0x0b shift
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 bracketleft 0x1a
 braceleft 0x1a shift
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 bracketright 0x1b
 braceright 0x1b shift
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 semicolon 0x27
 colon 0x27 shift
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 apostrophe 0x28
 quotedbl 0x28 shift
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 grave 0x29
 asciitilde 0x29 shift
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 backslash 0x2b
 bar 0x2b shift
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 less 0x33 shift
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 greater 0x34 shift
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 slash 0x35
 question 0x35 shift
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/es b/pc-bios/keymaps/es
index 0c29eec..53e66e8 100644
--- a/pc-bios/keymaps/es
+++ b/pc-bios/keymaps/es
@@ -1,105 +1,835 @@
-# generated from XKB map es
-include common
-map 0x40a
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : es
+#    variant : -
+#    options : -
+
+# name: "Spanish"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 bar 0x02 altgr
+exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 at 0x03 altgr
 oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 periodcentered 0x04 shift
 numbersign 0x04 altgr
 sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 asciitilde 0x05 altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
 notsign 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
+braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
+bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
+bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
+braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 apostrophe 0x0c
 question 0x0c shift
+backslash 0x0c altgr
+questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 exclamdown 0x0d
 questiondown 0x0d shift
+dead_tilde 0x0d altgr
+asciitilde 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
 lstroke 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 dead_grave 0x1a
 dead_circumflex 0x1a shift
 bracketleft 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 plus 0x1b
 asterisk 0x1b shift
 bracketright 0x1b altgr
 dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
 section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
+ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 ntilde 0x27
 Ntilde 0x27 shift
+asciitilde 0x27 altgr
 dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 dead_acute 0x28
 dead_diaeresis 0x28 shift
 braceleft 0x28 altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 masculine 0x29
 ordfeminine 0x29 shift
 backslash 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 ccedilla 0x2b
 Ccedilla 0x2b shift
 braceright 0x2b altgr
 dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
-less 0x56
-greater 0x56 shift
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
+periodcentered 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/et b/pc-bios/keymaps/et
index 85541a3..7bed679 100644
--- a/pc-bios/keymaps/et
+++ b/pc-bios/keymaps/et
@@ -1,85 +1,745 @@
-map 0x00000425
-include common
-
 #
-# Top row
-#
-dead_caron 0x29
-dead_tilde 0x29 shift
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : et
+#    variant : -
+#    options : -
 
-# 1
-exclam 0x2 shift
+# name: "Amharic"
 
-# 2
-quotedbl 0x3 shift
-at 0x3 altgr
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
 
-# 3
-numbersign 0x4 shift
-sterling 0x4 altgr
-# 4
-currency 0x5 shift
-dollar 0x5 altgr
-# 5
-percent 0x6 shift
-# 6
-ampersand 0x7 shift
-# 7
-slash 0x8 shift
-braceleft 0x8 altgr
-# 8
-parenleft 0x9 shift
-bracketleft 0x9 altgr
-# 9
-parenright 0xa shift
-bracketright 0xa altgr
-# 0
-equal 0xb shift
-braceright 0xb altgr
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
 
-plus 0xc
-question 0xc shift
-backslash 0xc altgr
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+U1369 0x02
+U1372 0x02 shift
 
-acute 0xd
-dead_acute 0xd
-grave 0xd shift
-dead_grave 0xd shift
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+U136A 0x03
+U1373 0x03 shift
 
-#
-# QWERTY first row
-#
-EuroSign 0x12 altgr
-udiaeresis 0x1a
-Udiaeresis 0x1a shift
-otilde 0x1b
-Otilde 0x1b shift
-section 0x1b altgr
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+U136B 0x04
+U1374 0x04 shift
 
-#
-# QWERTY second row
-#
-scaron 0x1f altgr
-Scaron 0x1f altgr shift
-odiaeresis 0x27
-Odiaeresis 0x27 shift
-adiaeresis 0x28
-Adiaeresis 0x28 shift
-asciicircum 0x28 altgr
-apostrophe 0x2b
-asterisk 0x2b shift
-onehalf 0x2b altgr
-#
-# QWERTY third row
-#
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+U136C 0x05
+U1375 0x05 shift
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+U136D 0x06
+U1376 0x06 shift
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+U136E 0x07
+U1377 0x07 shift
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+U136F 0x08
+U1378 0x08 shift
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+U1370 0x09
+U1379 0x09 shift
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+U1371 0x0a
+U137A 0x0a shift
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+U137B 0x0b
+U137C 0x0b shift
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
+minus 0x0c
+underscore 0x0c shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+equal 0x0d
+plus 0x0d shift
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+U1240 0x10
+U1250 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+U12C8 0x11
+VoidSymbol 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+UFE69 0x12
+UFE70 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+U1228 0x13
+VoidSymbol 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+U1270 0x14
+U1320 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+U12E8 0x15
+VoidSymbol 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+UFE75 0x16
+UFE76 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+UFE71 0x17
+UFE72 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+UFE73 0x18
+UFE74 0x18 shift
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+U1350 0x19
+U1330 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+U1340 0x1a
+U1338 0x1a shift
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+U1328 0x1b
+U1280 0x1b shift
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+UFE67 0x1e
+UFE68 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+U1230 0x1f
+U1220 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+U12F0 0x20
+U12F8 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+U1348 0x21
+VoidSymbol 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+U1308 0x22
+U1318 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+U1200 0x23
+U1210 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+U1300 0x24
+VoidSymbol 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+U12A8 0x25
+U12B8 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+U1208 0x26
+VoidSymbol 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+U1362 0x27
+U1361 0x27 shift
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+U1366 0x28
+U1365 0x28 shift
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
+VoidSymbol 0x2b
+U2010 0x2b shift
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+U12D8 0x2c
+U12E0 0x2c shift
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+U12A0 0x2d
+U12D0 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+U1278 0x2e
+UFE78 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+U1238 0x2f
+U1268 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+U1260 0x30
+VoidSymbol 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+U1290 0x31
+U1298 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+U1218 0x32
+VoidSymbol 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
+U1363 0x33
+VoidSymbol 0x33 shift
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
+U1364 0x34
+VoidSymbol 0x34 shift
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+U1367 0x35
+question 0x35 shift
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 less 0x56
 greater 0x56 shift
 bar 0x56 altgr
-zcaron 0x2c altgr
-Zcaron 0x2c altgr shift
-comma 0x33
-semicolon 0x33 shift
-period 0x34
-colon 0x34 shift
-minus 0x35
-underscore 0x35 shift
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym ISO_Next_Group)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/fi b/pc-bios/keymaps/fi
index 4be7586..1c7653d 100644
--- a/pc-bios/keymaps/fi
+++ b/pc-bios/keymaps/fi
@@ -1,122 +1,810 @@
-# generated from XKB map se_FI
-include common
-map 0x40b
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : fi
+#    variant : -
+#    options : -
+
+# name: "Finnish"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
-exclamdown 0x02 altgr
-onesuperior 0x02 shift altgr
+exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 at 0x03 altgr
-twosuperior 0x03 shift altgr
+rightdoublequotemark 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 sterling 0x04 altgr
-threesuperior 0x04 shift altgr
+guillemotright 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 currency 0x05 shift
 dollar 0x05 altgr
-onequarter 0x05 shift altgr
+guillemotleft 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
-onehalf 0x06 altgr
-cent 0x06 shift altgr
+permille 0x06 altgr
+leftdoublequotemark 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-yen 0x07 altgr
-fiveeighths 0x07 shift altgr
+singlelowquotemark 0x07 altgr
+doublelowquotemark 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
-division 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 bracketleft 0x09 altgr
-guillemotleft 0x09 shift altgr
+less 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
-guillemotright 0x0a shift altgr
+greater 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 plus 0x0c
 question 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 dead_acute 0x0d
 dead_grave 0x0d shift
-plusminus 0x0d altgr
-notsign 0x0d shift altgr
-at 0x10 altgr
-Greek_OMEGA 0x10 shift altgr
-lstroke 0x11 altgr
-Lstroke 0x11 shift altgr
+dead_cedilla 0x0d altgr
+dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
-cent 0x12 shift altgr
-registered 0x13 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 thorn 0x14 altgr
 THORN 0x14 shift altgr
-leftarrow 0x15 altgr
-yen 0x15 shift altgr
-downarrow 0x16 altgr
-uparrow 0x16 shift altgr
-rightarrow 0x17 altgr
-idotless 0x17 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+idotless 0x17 altgr
+bar 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oe 0x18 altgr
 OE 0x18 shift altgr
-thorn 0x19 altgr
-THORN 0x19 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+dead_horn 0x19 altgr
+dead_hook 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 aring 0x1a
 Aring 0x1a shift
-dead_diaeresis 0x1a altgr
+dead_doubleacute 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dead_diaeresis 0x1b
 dead_circumflex 0x1b shift
 dead_tilde 0x1b altgr
-dead_caron 0x1b shift altgr
-ordfeminine 0x1e altgr
-masculine 0x1e shift altgr
+dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+schwa 0x1e altgr
+SCHWA 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
-section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
-dstroke 0x21 altgr
-ordfeminine 0x21 shift altgr
-eng 0x22 altgr
-ENG 0x22 shift altgr
-hstroke 0x23 altgr
-Hstroke 0x23 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
-ampersand 0x25 shift altgr
-lstroke 0x26 altgr
-Lstroke 0x26 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+dead_stroke 0x26 altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 odiaeresis 0x27
 Odiaeresis 0x27 shift
 oslash 0x27 altgr
-Ooblique 0x27 shift altgr
+Oslash 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 adiaeresis 0x28
 Adiaeresis 0x28 shift
 ae 0x28 altgr
 AE 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 section 0x29
 onehalf 0x29 shift
-paragraph 0x29 altgr
-threequarters 0x29 shift altgr
+dead_stroke 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 apostrophe 0x2b
 asterisk 0x2b shift
-acute 0x2b altgr
-multiply 0x2b shift altgr
-guillemotleft 0x2c altgr
-guillemotright 0x2d altgr
-copyright 0x2e altgr
-leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
-rightdoublequotemark 0x30 altgr
-apostrophe 0x30 shift altgr
+dead_caron 0x2b altgr
+dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+ezh 0x2c altgr
+EZH 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+multiply 0x2d altgr
+periodcentered 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+eng 0x31 altgr
+ENG 0x31 shift altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
-masculine 0x32 shift altgr
+emdash 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
-dead_cedilla 0x33 altgr
-dead_ogonek 0x33 shift altgr
+rightsinglequotemark 0x33 altgr
+leftsinglequotemark 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
-periodcentered 0x34 altgr
+dead_belowdot 0x34 altgr
 dead_abovedot 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
-hyphen 0x35 altgr
-macron 0x35 shift altgr
+endash 0x35 altgr
+dead_belowcomma 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
 nobreakspace 0x39 altgr
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/fo b/pc-bios/keymaps/fo
index c00d9d4..e69575b 100644
--- a/pc-bios/keymaps/fo
+++ b/pc-bios/keymaps/fo
@@ -1,76 +1,837 @@
-map 0x438
-include common
-
 #
-# Top row
-#
-onehalf 0x29
-section 0x29 shift
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : fo
+#    variant : -
+#    options : -
 
-# 1
-exclam 0x2 shift
+# name: "Faroese"
 
-# 2
-quotedbl 0x3 shift
-at 0x3 altgr
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
 
-# 3
-numbersign 0x4 shift
-sterling 0x4 altgr
-# 4
-currency 0x5 shift
-dollar 0x5 altgr
-# 5
-percent 0x6 shift
-# 6
-ampersand 0x7 shift
-# 7
-slash 0x8 shift
-braceleft 0x8 altgr
-# 8
-parenleft 0x9 shift
-bracketleft 0x9 altgr
-# 9
-parenright 0xa shift
-bracketright 0xa altgr
-# 0
-equal 0xb shift
-braceright 0xb altgr
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
 
-plus 0xc
-question 0xc shift
-plusminus 0xc altgr
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
+exclam 0x02 shift
+exclamdown 0x02 altgr
+onesuperior 0x02 shift altgr
 
-bar 0xd altgr
-dead_acute 0xd
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
+quotedbl 0x03 shift
+at 0x03 altgr
+twosuperior 0x03 shift altgr
 
-#
-# QWERTY first row
-#
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
+numbersign 0x04 shift
+sterling 0x04 altgr
+threesuperior 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
+currency 0x05 shift
+dollar 0x05 altgr
+onequarter 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
+percent 0x06 shift
+onehalf 0x06 altgr
+cent 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
+ampersand 0x07 shift
+yen 0x07 altgr
+fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
+slash 0x08 shift
+braceleft 0x08 altgr
+division 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
+parenleft 0x09 shift
+bracketleft 0x09 altgr
+guillemotleft 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
+parenright 0x0a shift
+bracketright 0x0a altgr
+guillemotright 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
+equal 0x0b shift
+braceright 0x0b altgr
+degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
+plus 0x0c
+question 0x0c shift
+plusminus 0x0c altgr
+questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+dead_acute 0x0d
+dead_grave 0x0d shift
+bar 0x0d altgr
+brokenbar 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
+Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+lstroke 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+registered 0x13 altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+thorn 0x14 altgr
+THORN 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+leftarrow 0x15 altgr
+yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+downarrow 0x16 altgr
+uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+rightarrow 0x17 altgr
+idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+oe 0x18 altgr
+OE 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+thorn 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 aring 0x1a
 Aring 0x1a shift
-eth 0x1b addupper
-asciitilde 0x1b altgr
+dead_diaeresis 0x1a altgr
+dead_circumflex 0x1a shift altgr
 
-#
-# QWERTY second row
-#
-ae 0x27 addupper
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+eth 0x1b
+ETH 0x1b shift
+dead_tilde 0x1b altgr
+dead_caron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+ordfeminine 0x1e altgr
+masculine 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+eth 0x20 altgr
+ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+dstroke 0x21 altgr
+ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+eng 0x22 altgr
+ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+hstroke 0x23 altgr
+Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+ae 0x27
+AE 0x27 shift
+dead_acute 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 oslash 0x28
-Ooblique 0x28 shift
+Oslash 0x28 shift
+dead_circumflex 0x28 altgr
+dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+onehalf 0x29
+section 0x29 shift
+threequarters 0x29 altgr
+paragraph 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 apostrophe 0x2b
 asterisk 0x2b shift
+dead_doubleacute 0x2b altgr
+multiply 0x2b shift altgr
 
-#
-# QWERTY third row
-#
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+copyright 0x2e altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+mu 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
+comma 0x33
+semicolon 0x33 shift
+dead_cedilla 0x33 altgr
+dead_ogonek 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
+period 0x34
+colon 0x34 shift
+periodcentered 0x34 altgr
+dead_abovedot 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+minus 0x35
+underscore 0x35 shift
+hyphen 0x35 altgr
+macron 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+nobreakspace 0x39 altgr
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 less 0x56
 greater 0x56 shift
 backslash 0x56 altgr
-comma 0x33
-semicolon 0x33 shift
-period 0x34
-colon 0x34 shift
-minus 0x35
-underscore 0x35 shift
+notsign 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/fr b/pc-bios/keymaps/fr
index ba5a176..5b25227 100644
--- a/pc-bios/keymaps/fr
+++ b/pc-bios/keymaps/fr
@@ -1,181 +1,837 @@
-include common
-map 0x40c
 #
-# Top row
-#
-twosuperior 0x29
-notsign 0x29 altgr
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : fr
+#    variant : -
+#    options : -
 
+# name: "French"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
 ampersand 0x02
 1 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
 
+# evdev 3 (0x3), QKeyCode "2", number 0x3
 eacute 0x03
 2 0x03 shift
 asciitilde 0x03 altgr
 oneeighth 0x03 shift altgr
 
+# evdev 4 (0x4), QKeyCode "3", number 0x4
 quotedbl 0x04
 3 0x04 shift
 numbersign 0x04 altgr
+sterling 0x04 shift altgr
 
+# evdev 5 (0x5), QKeyCode "4", number 0x5
 apostrophe 0x05
 4 0x05 shift
 braceleft 0x05 altgr
+dollar 0x05 shift altgr
 
+# evdev 6 (0x6), QKeyCode "5", number 0x6
 parenleft 0x06
 5 0x06 shift
 bracketleft 0x06 altgr
 threeeighths 0x06 shift altgr
 
+# evdev 7 (0x7), QKeyCode "6", number 0x7
 minus 0x07
 6 0x07 shift
 bar 0x07 altgr
 fiveeighths 0x07 shift altgr
 
+# evdev 8 (0x8), QKeyCode "7", number 0x8
 egrave 0x08
 7 0x08 shift
 grave 0x08 altgr
 seveneighths 0x08 shift altgr
 
+# evdev 9 (0x9), QKeyCode "8", number 0x9
 underscore 0x09
 8 0x09 shift
 backslash 0x09 altgr
 trademark 0x09 shift altgr
 
+# evdev 10 (0xa), QKeyCode "9", number 0xa
 ccedilla 0x0a
 9 0x0a shift
 asciicircum 0x0a altgr
 plusminus 0x0a shift altgr
 
+# evdev 11 (0xb), QKeyCode "0", number 0xb
 agrave 0x0b
 0 0x0b shift
 at 0x0b altgr
+degree 0x0b shift altgr
 
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 parenright 0x0c
 degree 0x0c shift
 bracketright 0x0c altgr
 questiondown 0x0c shift altgr
 
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
 braceright 0x0d altgr
 dead_ogonek 0x0d shift altgr
 
-#
-# AZERTY first row
-#
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
 
-a 0x10 addupper
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+a 0x10
+A 0x10 shift
 ae 0x10 altgr
 AE 0x10 shift altgr
 
-z 0x11 addupper
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+z 0x11
+Z 0x11 shift
 guillemotleft 0x11 altgr
+less 0x11 shift altgr
 
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+cent 0x12 shift altgr
 
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
 
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
 
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
 
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
 
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
 
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+Oslash 0x18 shift altgr
 
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
 
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 dead_circumflex 0x1a
 dead_diaeresis 0x1a shift
+dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
 
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dollar 0x1b
 sterling 0x1b shift
 currency 0x1b altgr
 dead_macron 0x1b shift altgr
 
-#
-# AZERTY second row
-#
-q 0x1e addupper
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+q 0x1e
+Q 0x1e shift
+at 0x1e altgr
 Greek_OMEGA 0x1e shift altgr
 
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
+section 0x1f shift altgr
 
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
 
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
 
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
 
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
 
-kra 0x25 altgr
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
 
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
 
-m 0x27 addupper
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+m 0x27
+M 0x27 shift
+mu 0x27 altgr
 masculine 0x27 shift altgr
 
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 ugrave 0x28
 percent 0x28 shift
+dead_circumflex 0x28 altgr
 dead_caron 0x28 shift altgr
 
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+twosuperior 0x29
+asciitilde 0x29 shift
+notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 asterisk 0x2b
 mu 0x2b shift
 dead_grave 0x2b altgr
 dead_breve 0x2b shift altgr
 
-#
-# AZERTY third row
-#
-less 0x56
-greater 0x56 shift
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+w 0x2c
+W 0x2c shift
+lstroke 0x2c altgr
+Lstroke 0x2c shift altgr
 
-w 0x2c addupper
-
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
 
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
 
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
 
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
 
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
 comma 0x32
 question 0x32 shift
 dead_acute 0x32 altgr
 dead_doubleacute 0x32 shift altgr
 
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 semicolon 0x33
 period 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
 
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 colon 0x34
 slash 0x34 shift
 periodcentered 0x34 altgr
 division 0x34 shift altgr
 
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 exclam 0x35
 section 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/fr-be b/pc-bios/keymaps/fr-be
index 62f7128..9d2ac5d 100644
--- a/pc-bios/keymaps/fr-be
+++ b/pc-bios/keymaps/fr-be
@@ -1,134 +1,836 @@
-# generated from XKB map be
-include common
-map 0x80c
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : be
+#    variant : -
+#    options : -
+
+# name: "Belgian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
 ampersand 0x02
 1 0x02 shift
 bar 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
 eacute 0x03
 2 0x03 shift
 at 0x03 altgr
 oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
 quotedbl 0x04
 3 0x04 shift
 numbersign 0x04 altgr
 sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
 apostrophe 0x05
 4 0x05 shift
 onequarter 0x05 altgr
 dollar 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
 parenleft 0x06
 5 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
 section 0x07
 6 0x07 shift
 asciicircum 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
 egrave 0x08
 7 0x08 shift
 braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
 exclam 0x09
 8 0x09 shift
 bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
 ccedilla 0x0a
 9 0x0a shift
 braceleft 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
 agrave 0x0b
 0 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 parenright 0x0c
 degree 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 minus 0x0d
 underscore 0x0d shift
 dead_cedilla 0x0d altgr
 dead_ogonek 0x0d shift altgr
-a 0x10 addupper
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+a 0x10
+A 0x10 shift
+at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
-z 0x11 addupper
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+z 0x11
+Z 0x11 shift
 lstroke 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
 cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
-oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+oe 0x18 altgr
+OE 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 dead_circumflex 0x1a
 dead_diaeresis 0x1a shift
 bracketleft 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dollar 0x1b
 asterisk 0x1b shift
 bracketright 0x1b altgr
 dead_macron 0x1b shift altgr
-q 0x1e addupper
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+q 0x1e
+Q 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
-m 0x27 addupper
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+m 0x27
+M 0x27 shift
 dead_acute 0x27 altgr
 dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 ugrave 0x28
 percent 0x28 shift
 dead_acute 0x28 altgr
 dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 twosuperior 0x29
 threesuperior 0x29 shift
 notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 mu 0x2b
 sterling 0x2b shift
 dead_grave 0x2b altgr
 dead_breve 0x2b shift altgr
-w 0x2c addupper
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+w 0x2c
+W 0x2c shift
 guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
 comma 0x32
 question 0x32 shift
 dead_cedilla 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 semicolon 0x33
 period 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 colon 0x34
 slash 0x34 shift
 periodcentered 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 equal 0x35
 plus 0x35 shift
 dead_tilde 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
 backslash 0x56 altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/fr-ca b/pc-bios/keymaps/fr-ca
index 13a0306..736897b 100644
--- a/pc-bios/keymaps/fr-ca
+++ b/pc-bios/keymaps/fr-ca
@@ -1,60 +1,768 @@
-# Canadian French
-# By Simon Germain
-include common
-map 0xc0c
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : ca
+#    variant : fr
+#    options : -
 
-backslash 0x29 altgr
-plusminus 0x2 altgr
-at 0x3 altgr
-sterling 0x4 altgr
-cent 0x5 altgr
-currency 0x6 altgr
-notsign 0x7 altgr
+# name: "French (Canada)"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
+exclam 0x02 shift
+plusminus 0x02 altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
+quotedbl 0x03 shift
+at 0x03 altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
+slash 0x04 shift
+sterling 0x04 altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
+dollar 0x05 shift
+cent 0x05 altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
+percent 0x06 shift
+currency 0x06 altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
+question 0x07 shift
+notsign 0x07 altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
+ampersand 0x08 shift
+brokenbar 0x08 altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
+asterisk 0x09 shift
+twosuperior 0x09 altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
+parenleft 0x0a shift
+threesuperior 0x0a altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
+parenright 0x0b shift
+onequarter 0x0b altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
+minus 0x0c
+underscore 0x0c shift
+onehalf 0x0c altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+equal 0x0d
+plus 0x0d shift
+threequarters 0x0d altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+section 0x18 altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+paragraph 0x19 altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+dead_circumflex 0x1a
+bracketleft 0x1a altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+dead_cedilla 0x1b
+dead_diaeresis 0x1b shift
+bracketright 0x1b altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+semicolon 0x27
+colon 0x27 shift
+asciitilde 0x27 altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+dead_grave 0x28
+braceleft 0x28 altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 numbersign 0x29
 bar 0x29 shift
-twosuperior 0x9 altgr
-threesuperior 0xa altgr
-onequarter 0xb altgr
-onehalf 0xc altgr
-threequarters 0xd altgr
-section 0x18 altgr
-paragraph 0x19 altgr
-bracketleft 0x1a altgr
-bracketright 0x1b altgr
-asciitilde 0x27 altgr
-braceleft 0x28 altgr
-braceright 0x2b altgr
+backslash 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 less 0x2b
 greater 0x2b shift
+braceright 0x2b altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+mu 0x32 altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
+comma 0x33
+apostrophe 0x33 shift
+macron 0x33 altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
+period 0x34
+hyphen 0x34 altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+eacute 0x35
+Eacute 0x35 shift
+dead_acute 0x35 altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+nobreakspace 0x39 altgr
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 guillemotleft 0x56
 guillemotright 0x56 shift
 degree 0x56 altgr
-mu 0x32 altgr
-eacute 0x35
-dead_acute 0x35 altgr
-dead_grave 0x28
-dead_circumflex 0x1a
-dead_circumflex 0x1a shift
-dead_cedilla 0x1b
-dead_diaeresis 0x1b shift
-exclam 0x2 shift
-quotedbl 0x3 shift
-comma 0x33
-apostrophe 0x33 shift
-period 0x34
-period 0x34 shift
-slash 0x4 shift
-dollar 0x5 shift
-percent 0x6 shift
-question 0x7 shift
-ampersand 0x8 shift
-asterisk 0x9 shift
-parenleft 0xa shift
-parenright 0xb shift
-underscore 0xc shift
-minus 0xc
-underscore 0xc shift
-equal 0xd
-plus 0xd shift
-semicolon 0x27
-colon 0x27 shift
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/fr-ch b/pc-bios/keymaps/fr-ch
index 4620d20..40e1fef 100644
--- a/pc-bios/keymaps/fr-ch
+++ b/pc-bios/keymaps/fr-ch
@@ -1,114 +1,836 @@
-# generated from XKB map fr_CH
-include common
-map 0x100c
-exclam 0x02 shift
-onesuperior 0x02 altgr
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : ch
+#    variant : fr
+#    options : -
+
+# name: "French (Switzerland)"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
+plus 0x02 shift
+bar 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
-twosuperior 0x03 altgr
+at 0x03 altgr
 oneeighth 0x03 shift altgr
-section 0x04 shift
-threesuperior 0x04 altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
+asterisk 0x04 shift
+numbersign 0x04 altgr
 sterling 0x04 shift altgr
-dollar 0x05 shift
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
+ccedilla 0x05 shift
 onequarter 0x05 altgr
-currency 0x05 shift altgr
+dollar 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-threequarters 0x07 altgr
+notsign 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
-braceleft 0x08 altgr
+bar 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
-bracketleft 0x09 altgr
+cent 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
-ssharp 0x0c
+degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
+apostrophe 0x0c
 question 0x0c shift
-backslash 0x0c altgr
+dead_acute 0x0c altgr
 questiondown 0x0c shift altgr
-acute 0x0d
-dead_acute 0x0d
-grave 0x0d shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+dead_circumflex 0x0d
 dead_grave 0x0d shift
-dead_cedilla 0x0d altgr
+dead_tilde 0x0d altgr
 dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
 at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+lstroke 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
-z 0x15 addupper
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+z 0x15
+Z 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
-oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+oe 0x18 altgr
+OE 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
-udiaeresis 0x1a
-Udiaeresis 0x1a shift
-dead_diaeresis 0x1a altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+egrave 0x1a
+udiaeresis 0x1a shift
+bracketleft 0x1a altgr
 dead_abovering 0x1a shift altgr
-plus 0x1b
-asterisk 0x1b shift
-asciitilde 0x1b altgr
-dead_tilde 0x1b altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+dead_diaeresis 0x1b
+exclam 0x1b shift
+bracketright 0x1b altgr
 dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
-odiaeresis 0x27
-Odiaeresis 0x27 shift
-dead_doubleacute 0x27 altgr
-adiaeresis 0x28
-Adiaeresis 0x28 shift
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+eacute 0x27
+odiaeresis 0x27 shift
+dead_acute 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+agrave 0x28
+adiaeresis 0x28 shift
+braceleft 0x28 altgr
 dead_caron 0x28 shift altgr
-asciicircum 0x29
-dead_circumflex 0x29
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+section 0x29
 degree 0x29 shift
 notsign 0x29 altgr
-numbersign 0x2b
-apostrophe 0x2b shift
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
+dollar 0x2b
+sterling 0x2b shift
+braceright 0x2b altgr
 dead_breve 0x2b shift altgr
-y 0x2c addupper
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+y 0x2c
+Y 0x2c shift
 guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
 periodcentered 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+backslash 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/hr b/pc-bios/keymaps/hr
index 613aa69..6b89f09 100644
--- a/pc-bios/keymaps/hr
+++ b/pc-bios/keymaps/hr
@@ -1,125 +1,837 @@
-# generated from XKB map hr
-include common
-map 0x41a
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : hr
+#    variant : -
+#    options : -
+
+# name: "Croatian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 asciitilde 0x02 altgr
 dead_tilde 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 dead_caron 0x03 altgr
 caron 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 asciicircum 0x04 altgr
 dead_circumflex 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 dead_breve 0x05 altgr
 breve 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 degree 0x06 altgr
 dead_abovering 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
 dead_ogonek 0x07 altgr
 ogonek 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 grave 0x08 altgr
 dead_grave 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 dead_abovedot 0x09 altgr
 abovedot 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 dead_acute 0x0a altgr
 apostrophe 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 dead_doubleacute 0x0b altgr
 doubleacute 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 apostrophe 0x0c
 question 0x0c shift
 dead_diaeresis 0x0c altgr
 diaeresis 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 plus 0x0d
 asterisk 0x0d shift
 dead_cedilla 0x0d altgr
 cedilla 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
 backslash 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
 bar 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
-z 0x15 addupper
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+z 0x15
+Z 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 scaron 0x1a
 Scaron 0x1a shift
 division 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dstroke 0x1b
 Dstroke 0x1b shift
 multiply 0x1b altgr
 dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
-ssharp 0x1f altgr
-section 0x1f shift altgr
-eth 0x20 altgr
-ETH 0x20 shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+doublelowquotemark 0x1f altgr
+guillemotright 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+leftdoublequotemark 0x20 altgr
+guillemotleft 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 bracketleft 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 bracketright 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 lstroke 0x25 altgr
 ampersand 0x25 shift altgr
-Lstroke 0x26 altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 ccaron 0x27
 Ccaron 0x27 shift
 dead_acute 0x27 altgr
 dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 cacute 0x28
 Cacute 0x28 shift
 ssharp 0x28 altgr
 dead_caron 0x28 shift altgr
-dead_cedilla 0x29
-dead_diaeresis 0x29 shift
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+grave 0x29
+asciitilde 0x29 shift
 notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 zcaron 0x2b
 Zcaron 0x2b shift
 currency 0x2b altgr
 dead_breve 0x2b shift altgr
-y 0x2c addupper
-guillemotleft 0x2c altgr
-less 0x2c shift altgr
-guillemotright 0x2d altgr
-greater 0x2d shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+y 0x2c
+Y 0x2c shift
+leftsinglequotemark 0x2c altgr
+guillemotright 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+rightsinglequotemark 0x2d altgr
+guillemotleft 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 at 0x2f altgr
 grave 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 braceleft 0x30 altgr
 apostrophe 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
 braceright 0x31 altgr
-section 0x32 altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+asciicircum 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
-horizconnector 0x33 altgr
+less 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
-periodcentered 0x34 altgr
+greater 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/hu b/pc-bios/keymaps/hu
index 8aba444..a6bd66d 100644
--- a/pc-bios/keymaps/hu
+++ b/pc-bios/keymaps/hu
@@ -1,115 +1,836 @@
-# Hungarian keyboard layout (QWERTZ)
-# Created by: The NeverGone <never@delfin.klte.hu>
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : hu
+#    variant : -
+#    options : -
 
-include common
-map 0x40e
+# name: "Hungarian"
 
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
 
-# AltGr keys:
-notsign 0x29 altgr
-asciitilde 0x02 altgr
-caron 0x03 altgr
-asciicircum 0x04 altgr
-breve 0x05 altgr
-degree 0x06 altgr
-ogonek 0x07 altgr
-grave 0x08 altgr
-abovedot 0x09 altgr
-acute 0x0a altgr
-doubleacute 0x0b altgr
-diaeresis 0x0c altgr
-cedilla 0x0d altgr
-backslash 0x10 altgr
-bar 0x11 altgr
-EuroSign 0x12 altgr
-Iacute 0x17 altgr
-division 0x1a altgr
-multiply 0x1b altgr
-dstroke 0x1f altgr
-Dstroke 0x20 altgr
-bracketleft 0x21 altgr
-bracketright 0x22 altgr
-iacute 0x24 altgr
-lstroke 0x25 altgr
-Lstroke 0x26 altgr
-dollar 0x27 altgr
-ssharp 0x28 altgr
-currency 0x2b altgr
-less 0x56 altgr
-greater 0x2c altgr
-numbersign 0x2d altgr
-ampersand 0x2e altgr
-at 0x2f altgr
-braceleft 0x30 altgr
-braceright 0x31 altgr
-semicolon 0x33 altgr
-asterisk 0x35 altgr
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
 
-
-# Shift keys:
-section 0x29 shift
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 apostrophe 0x02 shift
+asciitilde 0x02 altgr
+dead_tilde 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
+dead_caron 0x03 altgr
+caron 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 plus 0x04 shift
+asciicircum 0x04 altgr
+dead_circumflex 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 exclam 0x05 shift
+dead_breve 0x05 altgr
+breve 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
+dead_abovering 0x06 altgr
+degree 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 slash 0x07 shift
+dead_ogonek 0x07 altgr
+ogonek 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 equal 0x08 shift
+grave 0x08 altgr
+dead_grave 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
+dead_abovedot 0x09 altgr
+abovedot 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
-Odiaeresis 0x0b shift
-Udiaeresis 0x0c shift
-Oacute 0x0d shift
-Z 0x15 shift
-Odoubleacute 0x1a shift
-Uacute 0x1b shift
-Eacute 0x27 shift
-Aacute 0x28 shift
-Udoubleacute 0x2b shift
-Y 0x2c shift
-question 0x33 shift
-colon 0x34 shift
-underscore 0x35 shift
-F13 0x3b shift
-F14 0x3c shift
-F15 0x3d shift
-F16 0x3e shift
-F17 0x3f shift
-F18 0x40 shift
-F19 0x41 shift
-F20 0x42 shift
-F21 0x43 shift
-F22 0x44 shift
-F23 0x57 shift
-F24 0x58 shift
+dead_acute 0x0a altgr
+acute 0x0a shift altgr
 
-
-# Ctrl keys:
-F25 0x3b ctrl
-F26 0x3c ctrl
-F27 0x3d ctrl
-F28 0x3e ctrl
-F29 0x3f ctrl
-F30 0x40 ctrl
-F31 0x41 ctrl
-F32 0x42 ctrl
-F33 0x43 ctrl
-F34 0x44 ctrl
-F35 0x57 ctrl
-#NoSymbol 0x58 ctrl
-
-
-0 0x29
+# evdev 11 (0xb), QKeyCode "0", number 0xb
 odiaeresis 0x0b
+Odiaeresis 0x0b shift
+dead_doubleacute 0x0b altgr
+doubleacute 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 udiaeresis 0x0c
+Udiaeresis 0x0c shift
+dead_diaeresis 0x0c altgr
+diaeresis 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 oacute 0x0d
+Oacute 0x0d shift
+dead_cedilla 0x0d altgr
+cedilla 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+backslash 0x10 altgr
+Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+bar 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
+Adiaeresis 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+paragraph 0x13 altgr
+registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+tslash 0x14 altgr
+Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
 z 0x15
+Z 0x15 shift
+endash 0x15 altgr
+yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+EuroSign 0x16 altgr
+uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+Iacute 0x17 altgr
+iacute 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+doublelowquotemark 0x18 altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+rightdoublequotemark 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 odoubleacute 0x1a
+Odoubleacute 0x1a shift
+division 0x1a altgr
+dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 uacute 0x1b
+Uacute 0x1b shift
+multiply 0x1b altgr
+dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+adiaeresis 0x1e altgr
+Adiaeresis 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+dstroke 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+Dstroke 0x20 altgr
+ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+bracketleft 0x21 altgr
+ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+bracketright 0x22 altgr
+ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+hstroke 0x23 altgr
+Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+iacute 0x24 altgr
+Iacute 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+lstroke 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+Lstroke 0x26 altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 eacute 0x27
+Eacute 0x27 shift
+dollar 0x27 altgr
+cent 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 aacute 0x28
+Aacute 0x28 shift
+ssharp 0x28 altgr
+dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+0 0x29
+section 0x29 shift
+notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 udoubleacute 0x2b
+Udoubleacute 0x2b shift
+currency 0x2b altgr
+dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
 y 0x2c
+Y 0x2c shift
+greater 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+numbersign 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+ampersand 0x2e altgr
+copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+at 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+braceleft 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+braceright 0x31 altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+less 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
+question 0x33 shift
+semicolon 0x33 altgr
+multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
+colon 0x34 shift
+greater 0x34 altgr
+division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
+underscore 0x35 shift
+asterisk 0x35 altgr
+dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+iacute 0x56
+Iacute 0x56 shift
+less 0x56 altgr
+greater 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/is b/pc-bios/keymaps/is
index 935ac1d..063675d 100644
--- a/pc-bios/keymaps/is
+++ b/pc-bios/keymaps/is
@@ -1,139 +1,837 @@
-# 2004-03-16 Halldór Guðmundsson and Morten Lange
-# Keyboard definition file for the Icelandic keyboard
-# to be used in rdesktop 1.3.x ( See rdesktop.org)
-# generated from XKB map de, and changed manually
-# Location for example /usr/local/share/rdesktop/keymaps/is
-include common
-map 0x40f
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : is
+#    variant : -
+#    options : -
+
+# name: "Icelandic"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 twosuperior 0x03 altgr
 oneeighth 0x03 shift altgr
-#section 0x04 shift
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 threesuperior 0x04 altgr
 sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 onequarter 0x05 altgr
 currency 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-threequarters 0x07 altgr
+notsign 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
-#ssharp 0x0c
+degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 odiaeresis 0x0c
-#question 0x0c shift
 Odiaeresis 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
-#acute 0x0d
-minus  0x0d
-#dead_acute 0x0d
-#grave 0x0d shift
-#dead_grave 0x0d shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+minus 0x0d
 underscore 0x0d shift
 dead_cedilla 0x0d altgr
 dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
 at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+lstroke 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
-#z 0x15 addupper
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
-#thorn 0x19 altgr
-#THORN 0x19 shift altgr
-#udiaeresis 0x1a
-#Udiaeresis 0x1a shift
-#dead_diaeresis 0x1a altgr
-#dead_abovering 0x1a shift altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+thorn 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 eth 0x1a
 ETH 0x1a shift
+dead_diaeresis 0x1a altgr
+dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 apostrophe 0x1b
 question 0x1b shift
-#plus 0x1b
-#asterisk 0x1b shift
 asciitilde 0x1b altgr
-#grave 0x1b altgr
-#dead_tilde 0x1b altgr
-#dead_macron 0x1b shift altgr
-#ae 0x1e altgr
-#AE 0x1e shift altgr
-#eth 0x20 altgr
-#eth 0x20
-#ETH 0x20 shift altgr
-#ETH 0x20 shift
+dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+ae 0x1e altgr
+AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+U201E 0x20 altgr
+U201C 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
-#adiaeresis 0x27
-#Adiaeresis 0x27 shift
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 ae 0x27
 AE 0x27 shift
-dead_doubleacute 0x27 altgr
-#adiaeresis 0x28
-#Adiaeresis 0x28 shift
-#dead_caron 0x28 shift altgr
-#asciicircum 0x29
-acute  0x28
+asciicircum 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 dead_acute 0x28
-#dead_circumflex 0x29
-#degree 0x29 shift
-#notsign 0x29 altgr
+dead_circumflex 0x28 altgr
+dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+dead_abovering 0x29
+dead_diaeresis 0x29 shift
+notsign 0x29 altgr
+hyphen 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 plus 0x2b
 asterisk 0x2b shift
 grave 0x2b altgr
-#numbersign 0x2b
-#apostrophe 0x2b shift
-#dead_breve 0x2b shift altgr
-#y 0x2c addupper
+dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
 periodcentered 0x34 altgr
 division 0x34 shift altgr
-#minus 0x35
-#underscore 0x35 shift
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 thorn 0x35
 THORN 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/it b/pc-bios/keymaps/it
index 00ca73a..abc3ed1 100644
--- a/pc-bios/keymaps/it
+++ b/pc-bios/keymaps/it
@@ -1,115 +1,840 @@
-# generated from XKB map it
-include common
-map 0x410
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : it
+#    variant : -
+#    options : -
+
+# name: "Italian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 twosuperior 0x03 altgr
-oneeighth 0x03 shift altgr
+dead_doubleacute 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 sterling 0x04 shift
 threesuperior 0x04 altgr
+dead_tilde 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 onequarter 0x05 altgr
+oneeighth 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-threequarters 0x07 altgr
+notsign 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
+bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
+bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
-degree 0x0b shift altgr
+dead_ogonek 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 apostrophe 0x0c
 question 0x0c shift
 grave 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 igrave 0x0d
 asciicircum 0x0d shift
 asciitilde 0x0d altgr
-dead_ogonek 0x0d shift altgr
+dead_circumflex 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
 at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
 lstroke 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
 cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 egrave 0x1a
 eacute 0x1a shift
 bracketleft 0x1a altgr
-dead_abovering 0x1a shift altgr
+braceleft 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 plus 0x1b
 asterisk 0x1b shift
 bracketright 0x1b altgr
-dead_macron 0x1b shift altgr
+braceright 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
 section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 ograve 0x27
 ccedilla 0x27 shift
 at 0x27 altgr
-dead_doubleacute 0x27 shift altgr
+dead_cedilla 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 agrave 0x28
 degree 0x28 shift
 numbersign 0x28 altgr
+dead_abovering 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 backslash 0x29
 bar 0x29 shift
 notsign 0x29 altgr
+brokenbar 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 ugrave 0x2b
 section 0x2b shift
 dead_grave 0x2b altgr
 dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+ntilde 0x31 altgr
+Ntilde 0x31 shift altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
-horizconnector 0x33 altgr
+dead_acute 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
 periodcentered 0x34 altgr
-division 0x34 shift altgr
+dead_diaeresis 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
-dead_belowdot 0x35 altgr
-dead_abovedot 0x35 shift altgr
+dead_macron 0x35 altgr
+division 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+guillemotleft 0x56 altgr
+guillemotright 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/ja b/pc-bios/keymaps/ja
index 9d90a78..aae93e8 100644
--- a/pc-bios/keymaps/ja
+++ b/pc-bios/keymaps/ja
@@ -1,109 +1,751 @@
-# generated from XKB map jp106
-include common
-map 0x411
+#
+# generated by qemu-keymap
+#    model   : jp106
+#    layout  : jp
+#    variant : -
+#    options : -
+
+# name: "Japanese"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
-kana_NU 0x02 altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
-kana_FU 0x03 altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
-kana_A 0x04 altgr
-kana_a 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
-kana_U 0x05 altgr
-kana_u 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
-kana_E 0x06 altgr
-kana_e 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-kana_O 0x07 altgr
-kana_o 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 apostrophe 0x08 shift
-kana_YA 0x08 altgr
-kana_ya 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
-kana_YU 0x09 altgr
-kana_yu 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
-kana_YO 0x0a altgr
-kana_yo 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 asciitilde 0x0b shift
-kana_WA 0x0b altgr
-kana_WO 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 equal 0x0c shift
-kana_HO 0x0c altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 asciicircum 0x0d
 asciitilde 0x0d shift
-kana_HE 0x0d altgr
-kana_TA 0x10 altgr
-kana_TE 0x11 altgr
-kana_I 0x12 altgr
-kana_i 0x12 shift altgr
-kana_SU 0x13 altgr
-kana_KA 0x14 altgr
-kana_N 0x15 altgr
-kana_NA 0x16 altgr
-kana_NI 0x17 altgr
-kana_RA 0x18 altgr
-kana_SE 0x19 altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 at 0x1a
 grave 0x1a shift
-voicedsound 0x1a altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 bracketleft 0x1b
 braceleft 0x1b shift
-semivoicedsound 0x1b altgr
-kana_openingbracket 0x1b shift altgr
-kana_CHI 0x1e altgr
-kana_TO 0x1f altgr
-kana_SHI 0x20 altgr
-kana_HA 0x21 altgr
-kana_KI 0x22 altgr
-kana_KU 0x23 altgr
-kana_MA 0x24 altgr
-kana_NO 0x25 altgr
-kana_RI 0x26 altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 semicolon 0x27
 plus 0x27 shift
-kana_RE 0x27 altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 colon 0x28
 asterisk 0x28 shift
-kana_KE 0x28 altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 Zenkaku_Hankaku 0x29
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 bracketright 0x2b
 braceright 0x2b shift
-kana_MU 0x2b altgr
-kana_closingbracket 0x2b shift altgr
-kana_TSU 0x2c altgr
-kana_tsu 0x2c shift altgr
-kana_SA 0x2d altgr
-kana_SO 0x2e altgr
-kana_HI 0x2f altgr
-kana_KO 0x30 altgr
-kana_MI 0x31 altgr
-kana_MO 0x32 altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 less 0x33 shift
-kana_NE 0x33 altgr
-kana_comma 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 greater 0x34 shift
-kana_RU 0x34 altgr
-kana_fullstop 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 slash 0x35
 question 0x35 shift
-kana_ME 0x35 altgr
-kana_conjunctive 0x35 shift altgr
-Eisu_toggle 0x3a shift
-Execute 0x54 shift
-Kanji 0x70
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Eisu_toggle 0x3a
+Caps_Lock 0x3a shift
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
 backslash 0x73
-yen 0x7d
-bar 0x7d shift
 underscore 0x73 shift
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
 Henkan_Mode 0x79
-Katakana_Real 0x70
-Katakana 0x70
-Muhenkan 0x7b
-Henkan_Mode_Real 0x79
-Henkan_Mode_Ultra 0x79
-backslash_ja 0x73
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+backslash 0x7d
+bar 0x7d shift
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/lt b/pc-bios/keymaps/lt
index 3d9d619..4101367 100644
--- a/pc-bios/keymaps/lt
+++ b/pc-bios/keymaps/lt
@@ -1,57 +1,835 @@
-# generated from XKB map lt
-include common
-map 0x427
-exclam 0x02 shift
-aogonek 0x02 altgr
-Aogonek 0x02 shift altgr
-at 0x03 shift
-ccaron 0x03 altgr
-Ccaron 0x03 shift altgr
-numbersign 0x04 shift
-eogonek 0x04 altgr
-Eogonek 0x04 shift altgr
-dollar 0x05 shift
-eabovedot 0x05 altgr
-Eabovedot 0x05 shift altgr
-percent 0x06 shift
-iogonek 0x06 altgr
-Iogonek 0x06 shift altgr
-asciicircum 0x07 shift
-scaron 0x07 altgr
-Scaron 0x07 shift altgr
-ampersand 0x08 shift
-uogonek 0x08 altgr
-Uogonek 0x08 shift altgr
-asterisk 0x09 shift
-umacron 0x09 altgr
-Umacron 0x09 shift altgr
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : lt
+#    variant : -
+#    options : -
+
+# name: "Lithuanian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+aogonek 0x02
+Aogonek 0x02 shift
+1 0x02 altgr
+exclam 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+ccaron 0x03
+Ccaron 0x03 shift
+2 0x03 altgr
+at 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+eogonek 0x04
+Eogonek 0x04 shift
+3 0x04 altgr
+numbersign 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+eabovedot 0x05
+Eabovedot 0x05 shift
+4 0x05 altgr
+dollar 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+iogonek 0x06
+Iogonek 0x06 shift
+5 0x06 altgr
+percent 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+scaron 0x07
+Scaron 0x07 shift
+6 0x07 altgr
+asciicircum 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+uogonek 0x08
+Uogonek 0x08 shift
+7 0x08 altgr
+ampersand 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+umacron 0x09
+Umacron 0x09 shift
+8 0x09 altgr
+asterisk 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+doublelowquotemark 0x0a
 parenleft 0x0a shift
-doublelowquotemark 0x0a altgr
+9 0x0a altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+leftdoublequotemark 0x0b
 parenright 0x0b shift
-leftdoublequotemark 0x0b altgr
+0 0x0b altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
-equal 0x0d
-plus 0x0d shift
-zcaron 0x0d altgr
-Zcaron 0x0d shift altgr
+endash 0x0c altgr
+questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+zcaron 0x0d
+Zcaron 0x0d shift
+equal 0x0d altgr
+plus 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
+Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+lstroke 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
+EuroSign 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+paragraph 0x13 altgr
+registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+tslash 0x14 altgr
+Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+leftarrow 0x15 altgr
+yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+downarrow 0x16 altgr
+uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+rightarrow 0x17 altgr
+idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+oslash 0x18 altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+thorn 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 bracketleft 0x1a
 braceleft 0x1a shift
+dead_diaeresis 0x1a altgr
+dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 bracketright 0x1b
 braceright 0x1b shift
+dead_tilde 0x1b altgr
+dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+ae 0x1e altgr
+AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+eth 0x20 altgr
+ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+dstroke 0x21 altgr
+ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+eng 0x22 altgr
+ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+hstroke 0x23 altgr
+Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 semicolon 0x27
 colon 0x27 shift
+dead_acute 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 apostrophe 0x28
 quotedbl 0x28 shift
+dead_circumflex 0x28 altgr
+dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 grave 0x29
 asciitilde 0x29 shift
+acute 0x29 altgr
+notsign 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 backslash 0x2b
 bar 0x2b shift
+dead_grave 0x2b altgr
+dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+cent 0x2e altgr
+copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+mu 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 less 0x33 shift
+horizconnector 0x33 altgr
+multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 greater 0x34 shift
+periodcentered 0x34 altgr
+division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 slash 0x35
 question 0x35 shift
+dead_belowdot 0x35 altgr
+dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 endash 0x56
 EuroSign 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/lv b/pc-bios/keymaps/lv
index 1d91727..27260ce 100644
--- a/pc-bios/keymaps/lv
+++ b/pc-bios/keymaps/lv
@@ -1,128 +1,810 @@
-# generated from XKB map lv
-include common
-map 0x426
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : lv
+#    variant : -
+#    options : -
+
+# name: "Latvian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 at 0x03 shift
 twosuperior 0x03 altgr
 oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 threesuperior 0x04 altgr
 sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 EuroSign 0x05 altgr
 cent 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 asciicircum 0x07 shift
 threequarters 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 ampersand 0x08 shift
 braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
 bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenleft 0x0a shift
 bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 parenright 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
-dead_cedilla 0x0d altgr
-dead_ogonek 0x0d shift altgr
-at 0x10 altgr
-Greek_OMEGA 0x10 shift altgr
-lstroke 0x11 altgr
-Lstroke 0x11 shift altgr
+endash 0x0d altgr
+emdash 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 emacron 0x12 altgr
 Emacron 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 rcedilla 0x13 altgr
 Rcedilla 0x13 shift altgr
-tslash 0x14 altgr
-Tslash 0x14 shift altgr
-leftarrow 0x15 altgr
-yen 0x15 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 umacron 0x16 altgr
 Umacron 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 imacron 0x17 altgr
 Imacron 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 omacron 0x18 altgr
 Omacron 0x18 shift altgr
-thorn 0x19 altgr
-THORN 0x19 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 bracketleft 0x1a
 braceleft 0x1a shift
-dead_diaeresis 0x1a altgr
-dead_abovering 0x1a shift altgr
+guillemotleft 0x1a altgr
+leftdoublequotemark 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 bracketright 0x1b
 braceright 0x1b shift
-dead_tilde 0x1b altgr
-dead_macron 0x1b shift altgr
-ISO_Next_Group 0x1c shift
+guillemotright 0x1b altgr
+rightdoublequotemark 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 amacron 0x1e altgr
 Amacron 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 scaron 0x1f altgr
 Scaron 0x1f shift altgr
-eth 0x20 altgr
-ETH 0x20 shift altgr
-dstroke 0x21 altgr
-ordfeminine 0x21 shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 gcedilla 0x22 altgr
 Gcedilla 0x22 shift altgr
-hstroke 0x23 altgr
-Hstroke 0x23 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kcedilla 0x25 altgr
 Kcedilla 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lcedilla 0x26 altgr
 Lcedilla 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 semicolon 0x27
 colon 0x27 shift
-dead_acute 0x27 altgr
-dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 apostrophe 0x28
 quotedbl 0x28 shift
 leftdoublequotemark 0x28 altgr
 doublelowquotemark 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 grave 0x29
 asciitilde 0x29 shift
-notsign 0x29 altgr
+acute 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 backslash 0x2b
 bar 0x2b shift
-dead_grave 0x2b altgr
-dead_breve 0x2b shift altgr
+grave 0x2b altgr
+breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 zcaron 0x2c altgr
 Zcaron 0x2c shift altgr
-guillemotright 0x2d altgr
-greater 0x2d shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 ccaron 0x2e altgr
 Ccaron 0x2e shift altgr
-leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
-rightdoublequotemark 0x30 altgr
-apostrophe 0x30 shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
 ncedilla 0x31 altgr
 Ncedilla 0x31 shift altgr
-mu 0x32 altgr
-masculine 0x32 shift altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 less 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 greater 0x34 shift
 periodcentered 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 slash 0x35
 question 0x35 shift
-dead_belowdot 0x35 altgr
-dead_abovedot 0x35 shift altgr
-nobreakspace 0x39 altgr
+abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/mk b/pc-bios/keymaps/mk
index 18c1504..30a597c 100644
--- a/pc-bios/keymaps/mk
+++ b/pc-bios/keymaps/mk
@@ -1,101 +1,747 @@
-# generated from XKB map mk
-include common
-map 0x42f
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : mk
+#    variant : -
+#    options : -
+
+# name: "Macedonian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
-at 0x03 shift
-doublelowquotemark 0x03 shift altgr
-numbersign 0x04 shift
-leftdoublequotemark 0x04 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
+doublelowquotemark 0x03 shift
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
+leftdoublequotemark 0x04 shift
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 asciicircum 0x07 shift
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 ampersand 0x08 shift
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenleft 0x0a shift
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 parenright 0x0b shift
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
-Cyrillic_lje 0x10 altgr
-Cyrillic_LJE 0x10 shift altgr
-Cyrillic_nje 0x11 altgr
-Cyrillic_NJE 0x11 shift altgr
-Cyrillic_ie 0x12 altgr
-Cyrillic_IE 0x12 shift altgr
-Cyrillic_er 0x13 altgr
-Cyrillic_ER 0x13 shift altgr
-Cyrillic_te 0x14 altgr
-Cyrillic_TE 0x14 shift altgr
-Macedonia_dse 0x15 altgr
-Macedonia_DSE 0x15 shift altgr
-Cyrillic_u 0x16 altgr
-Cyrillic_U 0x16 shift altgr
-Cyrillic_i 0x17 altgr
-Cyrillic_I 0x17 shift altgr
-Cyrillic_o 0x18 altgr
-Cyrillic_O 0x18 shift altgr
-Cyrillic_pe 0x19 altgr
-Cyrillic_PE 0x19 shift altgr
-bracketleft 0x1a
-braceleft 0x1a shift
-Cyrillic_sha 0x1a altgr
-Cyrillic_SHA 0x1a shift altgr
-bracketright 0x1b
-braceright 0x1b shift
-Macedonia_gje 0x1b altgr
-Macedonia_GJE 0x1b shift altgr
-Cyrillic_a 0x1e altgr
-Cyrillic_A 0x1e shift altgr
-Cyrillic_es 0x1f altgr
-Cyrillic_ES 0x1f shift altgr
-Cyrillic_de 0x20 altgr
-Cyrillic_DE 0x20 shift altgr
-Cyrillic_ef 0x21 altgr
-Cyrillic_EF 0x21 shift altgr
-Cyrillic_ghe 0x22 altgr
-Cyrillic_GHE 0x22 shift altgr
-Cyrillic_ha 0x23 altgr
-Cyrillic_HA 0x23 shift altgr
-Cyrillic_je 0x24 altgr
-Cyrillic_JE 0x24 shift altgr
-Cyrillic_ka 0x25 altgr
-Cyrillic_KA 0x25 shift altgr
-Cyrillic_el 0x26 altgr
-Cyrillic_EL 0x26 shift altgr
-semicolon 0x27
-colon 0x27 shift
-Cyrillic_che 0x27 altgr
-Cyrillic_CHE 0x27 shift altgr
-apostrophe 0x28
-quotedbl 0x28 shift
-Macedonia_kje 0x28 altgr
-Macedonia_KJE 0x28 shift altgr
-grave 0x29
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+Cyrillic_lje 0x10
+Cyrillic_LJE 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+Cyrillic_nje 0x11
+Cyrillic_NJE 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+Cyrillic_ie 0x12
+Cyrillic_IE 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+Cyrillic_er 0x13
+Cyrillic_ER 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+Cyrillic_te 0x14
+Cyrillic_TE 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+Macedonia_dse 0x15
+Macedonia_DSE 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+Cyrillic_u 0x16
+Cyrillic_U 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+Cyrillic_i 0x17
+Cyrillic_I 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+Cyrillic_o 0x18
+Cyrillic_O 0x18 shift
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+Cyrillic_pe 0x19
+Cyrillic_PE 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+Cyrillic_sha 0x1a
+Cyrillic_SHA 0x1a shift
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+Macedonia_gje 0x1b
+Macedonia_GJE 0x1b shift
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+Cyrillic_a 0x1e
+Cyrillic_A 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+Cyrillic_es 0x1f
+Cyrillic_ES 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+Cyrillic_de 0x20
+Cyrillic_DE 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+Cyrillic_ef 0x21
+Cyrillic_EF 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+Cyrillic_ghe 0x22
+Cyrillic_GHE 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+Cyrillic_ha 0x23
+Cyrillic_HA 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+Cyrillic_je 0x24
+Cyrillic_JE 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+Cyrillic_ka 0x25
+Cyrillic_KA 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+Cyrillic_el 0x26
+Cyrillic_EL 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+Cyrillic_che 0x27
+Cyrillic_CHE 0x27 shift
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+Macedonia_kje 0x28
+Macedonia_KJE 0x28 shift
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+dead_grave 0x29
 asciitilde 0x29 shift
-backslash 0x2b
-bar 0x2b shift
-Cyrillic_zhe 0x2b altgr
-Cyrillic_ZHE 0x2b shift altgr
-Cyrillic_ze 0x2c altgr
-Cyrillic_ZE 0x2c shift altgr
-Cyrillic_dzhe 0x2d altgr
-Cyrillic_DZHE 0x2d shift altgr
-Cyrillic_tse 0x2e altgr
-Cyrillic_TSE 0x2e shift altgr
-Cyrillic_ve 0x2f altgr
-Cyrillic_VE 0x2f shift altgr
-Cyrillic_be 0x30 altgr
-Cyrillic_BE 0x30 shift altgr
-Cyrillic_en 0x31 altgr
-Cyrillic_EN 0x31 shift altgr
-Cyrillic_em 0x32 altgr
-Cyrillic_EM 0x32 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
+Cyrillic_zhe 0x2b
+Cyrillic_ZHE 0x2b shift
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+Cyrillic_ze 0x2c
+Cyrillic_ZE 0x2c shift
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+Cyrillic_dzhe 0x2d
+Cyrillic_DZHE 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+Cyrillic_tse 0x2e
+Cyrillic_TSE 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+Cyrillic_ve 0x2f
+Cyrillic_VE 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+Cyrillic_be 0x30
+Cyrillic_BE 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+Cyrillic_en 0x31
+Cyrillic_EN 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+Cyrillic_em 0x32
+Cyrillic_EM 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
-less 0x33 shift
-semicolon 0x33 shift altgr
+semicolon 0x33 shift
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
-greater 0x34 shift
-colon 0x34 shift altgr
+colon 0x34 shift
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 slash 0x35
 question 0x35 shift
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/nl b/pc-bios/keymaps/nl
index b4892f9..ae7c8f5 100644
--- a/pc-bios/keymaps/nl
+++ b/pc-bios/keymaps/nl
@@ -1,59 +1,837 @@
-# Dutch (Netherlands)
-include common
-map 0x413
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : nl
+#    variant : -
+#    options : -
 
+# name: "Dutch"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
-quotebl 0x03 shift
+exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
+quotedbl 0x03 shift
 twosuperior 0x03 altgr
+oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 threesuperior 0x04 altgr
+sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 onequarter 0x05 altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
+threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
 threequarters 0x07 altgr
+fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 underscore 0x08 shift
 sterling 0x08 altgr
+seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 braceleft 0x09 altgr
+bracketleft 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 braceright 0x0a altgr
+bracketright 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 apostrophe 0x0b shift
+degree 0x0b altgr
+trademark 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 slash 0x0c
 question 0x0c shift
 backslash 0x0c altgr
+questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 degree 0x0d
 dead_tilde 0x0d shift
 dead_cedilla 0x0d altgr
+dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
+Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+lstroke 0x11 altgr
+Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
+registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+thorn 0x14 altgr
+THORN 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+ydiaeresis 0x15 altgr
+yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+udiaeresis 0x16 altgr
+Udiaeresis 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+idiaeresis 0x17 altgr
+Idiaeresis 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+ograve 0x18 altgr
+Ograve 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+paragraph 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 dead_diaeresis 0x1a
 dead_circumflex 0x1a shift
+asciitilde 0x1a altgr
+asciicircum 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 asterisk 0x1b
 bar 0x1b shift
+dead_tilde 0x1b altgr
+dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+aacute 0x1e altgr
+Aacute 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+eth 0x20 altgr
+ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+ordfeminine 0x21 altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+eng 0x22 altgr
+ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+hstroke 0x23 altgr
+Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 plus 0x27
 plusminus 0x27 shift
+dead_acute 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 dead_acute 0x28
 dead_grave 0x28 shift
+apostrophe 0x28 altgr
+grave 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 at 0x29
 section 0x29 shift
 notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 less 0x2b
 greater 0x2b shift
+dead_grave 0x2b altgr
+dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
-copyright 0x2e altgr
-mu 0x32 altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
+cent 0x2e altgr
+copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+ntilde 0x31 altgr
+Ntilde 0x31 shift altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
+Greek_mu 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
+cedilla 0x33 altgr
+guillemotleft 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
 periodcentered 0x34 altgr
-hyphen 0x35
+guillemotright 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+minus 0x35
 equal 0x35 shift
+hyphen 0x35 altgr
+dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 bracketright 0x56
 bracketleft 0x56 shift
-brokenbar 0x56 altgr
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/no b/pc-bios/keymaps/no
index 40a6479..8afd199 100644
--- a/pc-bios/keymaps/no
+++ b/pc-bios/keymaps/no
@@ -1,119 +1,851 @@
-# generated from XKB map no
-include common
-map 0x414
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : no
+#    variant : -
+#    options : -
+
+# name: "Norwegian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 exclamdown 0x02 altgr
 onesuperior 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 at 0x03 altgr
 twosuperior 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 sterling 0x04 altgr
 threesuperior 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 currency 0x05 shift
 dollar 0x05 altgr
 onequarter 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
-cent 0x06 shift altgr
+U2030 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
 yen 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
 division 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 bracketleft 0x09 altgr
 guillemotleft 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
 guillemotright 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 plus 0x0c
 question 0x0c shift
 plusminus 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 backslash 0x0d
 dead_grave 0x0d shift
 dead_acute 0x0d altgr
 notsign 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
 lstroke 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
 cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 registered 0x13 altgr
+trademark 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 thorn 0x14 altgr
 THORN 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oe 0x18 altgr
 OE 0x18 shift altgr
-thorn 0x19 altgr
-THORN 0x19 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+Greek_pi 0x19 altgr
+Greek_PI 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 aring 0x1a
 Aring 0x1a shift
 dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dead_diaeresis 0x1b
 dead_circumflex 0x1b shift
-asciicircum 0x01b shift
 dead_tilde 0x1b altgr
-asciitilde 0x1b altgr
 dead_caron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ordfeminine 0x1e altgr
 masculine 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
 section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 oslash 0x27
-Ooblique 0x27 shift
+Oslash 0x27 shift
+dead_acute 0x27 altgr
 dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 ae 0x28
 AE 0x28 shift
+dead_circumflex 0x28 altgr
 dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 bar 0x29
 section 0x29 shift
 brokenbar 0x29 altgr
 paragraph 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 apostrophe 0x2b
 asterisk 0x2b shift
+dead_doubleacute 0x2b altgr
 multiply 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 copyright 0x2e altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
 dead_cedilla 0x33 altgr
 dead_ogonek 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
-periodcentered 0x34 altgr
-dead_abovedot 0x34 shift altgr
+ellipsis 0x34 altgr
+periodcentered 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
-hyphen 0x35 altgr
-macron 0x35 shift altgr
+endash 0x35 altgr
+emdash 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+U22C5 0x37 shift
+0x010000d7 0x37 altgr
+VoidSymbol 0x37 shift altgr
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
 nobreakspace 0x39 altgr
+U202F 0x39 shift altgr
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+U2212 0x4a shift
+U2212 0x4a altgr
+VoidSymbol 0x4a shift altgr
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+0x0100002b 0x4e shift
+0x0100002b 0x4e altgr
+VoidSymbol 0x4e shift altgr
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
 onehalf 0x56 altgr
 threequarters 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+U2215 0xb5 shift
+0x010000f7 0xb5 altgr
+VoidSymbol 0xb5 shift altgr
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/pl b/pc-bios/keymaps/pl
index 09c600d..df27206 100644
--- a/pc-bios/keymaps/pl
+++ b/pc-bios/keymaps/pl
@@ -1,122 +1,841 @@
-# generated from XKB map pl
-include common
-map 0x415
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : pl
+#    variant : -
+#    options : -
+
+# name: "Polish"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
-onesuperior 0x02 altgr
+notequal 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 at 0x03 shift
 twosuperior 0x03 altgr
-oneeighth 0x03 shift altgr
+questiondown 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 threesuperior 0x04 altgr
 sterling 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
-onequarter 0x05 altgr
+cent 0x05 altgr
+onequarter 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
-onehalf 0x06 altgr
-threeeighths 0x06 shift altgr
+EuroSign 0x06 altgr
+U2030 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 asciicircum 0x07 shift
-threequarters 0x07 altgr
-fiveeighths 0x07 shift altgr
+onehalf 0x07 altgr
+logicaland 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 ampersand 0x08 shift
-braceleft 0x08 altgr
-seveneighths 0x08 shift altgr
+section 0x08 altgr
+approxeq 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
-bracketleft 0x09 altgr
-trademark 0x09 shift altgr
+periodcentered 0x09 altgr
+threequarters 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenleft 0x0a shift
-bracketright 0x0a altgr
+guillemotleft 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 parenright 0x0b shift
-braceright 0x0b altgr
+guillemotright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
-backslash 0x0c altgr
-questiondown 0x0c shift altgr
+endash 0x0c altgr
+emdash 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
 dead_cedilla 0x0d altgr
 dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+Greek_pi 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
-lstroke 0x11 altgr
-Lstroke 0x11 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+oe 0x11 altgr
+OE 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 eogonek 0x12 altgr
 Eogonek 0x12 shift altgr
-paragraph 0x13 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
+copyright 0x13 altgr
 registered 0x13 shift altgr
-tslash 0x14 altgr
-Tslash 0x14 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+ssharp 0x14 altgr
+trademark 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
-EuroSign 0x16 altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
-idotless 0x17 shift altgr
+U2194 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oacute 0x18 altgr
 Oacute 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 bracketleft 0x1a
 braceleft 0x1a shift
 dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 bracketright 0x1b
 braceright 0x1b shift
 dead_tilde 0x1b altgr
 dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 aogonek 0x1e altgr
 Aogonek 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 sacute 0x1f altgr
 Sacute 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
-dstroke 0x21 altgr
-ordfeminine 0x21 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+ae 0x21 altgr
+AE 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
-hstroke 0x23 altgr
-Hstroke 0x23 shift altgr
-kra 0x25 altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+rightsinglequotemark 0x23 altgr
+U2022 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+schwa 0x24 altgr
+SCHWA 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+ellipsis 0x25 altgr
+dead_stroke 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 semicolon 0x27
 colon 0x27 shift
 dead_acute 0x27 altgr
 dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 apostrophe 0x28
 quotedbl 0x28 shift
 dead_circumflex 0x28 altgr
 dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 grave 0x29
 asciitilde 0x29 shift
 notsign 0x29 altgr
+logicalor 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 backslash 0x2b
 bar 0x2b shift
 dead_grave 0x2b altgr
 dead_breve 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 zabovedot 0x2c altgr
 Zabovedot 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 zacute 0x2d altgr
 Zacute 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cacute 0x2e altgr
 Cacute 0x2e shift altgr
-leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+doublelowquotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+leftdoublequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
 nacute 0x31 altgr
 Nacute 0x31 shift altgr
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
-masculine 0x32 shift altgr
+infinity 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 less 0x33 shift
-horizconnector 0x33 altgr
+lessthanequal 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 greater 0x34 shift
-periodcentered 0x34 altgr
+greaterthanequal 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 slash 0x35
 question 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+nobreakspace 0x39 altgr
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/pt b/pc-bios/keymaps/pt
index c6941f6..ab59001 100644
--- a/pc-bios/keymaps/pt
+++ b/pc-bios/keymaps/pt
@@ -1,113 +1,834 @@
-# generated from XKB map pt
-include common
-map 0x816
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : pt
+#    variant : -
+#    options : -
+
+# name: "Portuguese"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 quotedbl 0x03 shift
 at 0x03 altgr
 oneeighth 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 sterling 0x04 altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 section 0x05 altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-threequarters 0x07 altgr
+notsign 0x07 altgr
 fiveeighths 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
 seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 bracketleft 0x09 altgr
 trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 apostrophe 0x0c
 question 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 guillemotleft 0x0d
 guillemotright 0x0d shift
 dead_cedilla 0x0d altgr
 dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
 lstroke 0x11 altgr
 Lstroke 0x11 shift altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
 cent 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
 tslash 0x14 altgr
 Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
 downarrow 0x16 altgr
 uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
 rightarrow 0x17 altgr
 idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
 oslash 0x18 altgr
-Ooblique 0x18 shift altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
 thorn 0x19 altgr
 THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 plus 0x1a
 asterisk 0x1a shift
 dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 dead_acute 0x1b
 dead_grave 0x1b shift
 dead_tilde 0x1b altgr
 dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
 ae 0x1e altgr
 AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
 ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
 eth 0x20 altgr
 ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
 dstroke 0x21 altgr
 ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
 eng 0x22 altgr
 ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
 hstroke 0x23 altgr
 Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
 kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
 lstroke 0x26 altgr
 Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 ccedilla 0x27
 Ccedilla 0x27 shift
+dead_acute 0x27 altgr
 dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 masculine 0x28
 ordfeminine 0x28 shift
 dead_circumflex 0x28 altgr
 dead_caron 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 backslash 0x29
 bar 0x29 shift
 notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 dead_tilde 0x2b
 dead_circumflex 0x2b shift
+dead_grave 0x2b altgr
 dead_breve 0x2b shift altgr
-less 0x56
-greater 0x56 shift
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
+masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 semicolon 0x33 shift
 horizconnector 0x33 altgr
 multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 colon 0x34 shift
 periodcentered 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 minus 0x35
 underscore 0x35 shift
 dead_belowdot 0x35 altgr
 dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+backslash 0x56 altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/pt-br b/pc-bios/keymaps/pt-br
index 54bafc5..fe9ec81 100644
--- a/pc-bios/keymaps/pt-br
+++ b/pc-bios/keymaps/pt-br
@@ -1,69 +1,834 @@
-# generated from XKB map br
-include common
-map 0x416
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : br
+#    variant : -
+#    options : -
+
+# name: "Portuguese (Brazil)"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
 onesuperior 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 at 0x03 shift
 twosuperior 0x03 altgr
 onehalf 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numbersign 0x04 shift
 threesuperior 0x04 altgr
 threequarters 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 dollar 0x05 shift
 sterling 0x05 altgr
 onequarter 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 cent 0x06 altgr
+threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 dead_diaeresis 0x07 shift
 notsign 0x07 altgr
 diaeresis 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 ampersand 0x08 shift
 braceleft 0x08 altgr
+seveneighths 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
 bracketleft 0x09 altgr
+trademark 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenleft 0x0a shift
 bracketright 0x0a altgr
+plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 parenright 0x0b shift
 braceright 0x0b altgr
+degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
 backslash 0x0c altgr
+questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
 section 0x0d altgr
+dead_ogonek 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
+slash 0x10 altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+question 0x11 altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 registered 0x13 altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+tslash 0x14 altgr
+Tslash 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
+leftarrow 0x15 altgr
+yen 0x15 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+downarrow 0x16 altgr
+uparrow 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+i 0x17
+I 0x17 shift
+rightarrow 0x17 altgr
+idotless 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+oslash 0x18 altgr
+Oslash 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+thorn 0x19 altgr
+THORN 0x19 shift altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 dead_acute 0x1a
 dead_grave 0x1a shift
 acute 0x1a altgr
 grave 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 bracketleft 0x1b
 braceleft 0x1b shift
 ordfeminine 0x1b altgr
+dead_macron 0x1b shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+ae 0x1e altgr
+AE 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+ssharp 0x1f altgr
+section 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+eth 0x20 altgr
+ETH 0x20 shift altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+dstroke 0x21 altgr
+ordfeminine 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+eng 0x22 altgr
+ENG 0x22 shift altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+hstroke 0x23 altgr
+Hstroke 0x23 shift altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+kra 0x25 altgr
+ampersand 0x25 shift altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+lstroke 0x26 altgr
+Lstroke 0x26 shift altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 ccedilla 0x27
 Ccedilla 0x27 shift
+dead_acute 0x27 altgr
+dead_doubleacute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 dead_tilde 0x28
 dead_circumflex 0x28 shift
 asciitilde 0x28 altgr
 asciicircum 0x28 shift altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
 apostrophe 0x29
 quotedbl 0x29 shift
+notsign 0x29 altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 bracketright 0x2b
 braceright 0x2b shift
 masculine 0x2b altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
+guillemotleft 0x2c altgr
+less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
+guillemotright 0x2d altgr
+greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 copyright 0x2e altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
+leftdoublequotemark 0x2f altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
+rightdoublequotemark 0x30 altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 comma 0x33
 less 0x33 shift
+horizconnector 0x33 altgr
+multiply 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 period 0x34
 greater 0x34 shift
+periodcentered 0x34 altgr
+division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 semicolon 0x35
 colon 0x35 shift
-comma 0x53 numlock
+dead_belowdot 0x35 altgr
+dead_abovedot 0x35 shift altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
 backslash 0x56
 bar 0x56 shift
+masculine 0x56 altgr
+dead_breve 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
 slash 0x73
 question 0x73 shift
 degree 0x73 altgr
-KP_Decimal 0x34
+questiondown 0x73 shift altgr
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/ru b/pc-bios/keymaps/ru
index 8f652d5..7566052 100644
--- a/pc-bios/keymaps/ru
+++ b/pc-bios/keymaps/ru
@@ -1,109 +1,748 @@
-# generated from XKB map ru
-include common
-map 0x419
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : ru
+#    variant : -
+#    options : -
+
+# name: "Russian"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
-at 0x03 shift
-quotedbl 0x03 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
+quotedbl 0x03 shift
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
 numerosign 0x04 shift
-dollar 0x05 shift
-asterisk 0x05 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
+semicolon 0x05 shift
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
-colon 0x06 shift altgr
-asciicircum 0x07 shift
-comma 0x07 shift altgr
-ampersand 0x08 shift
-period 0x08 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
+colon 0x07 shift
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
+question 0x08 shift
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 asterisk 0x09 shift
-semicolon 0x09 shift altgr
+U20BD 0x09 altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenleft 0x0a shift
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 parenright 0x0b shift
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 minus 0x0c
 underscore 0x0c shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 equal 0x0d
 plus 0x0d shift
-Cyrillic_shorti 0x10 altgr
-Cyrillic_SHORTI 0x10 shift altgr
-Cyrillic_tse 0x11 altgr
-Cyrillic_TSE 0x11 shift altgr
-Cyrillic_u 0x12 altgr
-Cyrillic_U 0x12 shift altgr
-Cyrillic_ka 0x13 altgr
-Cyrillic_KA 0x13 shift altgr
-Cyrillic_ie 0x14 altgr
-Cyrillic_IE 0x14 shift altgr
-Cyrillic_en 0x15 altgr
-Cyrillic_EN 0x15 shift altgr
-Cyrillic_ghe 0x16 altgr
-Cyrillic_GHE 0x16 shift altgr
-Cyrillic_sha 0x17 altgr
-Cyrillic_SHA 0x17 shift altgr
-Cyrillic_shcha 0x18 altgr
-Cyrillic_SHCHA 0x18 shift altgr
-Cyrillic_ze 0x19 altgr
-Cyrillic_ZE 0x19 shift altgr
-bracketleft 0x1a
-braceleft 0x1a shift
-Cyrillic_ha 0x1a altgr
-Cyrillic_HA 0x1a shift altgr
-bracketright 0x1b
-braceright 0x1b shift
-Cyrillic_hardsign 0x1b altgr
-Cyrillic_HARDSIGN 0x1b shift altgr
-Cyrillic_ef 0x1e altgr
-Cyrillic_EF 0x1e shift altgr
-Cyrillic_yeru 0x1f altgr
-Cyrillic_YERU 0x1f shift altgr
-Cyrillic_ve 0x20 altgr
-Cyrillic_VE 0x20 shift altgr
-Cyrillic_a 0x21 altgr
-Cyrillic_A 0x21 shift altgr
-Cyrillic_pe 0x22 altgr
-Cyrillic_PE 0x22 shift altgr
-Cyrillic_er 0x23 altgr
-Cyrillic_ER 0x23 shift altgr
-Cyrillic_o 0x24 altgr
-Cyrillic_O 0x24 shift altgr
-Cyrillic_el 0x25 altgr
-Cyrillic_EL 0x25 shift altgr
-Cyrillic_de 0x26 altgr
-Cyrillic_DE 0x26 shift altgr
-semicolon 0x27
-colon 0x27 shift
-Cyrillic_zhe 0x27 altgr
-Cyrillic_ZHE 0x27 shift altgr
-apostrophe 0x28
-quotedbl 0x28 shift
-Cyrillic_e 0x28 altgr
-Cyrillic_E 0x28 shift altgr
-grave 0x29
-asciitilde 0x29 shift
-Cyrillic_io 0x29 altgr
-Cyrillic_IO 0x29 shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+Cyrillic_shorti 0x10
+Cyrillic_SHORTI 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+Cyrillic_tse 0x11
+Cyrillic_TSE 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+Cyrillic_u 0x12
+Cyrillic_U 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+Cyrillic_ka 0x13
+Cyrillic_KA 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+Cyrillic_ie 0x14
+Cyrillic_IE 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+Cyrillic_en 0x15
+Cyrillic_EN 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+Cyrillic_ghe 0x16
+Cyrillic_GHE 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+Cyrillic_sha 0x17
+Cyrillic_SHA 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+Cyrillic_shcha 0x18
+Cyrillic_SHCHA 0x18 shift
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+Cyrillic_ze 0x19
+Cyrillic_ZE 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+Cyrillic_ha 0x1a
+Cyrillic_HA 0x1a shift
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+Cyrillic_hardsign 0x1b
+Cyrillic_HARDSIGN 0x1b shift
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+Cyrillic_ef 0x1e
+Cyrillic_EF 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+Cyrillic_yeru 0x1f
+Cyrillic_YERU 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+Cyrillic_ve 0x20
+Cyrillic_VE 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+Cyrillic_a 0x21
+Cyrillic_A 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+Cyrillic_pe 0x22
+Cyrillic_PE 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+Cyrillic_er 0x23
+Cyrillic_ER 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+Cyrillic_o 0x24
+Cyrillic_O 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+Cyrillic_el 0x25
+Cyrillic_EL 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+Cyrillic_de 0x26
+Cyrillic_DE 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+Cyrillic_zhe 0x27
+Cyrillic_ZHE 0x27 shift
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+Cyrillic_e 0x28
+Cyrillic_E 0x28 shift
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+Cyrillic_io 0x29
+Cyrillic_IO 0x29 shift
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 backslash 0x2b
-bar 0x2b shift
-Cyrillic_ya 0x2c altgr
-Cyrillic_YA 0x2c shift altgr
-Cyrillic_che 0x2d altgr
-Cyrillic_CHE 0x2d shift altgr
-Cyrillic_es 0x2e altgr
-Cyrillic_ES 0x2e shift altgr
-Cyrillic_em 0x2f altgr
-Cyrillic_EM 0x2f shift altgr
-Cyrillic_i 0x30 altgr
-Cyrillic_I 0x30 shift altgr
-Cyrillic_te 0x31 altgr
-Cyrillic_TE 0x31 shift altgr
-Cyrillic_softsign 0x32 altgr
-Cyrillic_SOFTSIGN 0x32 shift altgr
-comma 0x33
-less 0x33 shift
-Cyrillic_be 0x33 altgr
-Cyrillic_BE 0x33 shift altgr
-period 0x34
-greater 0x34 shift
-Cyrillic_yu 0x34 altgr
-Cyrillic_YU 0x34 shift altgr
-slash 0x35
-question 0x35 shift
-slash 0x56 altgr
-bar 0x56 shift altgr
+slash 0x2b shift
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+Cyrillic_ya 0x2c
+Cyrillic_YA 0x2c shift
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+Cyrillic_che 0x2d
+Cyrillic_CHE 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+Cyrillic_es 0x2e
+Cyrillic_ES 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+Cyrillic_em 0x2f
+Cyrillic_EM 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+Cyrillic_i 0x30
+Cyrillic_I 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+Cyrillic_te 0x31
+Cyrillic_TE 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+Cyrillic_softsign 0x32
+Cyrillic_SOFTSIGN 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
+Cyrillic_be 0x33
+Cyrillic_BE 0x33 shift
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
+Cyrillic_yu 0x34
+Cyrillic_YU 0x34 shift
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+period 0x35
+comma 0x35 shift
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+slash 0x56
+bar 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/th b/pc-bios/keymaps/th
index b65b6da..56a0135 100644
--- a/pc-bios/keymaps/th
+++ b/pc-bios/keymaps/th
@@ -1,131 +1,747 @@
-# generated from XKB map th
-include common
-map 0x41e
-exclam 0x02 shift
-Thai_lakkhangyao 0x02 altgr
-plus 0x02 shift altgr
-at 0x03 shift
-slash 0x03 altgr
-Thai_leknung 0x03 shift altgr
-numbersign 0x04 shift
-minus 0x04 altgr
-Thai_leksong 0x04 shift altgr
-dollar 0x05 shift
-Thai_phosamphao 0x05 altgr
-Thai_leksam 0x05 shift altgr
-percent 0x06 shift
-Thai_thothung 0x06 altgr
-Thai_leksi 0x06 shift altgr
-asciicircum 0x07 shift
-Thai_sarau 0x07 altgr
-Thai_sarauu 0x07 shift altgr
-ampersand 0x08 shift
-Thai_saraue 0x08 altgr
-Thai_baht 0x08 shift altgr
-asterisk 0x09 shift
-Thai_khokhwai 0x09 altgr
-Thai_lekha 0x09 shift altgr
-parenleft 0x0a shift
-Thai_totao 0x0a altgr
-Thai_lekhok 0x0a shift altgr
-parenright 0x0b shift
-Thai_chochan 0x0b altgr
-Thai_lekchet 0x0b shift altgr
-minus 0x0c
-underscore 0x0c shift
-Thai_khokhai 0x0c altgr
-Thai_lekpaet 0x0c shift altgr
-equal 0x0d
-plus 0x0d shift
-Thai_chochang 0x0d altgr
-Thai_lekkao 0x0d shift altgr
-Thai_maiyamok 0x10 altgr
-Thai_leksun 0x10 shift altgr
-Thai_saraaimaimalai 0x11 altgr
-quotedbl 0x11 shift altgr
-Thai_saraam 0x12 altgr
-Thai_dochada 0x12 shift altgr
-Thai_phophan 0x13 altgr
-Thai_thonangmontho 0x13 shift altgr
-Thai_saraa 0x14 altgr
-Thai_thothong 0x14 shift altgr
-Thai_maihanakat 0x15 altgr
-Thai_nikhahit 0x15 shift altgr
-Thai_saraii 0x16 altgr
-Thai_maitri 0x16 shift altgr
-Thai_rorua 0x17 altgr
-Thai_nonen 0x17 shift altgr
-Thai_nonu 0x18 altgr
-Thai_paiyannoi 0x18 shift altgr
-Thai_yoyak 0x19 altgr
-Thai_yoying 0x19 shift altgr
-bracketleft 0x1a
-braceleft 0x1a shift
-Thai_bobaimai 0x1a altgr
-Thai_thothan 0x1a shift altgr
-bracketright 0x1b
-braceright 0x1b shift
-Thai_loling 0x1b altgr
-comma 0x1b shift altgr
-Thai_fofan 0x1e altgr
-Thai_ru 0x1e shift altgr
-Thai_hohip 0x1f altgr
-Thai_khorakhang 0x1f shift altgr
-Thai_kokai 0x20 altgr
-Thai_topatak 0x20 shift altgr
-Thai_dodek 0x21 altgr
-Thai_sarao 0x21 shift altgr
-Thai_sarae 0x22 altgr
-Thai_chochoe 0x22 shift altgr
-Thai_maitho 0x23 altgr
-Thai_maitaikhu 0x23 shift altgr
-Thai_maiek 0x24 altgr
-Thai_maichattawa 0x24 shift altgr
-Thai_saraaa 0x25 altgr
-Thai_sorusi 0x25 shift altgr
-Thai_sosua 0x26 altgr
-Thai_sosala 0x26 shift altgr
-semicolon 0x27
-colon 0x27 shift
-Thai_wowaen 0x27 altgr
-Thai_soso 0x27 shift altgr
-apostrophe 0x28
-quotedbl 0x28 shift
-Thai_ngongu 0x28 altgr
-period 0x28 shift altgr
-grave 0x29
-asciitilde 0x29 shift
-underscore 0x29 altgr
-percent 0x29 shift altgr
-ISO_First_Group 0x2a shift
-backslash 0x2b
-bar 0x2b shift
-Thai_khokhuat 0x2b altgr
-Thai_khokhon 0x2b shift altgr
-Thai_phophung 0x2c altgr
-parenleft 0x2c shift altgr
-Thai_popla 0x2d altgr
-parenright 0x2d shift altgr
-Thai_saraae 0x2e altgr
-Thai_choching 0x2e shift altgr
-Thai_oang 0x2f altgr
-Thai_honokhuk 0x2f shift altgr
-Thai_sarai 0x30 altgr
-Thai_phinthu 0x30 shift altgr
-Thai_sarauee 0x31 altgr
-Thai_thanthakhat 0x31 shift altgr
-Thai_thothahan 0x32 altgr
-question 0x32 shift altgr
-comma 0x33
-less 0x33 shift
-Thai_moma 0x33 altgr
-Thai_thophuthao 0x33 shift altgr
-period 0x34
-greater 0x34 shift
-Thai_saraaimaimuan 0x34 altgr
-Thai_lochula 0x34 shift altgr
-slash 0x35
-question 0x35 shift
-Thai_fofa 0x35 altgr
-Thai_lu 0x35 shift altgr
-ISO_Last_Group 0x36 shift
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : th
+#    variant : -
+#    options : -
+
+# name: "Thai"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+Thai_lakkhangyao 0x02
+plus 0x02 shift
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+slash 0x03
+Thai_leknung 0x03 shift
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+minus 0x04
+Thai_leksong 0x04 shift
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+Thai_phosamphao 0x05
+Thai_leksam 0x05 shift
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+Thai_thothung 0x06
+Thai_leksi 0x06 shift
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+Thai_sarau 0x07
+Thai_sarauu 0x07 shift
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+Thai_saraue 0x08
+Thai_baht 0x08 shift
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+Thai_khokhwai 0x09
+Thai_lekha 0x09 shift
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+Thai_totao 0x0a
+Thai_lekhok 0x0a shift
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+Thai_chochan 0x0b
+Thai_lekchet 0x0b shift
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
+Thai_khokhai 0x0c
+Thai_lekpaet 0x0c shift
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
+Thai_chochang 0x0d
+Thai_lekkao 0x0d shift
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+Thai_maiyamok 0x10
+Thai_leksun 0x10 shift
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+Thai_saraaimaimalai 0x11
+quotedbl 0x11 shift
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+Thai_saraam 0x12
+Thai_dochada 0x12 shift
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+Thai_phophan 0x13
+Thai_thonangmontho 0x13 shift
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+Thai_saraa 0x14
+Thai_thothong 0x14 shift
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+Thai_maihanakat 0x15
+Thai_nikhahit 0x15 shift
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+Thai_saraii 0x16
+Thai_maitri 0x16 shift
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
+Thai_rorua 0x17
+Thai_nonen 0x17 shift
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+Thai_nonu 0x18
+Thai_paiyannoi 0x18 shift
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+Thai_yoyak 0x19
+Thai_yoying 0x19 shift
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
+Thai_bobaimai 0x1a
+Thai_thothan 0x1a shift
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
+Thai_loling 0x1b
+comma 0x1b shift
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+Thai_fofan 0x1e
+Thai_ru 0x1e shift
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+Thai_hohip 0x1f
+Thai_khorakhang 0x1f shift
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+Thai_kokai 0x20
+Thai_topatak 0x20 shift
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+Thai_dodek 0x21
+Thai_sarao 0x21 shift
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+Thai_sarae 0x22
+Thai_chochoe 0x22 shift
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+Thai_maitho 0x23
+Thai_maitaikhu 0x23 shift
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+Thai_maiek 0x24
+Thai_maichattawa 0x24 shift
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+Thai_saraaa 0x25
+Thai_sorusi 0x25 shift
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+Thai_sosua 0x26
+Thai_sosala 0x26 shift
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
+Thai_wowaen 0x27
+Thai_soso 0x27 shift
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
+Thai_ngongu 0x28
+period 0x28 shift
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+underscore 0x29
+percent 0x29 shift
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
+Thai_khokhuat 0x2b
+Thai_khokhon 0x2b shift
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+Thai_phophung 0x2c
+parenleft 0x2c shift
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+Thai_popla 0x2d
+parenright 0x2d shift
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+Thai_saraae 0x2e
+Thai_choching 0x2e shift
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+Thai_oang 0x2f
+Thai_honokhuk 0x2f shift
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+Thai_sarai 0x30
+Thai_phinthu 0x30 shift
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+Thai_sarauee 0x31
+Thai_thanthakhat 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+Thai_thothahan 0x32
+question 0x32 shift
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
+Thai_moma 0x33
+Thai_thophuthao 0x33 shift
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
+Thai_saraaimaimuan 0x34
+Thai_lochula 0x34 shift
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
+Thai_fofa 0x35
+Thai_lu 0x35 shift
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Decimal 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+Alt_R 0xb8
+Meta_R 0xb8 shift
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/pc-bios/keymaps/tr b/pc-bios/keymaps/tr
index 5650e1e..4d1a4c3 100644
--- a/pc-bios/keymaps/tr
+++ b/pc-bios/keymaps/tr
@@ -1,123 +1,830 @@
-# generated from XKB map tr
-include common
-map 0x41f
+#
+# generated by qemu-keymap
+#    model   : pc105
+#    layout  : tr
+#    variant : -
+#    options : -
+
+# name: "Turkish"
+
+# modifiers
+#     0: Shift
+#     1: Lock
+#     2: Control
+#     3: Mod1
+#     4: Mod2
+#     5: Mod3
+#     6: Mod4
+#     7: Mod5
+#     8: NumLock
+#     9: Alt
+#    10: LevelThree
+#    11: LAlt
+#    12: RAlt
+#    13: RControl
+#    14: LControl
+#    15: ScrollLock
+#    16: LevelFive
+#    17: AltGr
+#    18: Meta
+#    19: Super
+#    20: Hyper
+
+# evdev 1 (0x1), QKeyCode "esc", number 0x1
+Escape 0x01
+
+# evdev 2 (0x2), QKeyCode "1", number 0x2
+1 0x02
 exclam 0x02 shift
-onesuperior 0x02 altgr
+greater 0x02 altgr
 exclamdown 0x02 shift altgr
+
+# evdev 3 (0x3), QKeyCode "2", number 0x3
+2 0x03
 apostrophe 0x03 shift
-at 0x03 altgr
-oneeighth 0x03 shift altgr
-dead_circumflex 0x04 shift
+sterling 0x03 altgr
+twosuperior 0x03 shift altgr
+
+# evdev 4 (0x4), QKeyCode "3", number 0x4
+3 0x04
+asciicircum 0x04 shift
 numbersign 0x04 altgr
-sterling 0x04 shift altgr
+threesuperior 0x04 shift altgr
+
+# evdev 5 (0x5), QKeyCode "4", number 0x5
+4 0x05
 plus 0x05 shift
 dollar 0x05 altgr
+onequarter 0x05 shift altgr
+
+# evdev 6 (0x6), QKeyCode "5", number 0x6
+5 0x06
 percent 0x06 shift
 onehalf 0x06 altgr
 threeeighths 0x06 shift altgr
+
+# evdev 7 (0x7), QKeyCode "6", number 0x7
+6 0x07
 ampersand 0x07 shift
-asciicircum 0x07 altgr
-fiveeighths 0x07 shift altgr
+threequarters 0x07 altgr
+VoidSymbol 0x07 shift altgr
+
+# evdev 8 (0x8), QKeyCode "7", number 0x8
+7 0x08
 slash 0x08 shift
 braceleft 0x08 altgr
-seveneighths 0x08 shift altgr
+VoidSymbol 0x08 shift altgr
+
+# evdev 9 (0x9), QKeyCode "8", number 0x9
+8 0x09
 parenleft 0x09 shift
 bracketleft 0x09 altgr
-trademark 0x09 shift altgr
+VoidSymbol 0x09 shift altgr
+
+# evdev 10 (0xa), QKeyCode "9", number 0xa
+9 0x0a
 parenright 0x0a shift
 bracketright 0x0a altgr
 plusminus 0x0a shift altgr
+
+# evdev 11 (0xb), QKeyCode "0", number 0xb
+0 0x0b
 equal 0x0b shift
 braceright 0x0b altgr
 degree 0x0b shift altgr
+
+# evdev 12 (0xc), QKeyCode "minus", number 0xc
 asterisk 0x0c
 question 0x0c shift
 backslash 0x0c altgr
 questiondown 0x0c shift altgr
+
+# evdev 13 (0xd), QKeyCode "equal", number 0xd
 minus 0x0d
 underscore 0x0d shift
-dead_cedilla 0x0d altgr
-dead_ogonek 0x0d shift altgr
+bar 0x0d altgr
+VoidSymbol 0x0d shift altgr
+
+# evdev 14 (0xe), QKeyCode "backspace", number 0xe
+BackSpace 0x0e
+
+# evdev 15 (0xf), QKeyCode "tab", number 0xf
+Tab 0x0f
+ISO_Left_Tab 0x0f shift
+
+# evdev 16 (0x10), QKeyCode "q", number 0x10
+q 0x10
+Q 0x10 shift
 at 0x10 altgr
 Greek_OMEGA 0x10 shift altgr
-lstroke 0x11 altgr
-Lstroke 0x11 shift altgr
+
+# evdev 17 (0x11), QKeyCode "w", number 0x11
+w 0x11
+W 0x11 shift
+VoidSymbol 0x11 altgr
+
+# evdev 18 (0x12), QKeyCode "e", number 0x12
+e 0x12
+E 0x12 shift
 EuroSign 0x12 altgr
+VoidSymbol 0x12 shift altgr
+
+# evdev 19 (0x13), QKeyCode "r", number 0x13
+r 0x13
+R 0x13 shift
 paragraph 0x13 altgr
 registered 0x13 shift altgr
-tslash 0x14 altgr
-Tslash 0x14 shift altgr
+
+# evdev 20 (0x14), QKeyCode "t", number 0x14
+t 0x14
+T 0x14 shift
+U20BA 0x14 altgr
+VoidSymbol 0x14 shift altgr
+
+# evdev 21 (0x15), QKeyCode "y", number 0x15
+y 0x15
+Y 0x15 shift
 leftarrow 0x15 altgr
 yen 0x15 shift altgr
-downarrow 0x16 altgr
-uparrow 0x16 shift altgr
+
+# evdev 22 (0x16), QKeyCode "u", number 0x16
+u 0x16
+U 0x16 shift
+ucircumflex 0x16 altgr
+Ucircumflex 0x16 shift altgr
+
+# evdev 23 (0x17), QKeyCode "i", number 0x17
 idotless 0x17
 I 0x17 shift
-rightarrow 0x17 altgr
-oslash 0x18 altgr
-Ooblique 0x18 shift altgr
-thorn 0x19 altgr
-THORN 0x19 shift altgr
+icircumflex 0x17 altgr
+Icircumflex 0x17 shift altgr
+
+# evdev 24 (0x18), QKeyCode "o", number 0x18
+o 0x18
+O 0x18 shift
+ocircumflex 0x18 altgr
+Ocircumflex 0x18 shift altgr
+
+# evdev 25 (0x19), QKeyCode "p", number 0x19
+p 0x19
+P 0x19 shift
+VoidSymbol 0x19 altgr
+
+# evdev 26 (0x1a), QKeyCode "bracket_left", number 0x1a
 gbreve 0x1a
 Gbreve 0x1a shift
 dead_diaeresis 0x1a altgr
 dead_abovering 0x1a shift altgr
+
+# evdev 27 (0x1b), QKeyCode "bracket_right", number 0x1b
 udiaeresis 0x1b
 Udiaeresis 0x1b shift
 asciitilde 0x1b altgr
 dead_macron 0x1b shift altgr
-ae 0x1e altgr
-AE 0x1e shift altgr
-ssharp 0x1f altgr
-section 0x1f shift altgr
-eth 0x20 altgr
-ETH 0x20 shift altgr
-dstroke 0x21 altgr
-ordfeminine 0x21 shift altgr
-eng 0x22 altgr
-ENG 0x22 shift altgr
-hstroke 0x23 altgr
-Hstroke 0x23 shift altgr
-kra 0x25 altgr
-ampersand 0x25 shift altgr
-lstroke 0x26 altgr
-Lstroke 0x26 shift altgr
+
+# evdev 28 (0x1c), QKeyCode "ret", number 0x1c
+Return 0x1c
+
+# evdev 29 (0x1d), QKeyCode "ctrl", number 0x1d
+Control_L 0x1d
+
+# evdev 30 (0x1e), QKeyCode "a", number 0x1e
+a 0x1e
+A 0x1e shift
+acircumflex 0x1e altgr
+Acircumflex 0x1e shift altgr
+
+# evdev 31 (0x1f), QKeyCode "s", number 0x1f
+s 0x1f
+S 0x1f shift
+section 0x1f altgr
+VoidSymbol 0x1f shift altgr
+
+# evdev 32 (0x20), QKeyCode "d", number 0x20
+d 0x20
+D 0x20 shift
+VoidSymbol 0x20 altgr
+
+# evdev 33 (0x21), QKeyCode "f", number 0x21
+f 0x21
+F 0x21 shift
+ordfeminine 0x21 altgr
+VoidSymbol 0x21 shift altgr
+
+# evdev 34 (0x22), QKeyCode "g", number 0x22
+g 0x22
+G 0x22 shift
+VoidSymbol 0x22 altgr
+
+# evdev 35 (0x23), QKeyCode "h", number 0x23
+h 0x23
+H 0x23 shift
+VoidSymbol 0x23 altgr
+
+# evdev 36 (0x24), QKeyCode "j", number 0x24
+j 0x24
+J 0x24 shift
+dead_hook 0x24 altgr
+dead_horn 0x24 shift altgr
+
+# evdev 37 (0x25), QKeyCode "k", number 0x25
+k 0x25
+K 0x25 shift
+VoidSymbol 0x25 altgr
+
+# evdev 38 (0x26), QKeyCode "l", number 0x26
+l 0x26
+L 0x26 shift
+VoidSymbol 0x26 altgr
+
+# evdev 39 (0x27), QKeyCode "semicolon", number 0x27
 scedilla 0x27
 Scedilla 0x27 shift
-dead_acute 0x27 altgr
-dead_doubleacute 0x27 shift altgr
+acute 0x27 altgr
+dead_acute 0x27 shift altgr
+
+# evdev 40 (0x28), QKeyCode "apostrophe", number 0x28
 i 0x28
 Iabovedot 0x28 shift
-dead_circumflex 0x28 altgr
+apostrophe 0x28 altgr
 dead_caron 0x28 shift altgr
-backslash 0x29
-quotedbl 0x29 shift
-asciitilde 0x29 altgr
+
+# evdev 41 (0x29), QKeyCode "grave_accent", number 0x29
+quotedbl 0x29
+eacute 0x29 shift
+less 0x29 altgr
+degree 0x29 shift altgr
+
+# evdev 42 (0x2a), QKeyCode "shift", number 0x2a
+Shift_L 0x2a
+
+# evdev 43 (0x2b), QKeyCode "backslash", number 0x2b
 comma 0x2b
 semicolon 0x2b shift
-bar 0x2b altgr
-dead_breve 0x2b shift altgr
+grave 0x2b altgr
+dead_grave 0x2b shift altgr
+
+# evdev 44 (0x2c), QKeyCode "z", number 0x2c
+z 0x2c
+Z 0x2c shift
 guillemotleft 0x2c altgr
 less 0x2c shift altgr
+
+# evdev 45 (0x2d), QKeyCode "x", number 0x2d
+x 0x2d
+X 0x2d shift
 guillemotright 0x2d altgr
 greater 0x2d shift altgr
+
+# evdev 46 (0x2e), QKeyCode "c", number 0x2e
+c 0x2e
+C 0x2e shift
 cent 0x2e altgr
 copyright 0x2e shift altgr
+
+# evdev 47 (0x2f), QKeyCode "v", number 0x2f
+v 0x2f
+V 0x2f shift
 leftdoublequotemark 0x2f altgr
-grave 0x2f shift altgr
+leftsinglequotemark 0x2f shift altgr
+
+# evdev 48 (0x30), QKeyCode "b", number 0x30
+b 0x30
+B 0x30 shift
 rightdoublequotemark 0x30 altgr
-apostrophe 0x30 shift altgr
+rightsinglequotemark 0x30 shift altgr
+
+# evdev 49 (0x31), QKeyCode "n", number 0x31
+n 0x31
+N 0x31 shift
+
+# evdev 50 (0x32), QKeyCode "m", number 0x32
+m 0x32
+M 0x32 shift
 mu 0x32 altgr
 masculine 0x32 shift altgr
+
+# evdev 51 (0x33), QKeyCode "comma", number 0x33
 odiaeresis 0x33
 Odiaeresis 0x33 shift
-less 0x33 altgr
-multiply 0x33 shift altgr
+multiply 0x33 altgr
+VoidSymbol 0x33 shift altgr
+
+# evdev 52 (0x34), QKeyCode "dot", number 0x34
 ccedilla 0x34
 Ccedilla 0x34 shift
-greater 0x34 altgr
+periodcentered 0x34 altgr
 division 0x34 shift altgr
+
+# evdev 53 (0x35), QKeyCode "slash", number 0x35
 period 0x35
 colon 0x35 shift
-dead_belowdot 0x35 altgr
-dead_abovedot 0x35 shift altgr
+dead_abovedot 0x35 altgr
+
+# evdev 54 (0x36), QKeyCode "shift_r", number 0x36
+Shift_R 0x36
+
+# evdev 55 (0x37), QKeyCode "kp_multiply", number 0x37
+KP_Multiply 0x37
+
+# evdev 56 (0x38), QKeyCode "alt", number 0x38
+Alt_L 0x38
+Meta_L 0x38 shift
+
+# evdev 57 (0x39), QKeyCode "spc", number 0x39
+space 0x39
+
+# evdev 58 (0x3a), QKeyCode "caps_lock", number 0x3a
+Caps_Lock 0x3a
+
+# evdev 59 (0x3b), QKeyCode "f1", number 0x3b
+F1 0x3b
+
+# evdev 60 (0x3c), QKeyCode "f2", number 0x3c
+F2 0x3c
+
+# evdev 61 (0x3d), QKeyCode "f3", number 0x3d
+F3 0x3d
+
+# evdev 62 (0x3e), QKeyCode "f4", number 0x3e
+F4 0x3e
+
+# evdev 63 (0x3f), QKeyCode "f5", number 0x3f
+F5 0x3f
+
+# evdev 64 (0x40), QKeyCode "f6", number 0x40
+F6 0x40
+
+# evdev 65 (0x41), QKeyCode "f7", number 0x41
+F7 0x41
+
+# evdev 66 (0x42), QKeyCode "f8", number 0x42
+F8 0x42
+
+# evdev 67 (0x43), QKeyCode "f9", number 0x43
+F9 0x43
+
+# evdev 68 (0x44), QKeyCode "f10", number 0x44
+F10 0x44
+
+# evdev 69 (0x45), QKeyCode "num_lock", number 0x45
+Num_Lock 0x45
+
+# evdev 70 (0x46), QKeyCode "scroll_lock", number 0x46
+Scroll_Lock 0x46
+
+# evdev 71 (0x47), QKeyCode "kp_7", number 0x47
+KP_Home 0x47
+KP_7 0x47 numlock
+
+# evdev 72 (0x48), QKeyCode "kp_8", number 0x48
+KP_Up 0x48
+KP_8 0x48 numlock
+
+# evdev 73 (0x49), QKeyCode "kp_9", number 0x49
+KP_Prior 0x49
+KP_9 0x49 numlock
+
+# evdev 74 (0x4a), QKeyCode "kp_subtract", number 0x4a
+KP_Subtract 0x4a
+
+# evdev 75 (0x4b), QKeyCode "kp_4", number 0x4b
+KP_Left 0x4b
+KP_4 0x4b numlock
+
+# evdev 76 (0x4c), QKeyCode "kp_5", number 0x4c
+KP_Begin 0x4c
+KP_5 0x4c numlock
+
+# evdev 77 (0x4d), QKeyCode "kp_6", number 0x4d
+KP_Right 0x4d
+KP_6 0x4d numlock
+
+# evdev 78 (0x4e), QKeyCode "kp_add", number 0x4e
+KP_Add 0x4e
+
+# evdev 79 (0x4f), QKeyCode "kp_1", number 0x4f
+KP_End 0x4f
+KP_1 0x4f numlock
+
+# evdev 80 (0x50), QKeyCode "kp_2", number 0x50
+KP_Down 0x50
+KP_2 0x50 numlock
+
+# evdev 81 (0x51), QKeyCode "kp_3", number 0x51
+KP_Next 0x51
+KP_3 0x51 numlock
+
+# evdev 82 (0x52), QKeyCode "kp_0", number 0x52
+KP_Insert 0x52
+KP_0 0x52 numlock
+
+# evdev 83 (0x53), QKeyCode "kp_decimal", number 0x53
+KP_Delete 0x53
+KP_Separator 0x53 numlock
+
+# evdev 84 (0x54): no evdev -> QKeyCode mapping (xkb keysym ISO_Level3_Shift)
+
+# evdev 85 (0x55): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 86 (0x56), QKeyCode "less", number 0x56
+less 0x56
+greater 0x56 shift
+bar 0x56 altgr
+brokenbar 0x56 shift altgr
+
+# evdev 87 (0x57), QKeyCode "f11", number 0x57
+F11 0x57
+
+# evdev 88 (0x58), QKeyCode "f12", number 0x58
+F12 0x58
+
+# evdev 89 (0x59), QKeyCode "ro", number 0x73
+
+# evdev 90 (0x5a): no evdev -> QKeyCode mapping (xkb keysym Katakana)
+
+# evdev 91 (0x5b), QKeyCode "hiragana", number 0x77
+Hiragana 0x77
+
+# evdev 92 (0x5c), QKeyCode "henkan", number 0x79
+Henkan_Mode 0x79
+
+# evdev 93 (0x5d): no evdev -> QKeyCode mapping (xkb keysym Hiragana_Katakana)
+
+# evdev 94 (0x5e): no evdev -> QKeyCode mapping (xkb keysym Muhenkan)
+
+# evdev 95 (0x5f): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 96 (0x60), QKeyCode "kp_enter", number 0x9c
+KP_Enter 0x9c
+
+# evdev 97 (0x61), QKeyCode "ctrl_r", number 0x9d
+Control_R 0x9d
+
+# evdev 98 (0x62), QKeyCode "kp_divide", number 0xb5
+KP_Divide 0xb5
+
+# evdev 99 (0x63), QKeyCode "sysrq", number 0x54
+Print 0x54
+
+# evdev 100 (0x64), QKeyCode "alt_r", number 0xb8
+ISO_Level3_Shift 0xb8
+
+# evdev 101 (0x65), QKeyCode "lf", number 0x5b
+Linefeed 0x5b
+
+# evdev 102 (0x66), QKeyCode "home", number 0xc7
+Home 0xc7
+
+# evdev 103 (0x67), QKeyCode "up", number 0xc8
+Up 0xc8
+
+# evdev 104 (0x68), QKeyCode "pgup", number 0xc9
+Prior 0xc9
+
+# evdev 105 (0x69), QKeyCode "left", number 0xcb
+Left 0xcb
+
+# evdev 106 (0x6a), QKeyCode "right", number 0xcd
+Right 0xcd
+
+# evdev 107 (0x6b), QKeyCode "end", number 0xcf
+End 0xcf
+
+# evdev 108 (0x6c), QKeyCode "down", number 0xd0
+Down 0xd0
+
+# evdev 109 (0x6d), QKeyCode "pgdn", number 0xd1
+Next 0xd1
+
+# evdev 110 (0x6e), QKeyCode "insert", number 0xd2
+Insert 0xd2
+
+# evdev 111 (0x6f), QKeyCode "delete", number 0xd3
+Delete 0xd3
+
+# evdev 112 (0x70): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 113 (0x71), QKeyCode "audiomute", number 0xa0
+XF86AudioMute 0xa0
+
+# evdev 114 (0x72), QKeyCode "volumedown", number 0xae
+XF86AudioLowerVolume 0xae
+
+# evdev 115 (0x73), QKeyCode "volumeup", number 0xb0
+XF86AudioRaiseVolume 0xb0
+
+# evdev 116 (0x74), QKeyCode "power", number 0xde
+XF86PowerOff 0xde
+
+# evdev 117 (0x75), QKeyCode "kp_equals", number 0x59
+KP_Equal 0x59
+
+# evdev 118 (0x76): no evdev -> QKeyCode mapping (xkb keysym plusminus)
+
+# evdev 119 (0x77), QKeyCode "pause", number 0xc6
+Pause 0xc6
+
+# evdev 120 (0x78): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchA)
+
+# evdev 121 (0x79), QKeyCode "kp_comma", number 0x7e
+KP_Decimal 0x7e
+
+# evdev 122 (0x7a): no evdev -> QKeyCode mapping (xkb keysym Hangul)
+
+# evdev 123 (0x7b): no evdev -> QKeyCode mapping (xkb keysym Hangul_Hanja)
+
+# evdev 124 (0x7c), QKeyCode "yen", number 0x7d
+
+# evdev 125 (0x7d), QKeyCode "meta_l", number 0xdb
+Super_L 0xdb
+
+# evdev 126 (0x7e), QKeyCode "meta_r", number 0xdc
+Super_R 0xdc
+
+# evdev 127 (0x7f), QKeyCode "compose", number 0xdd
+Menu 0xdd
+
+# evdev 128 (0x80), QKeyCode "stop", number 0xe8
+Cancel 0xe8
+
+# evdev 129 (0x81), QKeyCode "again", number 0x85
+Redo 0x85
+
+# evdev 130 (0x82), QKeyCode "props", number 0x86
+SunProps 0x86
+
+# evdev 131 (0x83), QKeyCode "undo", number 0x87
+Undo 0x87
+
+# evdev 132 (0x84), QKeyCode "front", number 0x8c
+SunFront 0x8c
+
+# evdev 133 (0x85), QKeyCode "copy", number 0xf8
+XF86Copy 0xf8
+
+# evdev 134 (0x86), QKeyCode "open", number 0x64
+XF86Open 0x64
+
+# evdev 135 (0x87), QKeyCode "paste", number 0x65
+XF86Paste 0x65
+
+# evdev 136 (0x88), QKeyCode "find", number 0xc1
+Find 0xc1
+
+# evdev 137 (0x89), QKeyCode "cut", number 0xbc
+XF86Cut 0xbc
+
+# evdev 138 (0x8a), QKeyCode "help", number 0xf5
+Help 0xf5
+
+# evdev 139 (0x8b), QKeyCode "menu", number 0x9e
+XF86MenuKB 0x9e
+
+# evdev 140 (0x8c), QKeyCode "calculator", number 0xa1
+XF86Calculator 0xa1
+
+# evdev 141 (0x8d): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 142 (0x8e), QKeyCode "sleep", number 0xdf
+XF86Sleep 0xdf
+
+# evdev 143 (0x8f), QKeyCode "wake", number 0xe3
+XF86WakeUp 0xe3
+
+# evdev 144 (0x90): no evdev -> QKeyCode mapping (xkb keysym XF86Explorer)
+
+# evdev 145 (0x91): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 146 (0x92): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 147 (0x93): no evdev -> QKeyCode mapping (xkb keysym XF86Xfer)
+
+# evdev 148 (0x94): no evdev -> QKeyCode mapping (xkb keysym XF86Launch1)
+
+# evdev 149 (0x95): no evdev -> QKeyCode mapping (xkb keysym XF86Launch2)
+
+# evdev 150 (0x96): no evdev -> QKeyCode mapping (xkb keysym XF86WWW)
+
+# evdev 151 (0x97): no evdev -> QKeyCode mapping (xkb keysym XF86DOS)
+
+# evdev 152 (0x98): no evdev -> QKeyCode mapping (xkb keysym XF86ScreenSaver)
+
+# evdev 153 (0x99): no evdev -> QKeyCode mapping (xkb keysym XF86RotateWindows)
+
+# evdev 154 (0x9a): no evdev -> QKeyCode mapping (xkb keysym XF86TaskPane)
+
+# evdev 155 (0x9b), QKeyCode "mail", number 0xec
+XF86Mail 0xec
+
+# evdev 156 (0x9c), QKeyCode "ac_bookmarks", number 0xe6
+XF86Favorites 0xe6
+
+# evdev 157 (0x9d), QKeyCode "computer", number 0xeb
+XF86MyComputer 0xeb
+
+# evdev 158 (0x9e), QKeyCode "ac_back", number 0xea
+XF86Back 0xea
+
+# evdev 159 (0x9f), QKeyCode "ac_forward", number 0xe9
+XF86Forward 0xe9
+
+# evdev 160 (0xa0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 161 (0xa1): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 162 (0xa2): no evdev -> QKeyCode mapping (xkb keysym XF86Eject)
+
+# evdev 163 (0xa3), QKeyCode "audionext", number 0x99
+XF86AudioNext 0x99
+
+# evdev 164 (0xa4), QKeyCode "audioplay", number 0xa2
+XF86AudioPlay 0xa2
+XF86AudioPause 0xa2 shift
+
+# evdev 165 (0xa5), QKeyCode "audioprev", number 0x90
+XF86AudioPrev 0x90
+
+# evdev 166 (0xa6), QKeyCode "audiostop", number 0xa4
+XF86AudioStop 0xa4
+XF86Eject 0xa4 shift
+
+# evdev 167 (0xa7): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRecord)
+
+# evdev 168 (0xa8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioRewind)
+
+# evdev 169 (0xa9): no evdev -> QKeyCode mapping (xkb keysym XF86Phone)
+
+# evdev 170 (0xaa): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 171 (0xab): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 172 (0xac), QKeyCode "ac_home", number 0xb2
+XF86HomePage 0xb2
+
+# evdev 173 (0xad), QKeyCode "ac_refresh", number 0xe7
+XF86Reload 0xe7
+
+# evdev 174 (0xae): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 175 (0xaf): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 176 (0xb0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 177 (0xb1): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollUp)
+
+# evdev 178 (0xb2): no evdev -> QKeyCode mapping (xkb keysym XF86ScrollDown)
+
+# evdev 179 (0xb3): no evdev -> QKeyCode mapping (xkb keysym parenleft)
+
+# evdev 180 (0xb4): no evdev -> QKeyCode mapping (xkb keysym parenright)
+
+# evdev 181 (0xb5): no evdev -> QKeyCode mapping (xkb keysym XF86New)
+
+# evdev 182 (0xb6): no evdev -> QKeyCode mapping (xkb keysym Redo)
+
+# evdev 183 (0xb7): no evdev -> QKeyCode mapping (xkb keysym XF86Tools)
+
+# evdev 184 (0xb8): no evdev -> QKeyCode mapping (xkb keysym XF86Launch5)
+
+# evdev 185 (0xb9): no evdev -> QKeyCode mapping (xkb keysym XF86Launch6)
+
+# evdev 186 (0xba): no evdev -> QKeyCode mapping (xkb keysym XF86Launch7)
+
+# evdev 187 (0xbb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch8)
+
+# evdev 188 (0xbc): no evdev -> QKeyCode mapping (xkb keysym XF86Launch9)
+
+# evdev 189 (0xbd): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 190 (0xbe): no evdev -> QKeyCode mapping (xkb keysym XF86AudioMicMute)
+
+# evdev 191 (0xbf): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadToggle)
+
+# evdev 192 (0xc0): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOn)
+
+# evdev 193 (0xc1): no evdev -> QKeyCode mapping (xkb keysym XF86TouchpadOff)
+
+# evdev 194 (0xc2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 195 (0xc3): no evdev -> QKeyCode mapping (xkb keysym Mode_switch)
+
+# evdev 196 (0xc4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 197 (0xc5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 198 (0xc6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 199 (0xc7): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 200 (0xc8): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 201 (0xc9): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPause)
+
+# evdev 202 (0xca): no evdev -> QKeyCode mapping (xkb keysym XF86Launch3)
+
+# evdev 203 (0xcb): no evdev -> QKeyCode mapping (xkb keysym XF86Launch4)
+
+# evdev 204 (0xcc): no evdev -> QKeyCode mapping (xkb keysym XF86LaunchB)
+
+# evdev 205 (0xcd): no evdev -> QKeyCode mapping (xkb keysym XF86Suspend)
+
+# evdev 206 (0xce): no evdev -> QKeyCode mapping (xkb keysym XF86Close)
+
+# evdev 207 (0xcf): no evdev -> QKeyCode mapping (xkb keysym XF86AudioPlay)
+
+# evdev 208 (0xd0): no evdev -> QKeyCode mapping (xkb keysym XF86AudioForward)
+
+# evdev 209 (0xd1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 210 (0xd2): no evdev -> QKeyCode mapping (xkb keysym Print)
+
+# evdev 211 (0xd3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 212 (0xd4): no evdev -> QKeyCode mapping (xkb keysym XF86WebCam)
+
+# evdev 213 (0xd5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 214 (0xd6): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 215 (0xd7): no evdev -> QKeyCode mapping (xkb keysym XF86Mail)
+
+# evdev 216 (0xd8): no evdev -> QKeyCode mapping (xkb keysym XF86Messenger)
+
+# evdev 217 (0xd9): no evdev -> QKeyCode mapping (xkb keysym XF86Search)
+
+# evdev 218 (0xda): no evdev -> QKeyCode mapping (xkb keysym XF86Go)
+
+# evdev 219 (0xdb): no evdev -> QKeyCode mapping (xkb keysym XF86Finance)
+
+# evdev 220 (0xdc): no evdev -> QKeyCode mapping (xkb keysym XF86Game)
+
+# evdev 221 (0xdd): no evdev -> QKeyCode mapping (xkb keysym XF86Shop)
+
+# evdev 222 (0xde): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 223 (0xdf): no evdev -> QKeyCode mapping (xkb keysym Cancel)
+
+# evdev 224 (0xe0): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessDown)
+
+# evdev 225 (0xe1): no evdev -> QKeyCode mapping (xkb keysym XF86MonBrightnessUp)
+
+# evdev 226 (0xe2), QKeyCode "mediaselect", number 0xed
+XF86AudioMedia 0xed
+
+# evdev 227 (0xe3): no evdev -> QKeyCode mapping (xkb keysym XF86Display)
+
+# evdev 228 (0xe4): no evdev -> QKeyCode mapping (xkb keysym XF86KbdLightOnOff)
+
+# evdev 229 (0xe5): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessDown)
+
+# evdev 230 (0xe6): no evdev -> QKeyCode mapping (xkb keysym XF86KbdBrightnessUp)
+
+# evdev 231 (0xe7): no evdev -> QKeyCode mapping (xkb keysym XF86Send)
+
+# evdev 232 (0xe8): no evdev -> QKeyCode mapping (xkb keysym XF86Reply)
+
+# evdev 233 (0xe9): no evdev -> QKeyCode mapping (xkb keysym XF86MailForward)
+
+# evdev 234 (0xea): no evdev -> QKeyCode mapping (xkb keysym XF86Save)
+
+# evdev 235 (0xeb): no evdev -> QKeyCode mapping (xkb keysym XF86Documents)
+
+# evdev 236 (0xec): no evdev -> QKeyCode mapping (xkb keysym XF86Battery)
+
+# evdev 237 (0xed): no evdev -> QKeyCode mapping (xkb keysym XF86Bluetooth)
+
+# evdev 238 (0xee): no evdev -> QKeyCode mapping (xkb keysym XF86WLAN)
+
+# evdev 239 (0xef): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 240 (0xf0): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 241 (0xf1): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 242 (0xf2): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 243 (0xf3): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 244 (0xf4): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+# evdev 245 (0xf5): no evdev -> QKeyCode mapping (xkb keysym NoSymbol)
+
+#
+# quirks section start
+#
+# Sometimes multiple keysyms map to the same keycodes.
+# The keycode -> keysym lookup finds only one of the
+# keysyms.  So append them here.
+#
+
+Print 0x54
+Sys_Req 0x54
+Execute 0x54
+KP_Decimal 0x53 numlock
+KP_Separator 0x53 numlock
+Alt_R 0xb8
+ISO_Level3_Shift 0xb8
+Mode_switch 0xb8
+
+# quirks section end
diff --git a/qapi/tpm.json b/qapi/tpm.json
index e8b2d8d..7093f26 100644
--- a/qapi/tpm.json
+++ b/qapi/tpm.json
@@ -39,10 +39,12 @@
 # An enumeration of TPM types
 #
 # @passthrough: TPM passthrough type
+# @emulator: Software Emulator TPM type
+#            Since: 2.11
 #
 # Since: 1.5
 ##
-{ 'enum': 'TpmType', 'data': [ 'passthrough' ] }
+{ 'enum': 'TpmType', 'data': [ 'passthrough', 'emulator' ] }
 
 ##
 # @query-tpm-types:
@@ -56,7 +58,7 @@
 # Example:
 #
 # -> { "execute": "query-tpm-types" }
-# <- { "return": [ "passthrough" ] }
+# <- { "return": [ "passthrough", "emulator" ] }
 #
 ##
 { 'command': 'query-tpm-types', 'returns': ['TpmType'] }
@@ -77,16 +79,29 @@
                                              '*cancel-path' : 'str'} }
 
 ##
+# @TPMEmulatorOptions:
+#
+# Information about the TPM emulator type
+#
+# @chardev: Name of a unix socket chardev
+#
+# Since: 2.11
+##
+{ 'struct': 'TPMEmulatorOptions', 'data': { 'chardev' : 'str' } }
+
+##
 # @TpmTypeOptions:
 #
 # A union referencing different TPM backend types' configuration options
 #
 # @type: 'passthrough' The configuration options for the TPM passthrough type
+#        'emulator' The configuration options for TPM emulator backend type
 #
 # Since: 1.5
 ##
 { 'union': 'TpmTypeOptions',
-   'data': { 'passthrough' : 'TPMPassthroughOptions' } }
+   'data': { 'passthrough' : 'TPMPassthroughOptions',
+             'emulator': 'TPMEmulatorOptions' } }
 
 ##
 # @TPMInfo:
diff --git a/qemu-doc.texi b/qemu-doc.texi
index d8bb2c6..8c10956 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -105,7 +105,7 @@
 QEMU uses a full software MMU for maximum portability.
 
 @item
-QEMU can optionally use an in-kernel accelerator, like kvm. The accelerators 
+QEMU can optionally use an in-kernel accelerator, like kvm. The accelerators
 execute most of the guest code natively, while
 continuing to emulate the rest of the machine.
 
diff --git a/qemu-keymap.c b/qemu-keymap.c
new file mode 100644
index 0000000..49e9167
--- /dev/null
+++ b/qemu-keymap.c
@@ -0,0 +1,258 @@
+/*
+ * QEMU keymap utility
+ *
+ * Copyright Red Hat, Inc. 2017
+ *
+ * Authors:
+ *     Gerd Hoffmann <kraxel@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "qapi-types.h"
+#include "qemu/notify.h"
+#include "ui/input.h"
+
+#include <xkbcommon/xkbcommon.h>
+
+struct xkb_rule_names names = {
+    .rules   = NULL,
+    .model   = "pc105",
+    .layout  = "us",
+    .variant = NULL,
+    .options = NULL,
+};
+
+static xkb_mod_mask_t shift;
+static xkb_mod_mask_t ctrl;
+static xkb_mod_mask_t altgr;
+static xkb_mod_mask_t numlock;
+
+static FILE *outfile;
+
+/* ------------------------------------------------------------------------ */
+
+static uint32_t qcode_to_number(uint32_t qcode)
+{
+    KeyValue keyvalue;
+    uint32_t number;
+
+    keyvalue.type = KEY_VALUE_KIND_QCODE;
+    keyvalue.u.qcode.data = qcode;
+    number = qemu_input_key_value_to_number(&keyvalue);
+    assert(number != 0);
+    return number;
+}
+
+static void print_sym(xkb_keysym_t sym, uint32_t qcode, const char *mod)
+{
+    char name[64];
+
+    if (sym == XKB_KEY_NoSymbol) {
+        return;
+    }
+    xkb_keysym_get_name(sym, name, sizeof(name));
+
+    /* TODO: make ui/keymap.c parser accept QKeyCode names */
+    fprintf(outfile, "%s 0x%02x%s\n", name, qcode_to_number(qcode), mod);
+}
+
+static void walk_map(struct xkb_keymap *map, xkb_keycode_t code, void *data)
+{
+    struct xkb_state *state = data;
+    xkb_keysym_t kbase, knumlock, kshift, kaltgr, kaltgrshift;
+    uint32_t evdev, qcode;
+    char name[64];
+
+    fprintf(outfile, "\n");
+
+    /*
+     * map xkb keycode -> QKeyCode
+     *
+     * xkb keycode is linux evdev shifted by 8
+     */
+    evdev = code - 8;
+    qcode = qemu_input_linux_to_qcode(evdev);
+    if (qcode == Q_KEY_CODE_UNMAPPED) {
+        xkb_state_update_mask(state,  0, 0, 0,  0, 0, 0);
+        kbase = xkb_state_key_get_one_sym(state, code);
+        xkb_keysym_get_name(kbase, name, sizeof(name));
+        fprintf(outfile, "# evdev %d (0x%x): no evdev -> QKeyCode mapping"
+                " (xkb keysym %s)\n", evdev, evdev, name);
+        return;
+    }
+    fprintf(outfile, "# evdev %d (0x%x), QKeyCode \"%s\", number 0x%x\n",
+            evdev, evdev,
+            QKeyCode_lookup.array[qcode],
+            qcode_to_number(qcode));
+
+    /*
+     * check which modifier states generate which keysyms
+     */
+    xkb_state_update_mask(state,  0, 0, 0,  0, 0, 0);
+    kbase = xkb_state_key_get_one_sym(state, code);
+    print_sym(kbase, qcode, "");
+
+    xkb_state_update_mask(state,  0, 0, numlock,  0, 0, 0);
+    knumlock = xkb_state_key_get_one_sym(state, code);
+    if (kbase != knumlock) {
+        print_sym(knumlock, qcode, " numlock");
+    }
+
+    xkb_state_update_mask(state,  shift, 0, 0,  0, 0, 0);
+    kshift = xkb_state_key_get_one_sym(state, code);
+    if (kbase != kshift && knumlock != kshift) {
+        print_sym(kshift, qcode, " shift");
+    }
+
+    xkb_state_update_mask(state,  altgr, 0, 0,  0, 0, 0);
+    kaltgr = xkb_state_key_get_one_sym(state, code);
+    if (kbase != kaltgr) {
+        print_sym(kaltgr, qcode, " altgr");
+    }
+
+    xkb_state_update_mask(state,  altgr | shift, 0, 0,  0, 0, 0);
+    kaltgrshift = xkb_state_key_get_one_sym(state, code);
+    if (kshift != kaltgrshift && kaltgr != kaltgrshift) {
+        print_sym(kaltgrshift, qcode, " shift altgr");
+    }
+    return;
+}
+
+static void usage(FILE *out)
+{
+    fprintf(out,
+            "\n"
+            "This tool generates qemu reverse keymaps from xkb keymaps,\n"
+            "which can be used with the qemu \"-k\" command line switch.\n"
+            "\n"
+            "usage: qemu-keymap <options>\n"
+            "options:\n"
+            "    -h             print this text\n"
+            "    -f <file>      set output file          (default: stdout)\n"
+            "    -m <model>     set kbd model            (default: %s)\n"
+            "    -l <layout>    set kbd layout           (default: %s)\n"
+            "    -v <variant>   set kbd variant          (default: %s)\n"
+            "    -o <options>   set kbd options          (default: %s)\n"
+            "\n",
+            names.model, names.layout,
+            names.variant ?: "-",
+            names.options ?: "-");
+}
+
+int main(int argc, char *argv[])
+{
+    struct xkb_context *ctx;
+    struct xkb_keymap *map;
+    struct xkb_state *state;
+    xkb_mod_index_t mod, mods;
+    int rc;
+
+    for (;;) {
+        rc = getopt(argc, argv, "hm:l:v:o:f:");
+        if (rc == -1) {
+            break;
+        }
+        switch (rc) {
+        case 'm':
+            names.model = optarg;
+            break;
+        case 'l':
+            names.layout = optarg;
+            break;
+        case 'v':
+            names.variant = optarg;
+            break;
+        case 'o':
+            names.options = optarg;
+            break;
+        case 'f':
+            outfile = fopen(optarg, "w");
+            if (outfile == NULL) {
+                fprintf(stderr, "open %s: %s\n", optarg, strerror(errno));
+                exit(1);
+            }
+            break;
+        case 'h':
+            usage(stdout);
+            exit(0);
+        default:
+            usage(stderr);
+            exit(1);
+        }
+    }
+
+    if (outfile == NULL) {
+        outfile = stdout;
+    }
+
+    fprintf(outfile,
+            "#\n"
+            "# generated by qemu-keymap\n"
+            "#    model   : %s\n"
+            "#    layout  : %s\n"
+            "#    variant : %s\n"
+            "#    options : %s\n"
+            "\n",
+            names.model, names.layout,
+            names.variant ?: "-",
+            names.options ?: "-");
+
+    ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
+    map = xkb_keymap_new_from_names(ctx, &names, XKB_KEYMAP_COMPILE_NO_FLAGS);
+    if (!map) {
+        /* libxkbcommon prints error */
+        exit(1);
+    }
+
+    fprintf(outfile, "# name: \"%s\"\n\n",
+            xkb_keymap_layout_get_name(map, 0));
+    fprintf(outfile, "# modifiers\n");
+    mods = xkb_keymap_num_mods(map);
+    for (mod = 0; mod < mods; mod++) {
+        fprintf(outfile, "#    %2d: %s\n",
+                mod, xkb_keymap_mod_get_name(map, mod));
+    }
+
+    mod = xkb_keymap_mod_get_index(map, "Shift");
+    shift = (1 << mod);
+    mod = xkb_keymap_mod_get_index(map, "Control");
+    ctrl = (1 << mod);
+    mod = xkb_keymap_mod_get_index(map, "AltGr");
+    altgr = (1 << mod);
+    mod = xkb_keymap_mod_get_index(map, "NumLock");
+    numlock = (1 << mod);
+
+    state = xkb_state_new(map);
+    xkb_keymap_key_for_each(map, walk_map, state);
+
+    /* add quirks */
+    fprintf(outfile,
+            "\n"
+            "#\n"
+            "# quirks section start\n"
+            "#\n"
+            "# Sometimes multiple keysyms map to the same keycodes.\n"
+            "# The keycode -> keysym lookup finds only one of the\n"
+            "# keysyms.  So append them here.\n"
+            "#\n"
+            "\n");
+    print_sym(XKB_KEY_Print,            Q_KEY_CODE_SYSRQ,      "");
+    print_sym(XKB_KEY_Sys_Req,          Q_KEY_CODE_SYSRQ,      "");
+    print_sym(XKB_KEY_Execute,          Q_KEY_CODE_SYSRQ,      "");
+
+    print_sym(XKB_KEY_KP_Decimal,       Q_KEY_CODE_KP_DECIMAL, " numlock");
+    print_sym(XKB_KEY_KP_Separator,     Q_KEY_CODE_KP_DECIMAL, " numlock");
+
+    print_sym(XKB_KEY_Alt_R,            Q_KEY_CODE_ALT_R,      "");
+    print_sym(XKB_KEY_ISO_Level3_Shift, Q_KEY_CODE_ALT_R,      "");
+    print_sym(XKB_KEY_Mode_switch,      Q_KEY_CODE_ALT_R,      "");
+
+    fprintf(outfile,
+            "\n"
+            "# quirks section end\n");
+
+    exit(0);
+}
diff --git a/qemu-options.hx b/qemu-options.hx
index 981742d..3728e9b 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3121,7 +3121,9 @@
     "-tpmdev passthrough,id=id[,path=path][,cancel-path=path]\n"
     "                use path to provide path to a character device; default is /dev/tpm0\n"
     "                use cancel-path to provide path to TPM's cancel sysfs entry; if\n"
-    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n",
+    "                not provided it will be searched for in /sys/class/misc/tpm?/device\n"
+    "-tpmdev emulator,id=id,chardev=dev\n"
+    "                configure the TPM device using chardev backend\n",
     QEMU_ARCH_ALL)
 STEXI
 
@@ -3130,8 +3132,8 @@
 
 @item -tpmdev @var{backend} ,id=@var{id} [,@var{options}]
 @findex -tpmdev
-Backend type must be:
-@option{passthrough}.
+Backend type must be either one of the following:
+@option{passthrough}, @option{emulator}.
 
 The specific backend type will determine the applicable options.
 The @code{-tpmdev} option creates the TPM backend and requires a
@@ -3181,6 +3183,20 @@
 Note that the @code{-tpmdev} id is @code{tpm0} and is referenced by
 @code{tpmdev=tpm0} in the device option.
 
+@item -tpmdev emulator, id=@var{id}, chardev=@var{dev}
+
+(Linux-host only) Enable access to a TPM emulator using Unix domain socket based
+chardev backend.
+
+@option{chardev} specifies the unique ID of a character device backend that provides connection to the software TPM server.
+
+To create a TPM emulator backend device with chardev socket backend:
+@example
+
+-chardev socket,id=chrtpm,path=/tmp/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
+
+@end example
+
 @end table
 
 ETEXI
diff --git a/qom/object.c b/qom/object.c
index 6a7bd92..c58c52d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -151,6 +151,15 @@
     return type_register(info);
 }
 
+void type_register_static_array(const TypeInfo *infos, int nr_infos)
+{
+    int i;
+
+    for (i = 0; i < nr_infos; i++) {
+        type_register_static(&infos[i]);
+    }
+}
+
 static TypeImpl *type_get_by_name(const char *name)
 {
     if (name == NULL) {
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index c4e7d98..4e63774 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -18,15 +18,37 @@
     error "Usage: $0 <output tarball>"
 fi
 
-tar_file="$1"
-list_file="$1.list"
-submodules=$(git submodule foreach --recursive --quiet 'echo $name')
+tar_file=`realpath "$1"`
+list_file="${tar_file}.list"
+vroot_dir="${tar_file}.vroot"
 
-if test $? -ne 0; then
-    error "git submodule command failed"
+# We want a predictable list of submodules for builds, that is
+# independent of what the developer currently has initialized
+# in their checkout, because the build environment is completely
+# different to the host OS.
+submodules="dtc ui/keycodemapdb"
+
+trap "status=$?; rm -rf \"$list_file\" \"$vroot_dir\"; exit \$status" 0 1 2 3 15
+
+if git diff-index --quiet HEAD -- &>/dev/null
+then
+    HEAD=HEAD
+else
+    HEAD=`git stash create`
 fi
+git clone --shared . "$vroot_dir"
+test $? -ne 0 && error "failed to clone into '$vroot_dir'"
 
-trap "status=$?; rm -f \"$list_file\"; exit \$status" 0 1 2 3 15
+cd "$vroot_dir"
+test $? -ne 0 && error "failed to change into '$vroot_dir'"
+
+git checkout $HEAD
+test $? -ne 0 && error "failed to checkout $HEAD revision"
+
+for sm in $submodules; do
+    git submodule update --init $sm
+    test $? -ne 0 && error "failed to init submodule $sm"
+done
 
 if test -n "$submodules"; then
     {
diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
index f7c6635..69dd5ef 100644
--- a/scripts/dump-guest-memory.py
+++ b/scripts/dump-guest-memory.py
@@ -14,6 +14,7 @@
 """
 
 import ctypes
+import struct
 
 UINTPTR_T = gdb.lookup_type("uintptr_t")
 
@@ -45,6 +46,17 @@
 EM_AARCH = 183
 EM_X86_64 = 62
 
+VMCOREINFO_FORMAT_ELF = 1
+
+def le16_to_cpu(val):
+    return struct.unpack("<H", struct.pack("=H", val))[0]
+
+def le32_to_cpu(val):
+    return struct.unpack("<I", struct.pack("=I", val))[0]
+
+def le64_to_cpu(val):
+    return struct.unpack("<Q", struct.pack("=Q", val))[0]
+
 class ELF(object):
     """Representation of a ELF file."""
 
@@ -120,6 +132,25 @@
         self.segments[0].p_filesz += ctypes.sizeof(note)
         self.segments[0].p_memsz += ctypes.sizeof(note)
 
+
+    def add_vmcoreinfo_note(self, vmcoreinfo):
+        """Adds a vmcoreinfo note to the ELF dump."""
+        # compute the header size, and copy that many bytes from the note
+        header = get_arch_note(self.endianness, 0, 0)
+        ctypes.memmove(ctypes.pointer(header),
+                       vmcoreinfo, ctypes.sizeof(header))
+        if header.n_descsz > 1 << 20:
+            print('warning: invalid vmcoreinfo size')
+            return
+        # now get the full note
+        note = get_arch_note(self.endianness,
+                             header.n_namesz - 1, header.n_descsz)
+        ctypes.memmove(ctypes.pointer(note), vmcoreinfo, ctypes.sizeof(note))
+
+        self.notes.append(note)
+        self.segments[0].p_filesz += ctypes.sizeof(note)
+        self.segments[0].p_memsz += ctypes.sizeof(note)
+
     def add_segment(self, p_type, p_paddr, p_size):
         """Adds a segment to the elf."""
 
@@ -505,6 +536,35 @@
                 cur += chunk_size
                 left -= chunk_size
 
+    def phys_memory_read(self, addr, size):
+        qemu_core = gdb.inferiors()[0]
+        for block in self.guest_phys_blocks:
+            if block["target_start"] <= addr \
+               and addr + size <= block["target_end"]:
+                haddr = block["host_addr"] + (addr - block["target_start"])
+                return qemu_core.read_memory(haddr, size)
+        return None
+
+    def add_vmcoreinfo(self):
+        if not gdb.parse_and_eval("vmcoreinfo_find()") \
+           or not gdb.parse_and_eval("vmcoreinfo_find()->has_vmcoreinfo"):
+            return
+
+        fmt = gdb.parse_and_eval("vmcoreinfo_find()->vmcoreinfo.guest_format")
+        addr = gdb.parse_and_eval("vmcoreinfo_find()->vmcoreinfo.paddr")
+        size = gdb.parse_and_eval("vmcoreinfo_find()->vmcoreinfo.size")
+
+        fmt = le16_to_cpu(fmt)
+        addr = le64_to_cpu(addr)
+        size = le32_to_cpu(size)
+
+        if fmt != VMCOREINFO_FORMAT_ELF:
+            return
+
+        vmcoreinfo = self.phys_memory_read(addr, size)
+        if vmcoreinfo:
+            self.elf.add_vmcoreinfo_note(vmcoreinfo.tobytes())
+
     def invoke(self, args, from_tty):
         """Handles command invocation from gdb."""
 
@@ -518,6 +578,7 @@
 
         self.elf = ELF(argv[1])
         self.guest_phys_blocks = get_guest_phys_blocks()
+        self.add_vmcoreinfo()
 
         with open(argv[0], "wb") as vmcore:
             self.dump_init(vmcore)
diff --git a/scripts/git-submodule.sh b/scripts/git-submodule.sh
new file mode 100755
index 0000000..d8fbc7e
--- /dev/null
+++ b/scripts/git-submodule.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+
+set -e
+
+substat=".git-submodule-status"
+
+command=$1
+shift
+modules="$@"
+
+if test -z "$modules"
+then
+    test -e $substat || touch $substat
+    exit 0
+fi
+
+if ! test -e ".git"
+then
+    echo "$0: unexpectedly called with submodules but no git checkout exists"
+    exit 1
+fi
+
+case "$command" in
+status)
+    test -f "$substat" || exit 1
+    trap "rm -f ${substat}.tmp" EXIT
+    git submodule status $modules > "${substat}.tmp"
+    diff "${substat}" "${substat}.tmp" >/dev/null
+    exit $?
+    ;;
+update)
+    git submodule update --init $modules 1>/dev/null 2>&1
+    git submodule status $modules > "${substat}"
+    ;;
+esac
diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
index 9d45702..6c9bfde 100644
--- a/target/ppc/cpu-models.c
+++ b/target/ppc/cpu-models.c
@@ -756,8 +756,10 @@
     POWERPC_DEF("970_v2.2",      CPU_POWERPC_970_v22,                970,
                 "PowerPC 970 v2.2")
 
-    POWERPC_DEF("power9_v1.0",   CPU_POWERPC_POWER9_BASE,            POWER9,
+    POWERPC_DEF("power9_v1.0",   CPU_POWERPC_POWER9_DD1,             POWER9,
                 "POWER9 v1.0")
+    POWERPC_DEF("power9_v2.0",   CPU_POWERPC_POWER9_DD20,            POWER9,
+                "POWER9 v2.0")
 
     POWERPC_DEF("970fx_v1.0",    CPU_POWERPC_970FX_v10,              970,
                 "PowerPC 970FX v1.0 (G5)")
@@ -945,7 +947,7 @@
     { "power8e", "power8e_v2.1" },
     { "power8", "power8_v2.0" },
     { "power8nvl", "power8nvl_v1.0" },
-    { "power9", "power9_v1.0" },
+    { "power9", "power9_v2.0" },
     { "970", "970_v2.2" },
     { "970fx", "970fx_v3.1" },
     { "970mp", "970mp_v1.1" },
diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h
index 25ef372..efdb2fa 100644
--- a/target/ppc/cpu-models.h
+++ b/target/ppc/cpu-models.h
@@ -372,6 +372,7 @@
     CPU_POWERPC_POWER8NVL_v10      = 0x004C0100,
     CPU_POWERPC_POWER9_BASE        = 0x004E0000,
     CPU_POWERPC_POWER9_DD1         = 0x004E0100,
+    CPU_POWERPC_POWER9_DD20        = 0x004E1200,
     CPU_POWERPC_970_v22            = 0x00390202,
     CPU_POWERPC_970FX_v10          = 0x00391100,
     CPU_POWERPC_970FX_v20          = 0x003C0200,
diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
index d0cf6ca..429b47f 100644
--- a/target/ppc/cpu-qom.h
+++ b/target/ppc/cpu-qom.h
@@ -181,6 +181,7 @@
     DeviceRealize parent_realize;
     DeviceUnrealize parent_unrealize;
     void (*parent_reset)(CPUState *cpu);
+    void (*parent_parse_features)(const char *type, char *str, Error **errp);
 
     uint32_t pvr;
     bool (*pvr_match)(struct PowerPCCPUClass *pcc, uint32_t pvr);
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 64aef17..989761b 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1278,7 +1278,6 @@
 
 /*****************************************************************************/
 void ppc_translate_init(void);
-const char *ppc_cpu_lookup_alias(const char *alias);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index da4e1a6..1c013a0 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -219,17 +219,17 @@
             shift &= 0x1f;
             ret = (int32_t)value >> shift;
             if (likely(ret >= 0 || (value & ((1 << shift) - 1)) == 0)) {
-                env->ca = 0;
+                env->ca32 = env->ca = 0;
             } else {
-                env->ca = 1;
+                env->ca32 = env->ca = 1;
             }
         } else {
             ret = (int32_t)value;
-            env->ca = 0;
+            env->ca32 = env->ca = 0;
         }
     } else {
         ret = (int32_t)value >> 31;
-        env->ca = (ret != 0);
+        env->ca32 = env->ca = (ret != 0);
     }
     return (target_long)ret;
 }
@@ -245,17 +245,17 @@
             shift &= 0x3f;
             ret = (int64_t)value >> shift;
             if (likely(ret >= 0 || (value & ((1ULL << shift) - 1)) == 0)) {
-                env->ca = 0;
+                env->ca32 = env->ca = 0;
             } else {
-                env->ca = 1;
+                env->ca32 = env->ca = 1;
             }
         } else {
             ret = (int64_t)value;
-            env->ca = 0;
+            env->ca32 = env->ca = 0;
         }
     } else {
         ret = (int64_t)value >> 63;
-        env->ca = (ret != 0);
+        env->ca32 = env->ca = (ret != 0);
     }
     return ret;
 }
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 171d3d8..9d57deb 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -123,7 +123,7 @@
     return kvm_vm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
 }
 
-static int kvm_ppc_register_host_cpu_type(void);
+static int kvm_ppc_register_host_cpu_type(MachineState *ms);
 
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
@@ -163,7 +163,7 @@
                         "VM to stall at times!\n");
     }
 
-    kvm_ppc_register_host_cpu_type();
+    kvm_ppc_register_host_cpu_type(ms);
 
     return 0;
 }
@@ -2487,12 +2487,13 @@
     return pvr_pcc;
 }
 
-static int kvm_ppc_register_host_cpu_type(void)
+static int kvm_ppc_register_host_cpu_type(MachineState *ms)
 {
     TypeInfo type_info = {
         .name = TYPE_HOST_POWERPC_CPU,
         .class_init = kvmppc_host_cpu_class_init,
     };
+    MachineClass *mc = MACHINE_GET_CLASS(ms);
     PowerPCCPUClass *pvr_pcc;
     ObjectClass *oc;
     DeviceClass *dc;
@@ -2504,21 +2505,14 @@
     }
     type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
     type_register(&type_info);
+    if (object_dynamic_cast(OBJECT(ms), TYPE_SPAPR_MACHINE)) {
+        /* override TCG default cpu type with 'host' cpu model */
+        mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
+    }
 
     oc = object_class_by_name(type_info.name);
     g_assert(oc);
 
-#if defined(TARGET_PPC64)
-    type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host");
-    type_info.parent = TYPE_SPAPR_CPU_CORE,
-    type_info.instance_size = sizeof(sPAPRCPUCore);
-    type_info.instance_init = NULL;
-    type_info.class_init = spapr_cpu_core_class_init;
-    type_info.class_data = (void *) "host";
-    type_register(&type_info);
-    g_free((void *)type_info.name);
-#endif
-
     /*
      * Update generic CPU family class alias (e.g. on a POWER8NVL host,
      * we want "POWER8" to be a "family" alias that points to the current
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 606b605..a81ff69 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -2181,6 +2181,9 @@
     if (sh == 0) {
         tcg_gen_ext32s_tl(dst, src);
         tcg_gen_movi_tl(cpu_ca, 0);
+        if (is_isa300(ctx)) {
+            tcg_gen_movi_tl(cpu_ca32, 0);
+        }
     } else {
         TCGv t0;
         tcg_gen_ext32s_tl(dst, src);
@@ -2190,6 +2193,9 @@
         tcg_gen_and_tl(cpu_ca, cpu_ca, t0);
         tcg_temp_free(t0);
         tcg_gen_setcondi_tl(TCG_COND_NE, cpu_ca, cpu_ca, 0);
+        if (is_isa300(ctx)) {
+            tcg_gen_mov_tl(cpu_ca32, cpu_ca);
+        }
         tcg_gen_sari_tl(dst, dst, sh);
     }
     if (unlikely(Rc(ctx->opcode) != 0)) {
@@ -2259,6 +2265,9 @@
     if (sh == 0) {
         tcg_gen_mov_tl(dst, src);
         tcg_gen_movi_tl(cpu_ca, 0);
+        if (is_isa300(ctx)) {
+            tcg_gen_movi_tl(cpu_ca32, 0);
+        }
     } else {
         TCGv t0;
         tcg_gen_andi_tl(cpu_ca, src, (1ULL << sh) - 1);
@@ -2267,6 +2276,9 @@
         tcg_gen_and_tl(cpu_ca, cpu_ca, t0);
         tcg_temp_free(t0);
         tcg_gen_setcondi_tl(TCG_COND_NE, cpu_ca, cpu_ca, 0);
+        if (is_isa300(ctx)) {
+            tcg_gen_mov_tl(cpu_ca32, cpu_ca);
+        }
         tcg_gen_sari_tl(dst, src, sh);
     }
     if (unlikely(Rc(ctx->opcode) != 0)) {
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index c6399a3..7b9bf6a 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -4176,223 +4176,6 @@
                  POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
 }
 
-static void init_proc_460 (CPUPPCState *env)
-{
-    /* Time base */
-    gen_tbl(env);
-    gen_spr_BookE(env, 0x000000000000FFFFULL);
-    gen_spr_440(env);
-    gen_spr_usprgh(env);
-    /* Processor identification */
-    spr_register(env, SPR_BOOKE_PIR, "PIR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_pir,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_IAC3, "IAC3",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_IAC4, "IAC4",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_DVC1, "DVC1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_DVC2, "DVC2",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_MCSR, "MCSR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_440_CCR1, "CCR1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_DCRIPR, "SPR_DCRIPR",
-                 &spr_read_generic, &spr_write_generic,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* Memory management */
-#if !defined(CONFIG_USER_ONLY)
-    env->nb_tlb = 64;
-    env->nb_ways = 1;
-    env->id_tlbs = 0;
-    env->tlb_type = TLB_EMB;
-#endif
-    init_excp_BookE(env);
-    env->dcache_line_size = 32;
-    env->icache_line_size = 32;
-    /* XXX: TODO: allocate internal IRQ controller */
-
-    SET_FIT_PERIOD(12, 16, 20, 24);
-    SET_WDT_PERIOD(20, 24, 28, 32);
-}
-
-POWERPC_FAMILY(460)(ObjectClass *oc, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(oc);
-    PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
-
-    dc->desc = "PowerPC 460 (guessed)";
-    pcc->init_proc = init_proc_460;
-    pcc->check_pow = check_pow_nocheck;
-    pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
-                       PPC_DCR | PPC_DCRX  | PPC_DCRUX |
-                       PPC_WRTEE | PPC_MFAPIDI | PPC_MFTB |
-                       PPC_CACHE | PPC_CACHE_ICBI |
-                       PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
-                       PPC_MEM_TLBSYNC | PPC_TLBIVA |
-                       PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
-                       PPC_440_SPEC;
-    pcc->msr_mask = (1ull << MSR_POW) |
-                    (1ull << MSR_CE) |
-                    (1ull << MSR_EE) |
-                    (1ull << MSR_PR) |
-                    (1ull << MSR_FP) |
-                    (1ull << MSR_ME) |
-                    (1ull << MSR_FE0) |
-                    (1ull << MSR_DWE) |
-                    (1ull << MSR_DE) |
-                    (1ull << MSR_FE1) |
-                    (1ull << MSR_IR) |
-                    (1ull << MSR_DR);
-    pcc->mmu_model = POWERPC_MMU_BOOKE;
-    pcc->excp_model = POWERPC_EXCP_BOOKE;
-    pcc->bus_model = PPC_FLAGS_INPUT_BookE;
-    pcc->bfd_mach = bfd_mach_ppc_403;
-    pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
-                 POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
-}
-
-static void init_proc_460F(CPUPPCState *env)
-{
-    /* Time base */
-    gen_tbl(env);
-    gen_spr_BookE(env, 0x000000000000FFFFULL);
-    gen_spr_440(env);
-    gen_spr_usprgh(env);
-    /* Processor identification */
-    spr_register(env, SPR_BOOKE_PIR, "PIR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_pir,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_IAC3, "IAC3",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_IAC4, "IAC4",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_DVC1, "DVC1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_DVC2, "DVC2",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_BOOKE_MCSR, "MCSR",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    spr_register(env, SPR_BOOKE_MCSRR1, "MCSRR1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_440_CCR1, "CCR1",
-                 SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* XXX : not implemented */
-    spr_register(env, SPR_DCRIPR, "SPR_DCRIPR",
-                 &spr_read_generic, &spr_write_generic,
-                 &spr_read_generic, &spr_write_generic,
-                 0x00000000);
-    /* Memory management */
-#if !defined(CONFIG_USER_ONLY)
-    env->nb_tlb = 64;
-    env->nb_ways = 1;
-    env->id_tlbs = 0;
-    env->tlb_type = TLB_EMB;
-#endif
-    init_excp_BookE(env);
-    env->dcache_line_size = 32;
-    env->icache_line_size = 32;
-    /* XXX: TODO: allocate internal IRQ controller */
-
-    SET_FIT_PERIOD(12, 16, 20, 24);
-    SET_WDT_PERIOD(20, 24, 28, 32);
-}
-
-POWERPC_FAMILY(460F)(ObjectClass *oc, void *data)
-{
-    DeviceClass *dc = DEVICE_CLASS(oc);
-    PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
-
-    dc->desc = "PowerPC 460F (guessed)";
-    pcc->init_proc = init_proc_460F;
-    pcc->check_pow = check_pow_nocheck;
-    pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
-                       PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL |
-                       PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
-                       PPC_FLOAT_STFIWX | PPC_MFTB |
-                       PPC_DCR | PPC_DCRX | PPC_DCRUX |
-                       PPC_WRTEE | PPC_MFAPIDI |
-                       PPC_CACHE | PPC_CACHE_ICBI |
-                       PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
-                       PPC_MEM_TLBSYNC | PPC_TLBIVA |
-                       PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
-                       PPC_440_SPEC;
-    pcc->msr_mask = (1ull << MSR_POW) |
-                    (1ull << MSR_CE) |
-                    (1ull << MSR_EE) |
-                    (1ull << MSR_PR) |
-                    (1ull << MSR_FP) |
-                    (1ull << MSR_ME) |
-                    (1ull << MSR_FE0) |
-                    (1ull << MSR_DWE) |
-                    (1ull << MSR_DE) |
-                    (1ull << MSR_FE1) |
-                    (1ull << MSR_IR) |
-                    (1ull << MSR_DR);
-    pcc->mmu_model = POWERPC_MMU_BOOKE;
-    pcc->excp_model = POWERPC_EXCP_BOOKE;
-    pcc->bus_model = PPC_FLAGS_INPUT_BookE;
-    pcc->bfd_mach = bfd_mach_ppc_403;
-    pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
-                 POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
-}
-
 static void init_proc_MPC5xx(CPUPPCState *env)
 {
     /* Time base */
@@ -10277,6 +10060,19 @@
     return pcc;
 }
 
+static const char *ppc_cpu_lookup_alias(const char *alias)
+{
+    int ai;
+
+    for (ai = 0; ppc_cpu_aliases[ai].alias != NULL; ai++) {
+        if (strcmp(ppc_cpu_aliases[ai].alias, alias) == 0) {
+            return ppc_cpu_aliases[ai].model;
+        }
+    }
+
+    return NULL;
+}
+
 static ObjectClass *ppc_cpu_class_by_name(const char *name)
 {
     char *cpu_model, *typename;
@@ -10314,17 +10110,59 @@
     return NULL;
 }
 
-const char *ppc_cpu_lookup_alias(const char *alias)
+static void ppc_cpu_parse_featurestr(const char *type, char *features,
+                                     Error **errp)
 {
-    int ai;
+    Object *machine = qdev_get_machine();
+    const PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(object_class_by_name(type));
 
-    for (ai = 0; ppc_cpu_aliases[ai].alias != NULL; ai++) {
-        if (strcmp(ppc_cpu_aliases[ai].alias, alias) == 0) {
-            return ppc_cpu_aliases[ai].model;
+    if (!features) {
+        return;
+    }
+
+    if (object_property_find(machine, "max-cpu-compat", NULL)) {
+        int i;
+        char **inpieces;
+        char *s = features;
+        Error *local_err = NULL;
+        char *compat_str = NULL;
+
+        /*
+         * Backwards compatibility hack:
+         *
+         *   CPUs had a "compat=" property which didn't make sense for
+         *   anything except pseries.  It was replaced by "max-cpu-compat"
+         *   machine option.  This supports old command lines like
+         *       -cpu POWER8,compat=power7
+         *   By stripping the compat option and applying it to the machine
+         *   before passing it on to the cpu level parser.
+         */
+        inpieces = g_strsplit(features, ",", 0);
+        *s = '\0';
+        for (i = 0; inpieces[i]; i++) {
+            if (g_str_has_prefix(inpieces[i], "compat=")) {
+                compat_str = inpieces[i];
+                continue;
+            }
+            if ((i != 0) && (s != features)) {
+                s = g_stpcpy(s, ",");
+            }
+            s = g_stpcpy(s, inpieces[i]);
+        }
+
+        if (compat_str) {
+            char *v = compat_str + strlen("compat=");
+            object_property_set_str(machine, v, "max-cpu-compat", &local_err);
+        }
+        g_strfreev(inpieces);
+        if (local_err) {
+            error_propagate(errp, local_err);
+            return;
         }
     }
 
-    return NULL;
+    /* do property processing with generic handler */
+    pcc->parent_parse_features(type, features, errp);
 }
 
 PowerPCCPUClass *ppc_cpu_get_family_class(PowerPCCPUClass *pcc)
@@ -10706,6 +10544,8 @@
     cc->reset = ppc_cpu_reset;
 
     cc->class_by_name = ppc_cpu_class_by_name;
+    pcc->parent_parse_features = cc->parse_features;
+    cc->parse_features = ppc_cpu_parse_featurestr;
     cc->has_work = ppc_cpu_has_work;
     cc->do_interrupt = ppc_cpu_do_interrupt;
     cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt;
diff --git a/tests/.gitignore b/tests/.gitignore
index cf6d99c..53cb2ef 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -6,6 +6,7 @@
 check-qnum
 check-qjson
 check-qlist
+check-qlit
 check-qnull
 check-qstring
 check-qom-interface
diff --git a/tests/ahci-test.c b/tests/ahci-test.c
index 999121b..cb84edc 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -155,7 +155,7 @@
 {
     AHCIQState *s;
 
-    s = g_malloc0(sizeof(AHCIQState));
+    s = g_new0(AHCIQState, 1);
     s->parent = qtest_pc_vboot(cli, ap);
     alloc_set_flags(s->parent->alloc, ALLOC_LEAK_ASSERT);
 
@@ -1806,7 +1806,7 @@
     char *name;
     AHCIIOTestOptions *opts;
 
-    opts = g_malloc(sizeof(AHCIIOTestOptions));
+    opts = g_new(AHCIIOTestOptions, 1);
     opts->length = len;
     opts->address_type = addr;
     opts->io_type = type;
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 688342b..81f45bd 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -79,8 +79,8 @@
 
     g_assert_cmpint(qfw_cfg_get_u64(fw_cfg, FW_CFG_NUMA), ==, nb_nodes);
 
-    cpu_mask = g_malloc0(sizeof(uint64_t) * max_cpus);
-    node_mask = g_malloc0(sizeof(uint64_t) * nb_nodes);
+    cpu_mask = g_new0(uint64_t, max_cpus);
+    node_mask = g_new0(uint64_t, nb_nodes);
 
     qfw_cfg_read_data(fw_cfg, cpu_mask, sizeof(uint64_t) * max_cpus);
     qfw_cfg_read_data(fw_cfg, node_mask, sizeof(uint64_t) * nb_nodes);
diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c
index 1ca7f45..13c0749 100644
--- a/tests/libqos/ahci.c
+++ b/tests/libqos/ahci.c
@@ -843,7 +843,7 @@
     AHCICommand *cmd;
 
     g_assert(props);
-    cmd = g_malloc0(sizeof(AHCICommand));
+    cmd = g_new0(AHCICommand, 1);
     g_assert(!(props->dma && props->pio));
     g_assert(!(props->lba28 && props->lba48));
     g_assert(!(props->read && props->write));
diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c
index 6226546..991bc1a 100644
--- a/tests/libqos/libqos.c
+++ b/tests/libqos/libqos.c
@@ -17,7 +17,7 @@
 {
     char *cmdline;
 
-    struct QOSState *qs = g_malloc(sizeof(QOSState));
+    struct QOSState *qs = g_new(QOSState, 1);
 
     cmdline = g_strdup_vprintf(cmdline_fmt, ap);
     qs->qts = qtest_start(cmdline);
diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
index b8eff5f..ac05874 100644
--- a/tests/libqos/malloc.c
+++ b/tests/libqos/malloc.c
@@ -129,7 +129,7 @@
     if (!size) {
         return NULL;
     }
-    block = g_malloc0(sizeof(MemBlock));
+    block = g_new0(MemBlock, 1);
 
     block->addr = addr;
     block->size = size;
@@ -305,8 +305,8 @@
     s->start = start;
     s->end = end;
 
-    s->used = g_malloc(sizeof(MemList));
-    s->free = g_malloc(sizeof(MemList));
+    s->used = g_new(MemList, 1);
+    s->free = g_new(MemList, 1);
     QTAILQ_INIT(s->used);
     QTAILQ_INIT(s->free);
 
diff --git a/tests/libqtest.c b/tests/libqtest.c
index cbd7094..adf7118 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -171,7 +171,7 @@
     gchar *command;
     const char *qemu_binary = qtest_qemu_binary();
 
-    s = g_malloc(sizeof(*s));
+    s = g_new(QTestState, 1);
 
     socket_path = g_strdup_printf("/tmp/qtest-%d.sock", getpid());
     qmp_socket_path = g_strdup_printf("/tmp/qtest-%d.qmp", getpid());
diff --git a/tests/pc-cpu-test.c b/tests/pc-cpu-test.c
index c4211a4..11d3e81 100644
--- a/tests/pc-cpu-test.c
+++ b/tests/pc-cpu-test.c
@@ -87,7 +87,7 @@
     if (!g_str_has_prefix(mname, "pc-")) {
         return;
     }
-    data = g_malloc(sizeof(PCTestData));
+    data = g_new(PCTestData, 1);
     data->machine = g_strdup(mname);
     data->cpu_model = "Haswell"; /* 1.3+ theoretically */
     data->sockets = 1;
diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c
index eac207b..bc8b616 100644
--- a/tests/prom-env-test.c
+++ b/tests/prom-env-test.c
@@ -1,7 +1,7 @@
 /*
- * Test OpenBIOS-based machines.
+ * Test Open-Firmware-based machines.
  *
- * Copyright (c) 2016 Red Hat Inc.
+ * Copyright (c) 2016, 2017 Red Hat Inc.
  *
  * Author:
  *    Thomas Huth <thuth@redhat.com>
@@ -30,8 +30,8 @@
     uint32_t signature;
     int i;
 
-    /* Poll until code has run and modified memory. Wait at most 120 seconds */
-    for (i = 0; i < 12000; ++i) {
+    /* Poll until code has run and modified memory. Wait at most 600 seconds */
+    for (i = 0; i < 60000; ++i) {
         signature = readl(ADDRESS);
         if (signature == MAGIC) {
             break;
@@ -78,7 +78,6 @@
     const char *sparc_machines[] = { "SPARCbook", "Voyager", "SS-20", NULL };
     const char *sparc64_machines[] = { "sun4u", NULL };
     const char *ppc_machines[] = { "mac99", "g3beige", NULL };
-    const char *ppc64_machines[] = { "mac99", "g3beige", "pseries", NULL };
     const char *arch = qtest_get_arch();
 
     g_test_init(&argc, &argv, NULL);
@@ -86,7 +85,10 @@
     if (!strcmp(arch, "ppc")) {
         add_tests(ppc_machines);
     } else if (!strcmp(arch, "ppc64")) {
-        add_tests(ppc64_machines);
+        add_tests(ppc_machines);
+        if (g_test_slow()) {
+            qtest_add_data_func("prom-env/pseries", "pseries", test_machine);
+        }
     } else if (!strcmp(arch, "sparc")) {
         add_tests(sparc_machines);
     } else if (!strcmp(arch, "sparc64")) {
diff --git a/tests/pxe-test.c b/tests/pxe-test.c
index 0d70afc..937f29e 100644
--- a/tests/pxe-test.c
+++ b/tests/pxe-test.c
@@ -1,11 +1,12 @@
 /*
  * PXE test cases.
  *
- * Copyright (c) 2016 Red Hat Inc.
+ * Copyright (c) 2016, 2017 Red Hat Inc.
  *
  * Authors:
  *  Michael S. Tsirkin <mst@redhat.com>,
  *  Victor Kaplansky <victork@redhat.com>
+ *  Thomas Huth <thuth@redhat.com>
  *
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
@@ -36,14 +37,14 @@
     g_free(args);
 }
 
-static void test_pxe_e1000(void)
+static void test_pxe_ipv4(gconstpointer data)
 {
-    test_pxe_one("-device e1000,netdev=" NETNAME, false);
-}
+    const char *model = data;
+    char *dev_arg;
 
-static void test_pxe_virtio_pci(void)
-{
-    test_pxe_one("-device virtio-net-pci,netdev=" NETNAME, false);
+    dev_arg = g_strdup_printf("-device %s,netdev=" NETNAME, model);
+    test_pxe_one(dev_arg, false);
+    g_free(dev_arg);
 }
 
 static void test_pxe_spapr_vlan(void)
@@ -68,11 +69,21 @@
     g_test_init(&argc, &argv, NULL);
 
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
-        qtest_add_func("pxe/e1000", test_pxe_e1000);
-        qtest_add_func("pxe/virtio", test_pxe_virtio_pci);
+        qtest_add_data_func("pxe/e1000", "e1000", test_pxe_ipv4);
+        qtest_add_data_func("pxe/virtio", "virtio-net-pci", test_pxe_ipv4);
+        if (g_test_slow()) {
+            qtest_add_data_func("pxe/ne2000", "ne2k_pci", test_pxe_ipv4);
+            qtest_add_data_func("pxe/eepro100", "i82550", test_pxe_ipv4);
+            qtest_add_data_func("pxe/pcnet", "pcnet", test_pxe_ipv4);
+            qtest_add_data_func("pxe/rtl8139", "rtl8139", test_pxe_ipv4);
+            qtest_add_data_func("pxe/vmxnet3", "vmxnet3", test_pxe_ipv4);
+        }
     } else if (strcmp(arch, "ppc64") == 0) {
-        qtest_add_func("pxe/virtio", test_pxe_virtio_pci);
         qtest_add_func("pxe/spapr-vlan", test_pxe_spapr_vlan);
+        if (g_test_slow()) {
+            qtest_add_data_func("pxe/virtio", "virtio-net-pci", test_pxe_ipv4);
+            qtest_add_data_func("pxe/e1000", "e1000", test_pxe_ipv4);
+        }
     } else if (g_str_equal(arch, "s390x")) {
         qtest_add_func("pxe/virtio-ccw", test_pxe_virtio_ccw);
     }
diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py
index 1c10dcb..8a04d97 100755
--- a/tests/qemu-iotests/nbd-fault-injector.py
+++ b/tests/qemu-iotests/nbd-fault-injector.py
@@ -56,7 +56,7 @@
 NBD_CMD_WRITE = 1
 NBD_CMD_DISC = 2
 NBD_REQUEST_MAGIC = 0x25609513
-NBD_REPLY_MAGIC = 0x67446698
+NBD_SIMPLE_REPLY_MAGIC = 0x67446698
 NBD_PASSWD = 0x4e42444d41474943
 NBD_OPTS_MAGIC = 0x49484156454F5054
 NBD_CLIENT_MAGIC = 0x0000420281861253
@@ -166,7 +166,7 @@
     return req
 
 def write_reply(conn, error, handle):
-    buf = reply_struct.pack(NBD_REPLY_MAGIC, error, handle)
+    buf = reply_struct.pack(NBD_SIMPLE_REPLY_MAGIC, error, handle)
     conn.send(buf, event='reply')
 
 def handle_connection(conn, use_export):
diff --git a/tpm.c b/tpm.c
index 2d830d0..3122227 100644
--- a/tpm.c
+++ b/tpm.c
@@ -62,7 +62,7 @@
             continue;
         }
         fprintf(stderr, "%12s   %s\n",
-                TpmType_str(i), be_drivers[i]->desc());
+                TpmType_str(i), be_drivers[i]->desc);
     }
     fprintf(stderr, "\n");
 }
@@ -157,7 +157,7 @@
 
     QLIST_FOREACH_SAFE(drv, &tpm_backends, list, next) {
         QLIST_REMOVE(drv, list);
-        tpm_backend_destroy(drv);
+        object_unref(OBJECT(drv));
     }
 }
 
@@ -172,7 +172,6 @@
         return -1;
     }
 
-    atexit(tpm_cleanup);
     return 0;
 }
 
@@ -202,36 +201,6 @@
     return be_drivers[type];
 }
 
-static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
-{
-    TPMInfo *res = g_new0(TPMInfo, 1);
-    TPMPassthroughOptions *tpo;
-
-    res->id = g_strdup(drv->id);
-    res->model = drv->fe_model;
-    res->options = g_new0(TpmTypeOptions, 1);
-
-    switch (drv->ops->type) {
-    case TPM_TYPE_PASSTHROUGH:
-        res->options->type = TPM_TYPE_OPTIONS_KIND_PASSTHROUGH;
-        tpo = g_new0(TPMPassthroughOptions, 1);
-        res->options->u.passthrough.data = tpo;
-        if (drv->path) {
-            tpo->path = g_strdup(drv->path);
-            tpo->has_path = true;
-        }
-        if (drv->cancel_path) {
-            tpo->cancel_path = g_strdup(drv->cancel_path);
-            tpo->has_cancel_path = true;
-        }
-        break;
-    case TPM_TYPE__MAX:
-        break;
-    }
-
-    return res;
-}
-
 /*
  * Walk the list of active TPM backends and collect information about them
  * following the schema description in qapi-schema.json.
@@ -246,7 +215,7 @@
             continue;
         }
         info = g_new0(TPMInfoList, 1);
-        info->value = qmp_query_tpm_inst(drv);
+        info->value = tpm_backend_query_tpm(drv);
 
         if (!cur_item) {
             head = cur_item = info;
diff --git a/ui/console-gl.c b/ui/console-gl.c
index 5165e21..5b77e7a 100644
--- a/ui/console-gl.c
+++ b/ui/console-gl.c
@@ -29,40 +29,8 @@
 #include "ui/console.h"
 #include "ui/shader.h"
 
-#include "shader/texture-blit-vert.h"
-#include "shader/texture-blit-frag.h"
-
-struct ConsoleGLState {
-    GLint texture_blit_prog;
-    GLint texture_blit_vao;
-};
-
 /* ---------------------------------------------------------------------- */
 
-ConsoleGLState *console_gl_init_context(void)
-{
-    ConsoleGLState *gls = g_new0(ConsoleGLState, 1);
-
-    gls->texture_blit_prog = qemu_gl_create_compile_link_program
-        (texture_blit_vert_src, texture_blit_frag_src);
-    if (!gls->texture_blit_prog) {
-        exit(1);
-    }
-
-    gls->texture_blit_vao =
-        qemu_gl_init_texture_blit(gls->texture_blit_prog);
-
-    return gls;
-}
-
-void console_gl_fini_context(ConsoleGLState *gls)
-{
-    if (!gls) {
-        return;
-    }
-    g_free(gls);
-}
-
 bool console_gl_check_format(DisplayChangeListener *dcl,
                              pixman_format_code_t format)
 {
@@ -76,7 +44,7 @@
     }
 }
 
-void surface_gl_create_texture(ConsoleGLState *gls,
+void surface_gl_create_texture(QemuGLShader *gls,
                                DisplaySurface *surface)
 {
     assert(gls);
@@ -116,7 +84,7 @@
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 }
 
-void surface_gl_update_texture(ConsoleGLState *gls,
+void surface_gl_update_texture(QemuGLShader *gls,
                                DisplaySurface *surface,
                                int x, int y, int w, int h)
 {
@@ -133,7 +101,7 @@
                     + surface_bytes_per_pixel(surface) * x);
 }
 
-void surface_gl_render_texture(ConsoleGLState *gls,
+void surface_gl_render_texture(QemuGLShader *gls,
                                DisplaySurface *surface)
 {
     assert(gls);
@@ -141,11 +109,10 @@
     glClearColor(0.1f, 0.1f, 0.1f, 0.0f);
     glClear(GL_COLOR_BUFFER_BIT);
 
-    qemu_gl_run_texture_blit(gls->texture_blit_prog,
-                             gls->texture_blit_vao);
+    qemu_gl_run_texture_blit(gls, false);
 }
 
-void surface_gl_destroy_texture(ConsoleGLState *gls,
+void surface_gl_destroy_texture(QemuGLShader *gls,
                                 DisplaySurface *surface)
 {
     if (!surface || !surface->texture) {
@@ -155,7 +122,7 @@
     surface->texture = 0;
 }
 
-void surface_gl_setup_viewport(ConsoleGLState *gls,
+void surface_gl_setup_viewport(QemuGLShader *gls,
                                DisplaySurface *surface,
                                int ww, int wh)
 {
diff --git a/ui/console.c b/ui/console.c
index b82c279..eca854c 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1404,6 +1404,11 @@
     return con->gl != NULL;
 }
 
+bool console_has_gl_dmabuf(QemuConsole *con)
+{
+    return con->gl != NULL && con->gl->ops->dpy_gl_scanout_dmabuf != NULL;
+}
+
 void register_displaychangelistener(DisplayChangeListener *dcl)
 {
     static const char nodev[] =
@@ -1745,6 +1750,34 @@
                                          x, y, width, height);
 }
 
+void dpy_gl_scanout_dmabuf(QemuConsole *con,
+                           QemuDmaBuf *dmabuf)
+{
+    assert(con->gl);
+    con->gl->ops->dpy_gl_scanout_dmabuf(con->gl, dmabuf);
+}
+
+void dpy_gl_cursor_dmabuf(QemuConsole *con,
+                          QemuDmaBuf *dmabuf,
+                          uint32_t pos_x, uint32_t pos_y)
+{
+    assert(con->gl);
+
+    if (con->gl->ops->dpy_gl_cursor_dmabuf) {
+        con->gl->ops->dpy_gl_cursor_dmabuf(con->gl, dmabuf, pos_x, pos_y);
+    }
+}
+
+void dpy_gl_release_dmabuf(QemuConsole *con,
+                          QemuDmaBuf *dmabuf)
+{
+    assert(con->gl);
+
+    if (con->gl->ops->dpy_gl_release_dmabuf) {
+        con->gl->ops->dpy_gl_release_dmabuf(con->gl, dmabuf);
+    }
+}
+
 void dpy_gl_update(QemuConsole *con,
                    uint32_t x, uint32_t y, uint32_t w, uint32_t h)
 {
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 12ad64e..5d50226 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -4,13 +4,18 @@
 #include "ui/console.h"
 #include "ui/egl-helpers.h"
 #include "ui/egl-context.h"
+#include "ui/shader.h"
 
 typedef struct egl_dpy {
     DisplayChangeListener dcl;
     DisplaySurface *ds;
+    QemuGLShader *gls;
     egl_fb guest_fb;
+    egl_fb cursor_fb;
     egl_fb blit_fb;
     bool y_0_top;
+    uint32_t pos_x;
+    uint32_t pos_y;
 } egl_dpy;
 
 /* ------------------------------------------------------------------ */
@@ -65,6 +70,43 @@
     }
 }
 
+static void egl_scanout_dmabuf(DisplayChangeListener *dcl,
+                               QemuDmaBuf *dmabuf)
+{
+    egl_dmabuf_import_texture(dmabuf);
+    if (!dmabuf->texture) {
+        return;
+    }
+
+    egl_scanout_texture(dcl, dmabuf->texture,
+                        false, dmabuf->width, dmabuf->height,
+                        0, 0, dmabuf->width, dmabuf->height);
+}
+
+static void egl_cursor_dmabuf(DisplayChangeListener *dcl,
+                              QemuDmaBuf *dmabuf,
+                              uint32_t pos_x, uint32_t pos_y)
+{
+    egl_dpy *edpy = container_of(dcl, egl_dpy, dcl);
+
+    edpy->pos_x = pos_x;
+    edpy->pos_y = pos_y;
+
+    egl_dmabuf_import_texture(dmabuf);
+    if (!dmabuf->texture) {
+        return;
+    }
+
+    egl_fb_setup_for_tex(&edpy->cursor_fb, dmabuf->width, dmabuf->height,
+                         dmabuf->texture, false);
+}
+
+static void egl_release_dmabuf(DisplayChangeListener *dcl,
+                               QemuDmaBuf *dmabuf)
+{
+    egl_dmabuf_release_texture(dmabuf);
+}
+
 static void egl_scanout_flush(DisplayChangeListener *dcl,
                               uint32_t x, uint32_t y,
                               uint32_t w, uint32_t h)
@@ -78,9 +120,18 @@
     assert(surface_height(edpy->ds) == edpy->guest_fb.height);
     assert(surface_format(edpy->ds) == PIXMAN_x8r8g8b8);
 
-    egl_fb_blit(&edpy->blit_fb, &edpy->guest_fb, edpy->y_0_top);
-    egl_fb_read(surface_data(edpy->ds), &edpy->blit_fb);
+    if (edpy->cursor_fb.texture) {
+        /* have cursor -> render using textures */
+        egl_texture_blit(edpy->gls, &edpy->blit_fb, &edpy->guest_fb,
+                         !edpy->y_0_top);
+        egl_texture_blend(edpy->gls, &edpy->blit_fb, &edpy->cursor_fb,
+                          !edpy->y_0_top, edpy->pos_x, edpy->pos_y);
+    } else {
+        /* no cursor -> use simple framebuffer blit */
+        egl_fb_blit(&edpy->blit_fb, &edpy->guest_fb, edpy->y_0_top);
+    }
 
+    egl_fb_read(surface_data(edpy->ds), &edpy->blit_fb);
     dpy_gfx_update(edpy->dcl.con, x, y, w, h);
 }
 
@@ -97,6 +148,9 @@
 
     .dpy_gl_scanout_disable  = egl_scanout_disable,
     .dpy_gl_scanout_texture  = egl_scanout_texture,
+    .dpy_gl_scanout_dmabuf   = egl_scanout_dmabuf,
+    .dpy_gl_cursor_dmabuf    = egl_cursor_dmabuf,
+    .dpy_gl_release_dmabuf   = egl_release_dmabuf,
     .dpy_gl_update           = egl_scanout_flush,
 };
 
@@ -120,6 +174,7 @@
         edpy = g_new0(egl_dpy, 1);
         edpy->dcl.con = con;
         edpy->dcl.ops = &egl_ops;
+        edpy->gls = qemu_gl_init_shader();
         register_displaychangelistener(&edpy->dcl);
     }
 }
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index cde9965..5fa60ef 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -19,6 +19,7 @@
 #include <dirent.h>
 
 #include "qemu/error-report.h"
+#include "ui/console.h"
 #include "ui/egl-helpers.h"
 
 EGLDisplay *qemu_egl_display;
@@ -110,6 +111,33 @@
                  GL_BGRA, GL_UNSIGNED_BYTE, dst);
 }
 
+void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip)
+{
+    glBindFramebuffer(GL_FRAMEBUFFER_EXT, dst->framebuffer);
+    glViewport(0, 0, dst->width, dst->height);
+    glEnable(GL_TEXTURE_2D);
+    glBindTexture(GL_TEXTURE_2D, src->texture);
+    qemu_gl_run_texture_blit(gls, flip);
+}
+
+void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip,
+                       int x, int y)
+{
+    glBindFramebuffer(GL_FRAMEBUFFER_EXT, dst->framebuffer);
+    if (flip) {
+        glViewport(x, y, src->width, src->height);
+    } else {
+        glViewport(x, dst->height - src->height - y,
+                   src->width, src->height);
+    }
+    glEnable(GL_TEXTURE_2D);
+    glBindTexture(GL_TEXTURE_2D, src->texture);
+    glEnable(GL_BLEND);
+    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    qemu_gl_run_texture_blit(gls, flip);
+    glDisable(GL_BLEND);
+}
+
 /* ---------------------------------------------------------------------- */
 
 #ifdef CONFIG_OPENGL_DMABUF
@@ -241,6 +269,51 @@
     return fd;
 }
 
+void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf)
+{
+    EGLImageKHR image = EGL_NO_IMAGE_KHR;
+    EGLint attrs[] = {
+        EGL_DMA_BUF_PLANE0_FD_EXT,      dmabuf->fd,
+        EGL_DMA_BUF_PLANE0_PITCH_EXT,   dmabuf->stride,
+        EGL_DMA_BUF_PLANE0_OFFSET_EXT,  0,
+        EGL_WIDTH,                      dmabuf->width,
+        EGL_HEIGHT,                     dmabuf->height,
+        EGL_LINUX_DRM_FOURCC_EXT,       dmabuf->fourcc,
+        EGL_NONE, /* end of list */
+    };
+
+    if (dmabuf->texture != 0) {
+        return;
+    }
+
+    image = eglCreateImageKHR(qemu_egl_display,
+                              EGL_NO_CONTEXT,
+                              EGL_LINUX_DMA_BUF_EXT,
+                              NULL, attrs);
+    if (image == EGL_NO_IMAGE_KHR) {
+        error_report("eglCreateImageKHR failed");
+        return;
+    }
+
+    glGenTextures(1, &dmabuf->texture);
+    glBindTexture(GL_TEXTURE_2D, dmabuf->texture);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+    glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)image);
+    eglDestroyImageKHR(qemu_egl_display, image);
+}
+
+void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf)
+{
+    if (dmabuf->texture == 0) {
+        return;
+    }
+
+    glDeleteTextures(1, &dmabuf->texture);
+    dmabuf->texture = 0;
+}
+
 #endif /* CONFIG_OPENGL_DMABUF */
 
 /* ---------------------------------------------------------------------- */
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index 0f0d35e..eb86c26 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -113,7 +113,7 @@
         if (!vc->gfx.esurface) {
             return;
         }
-        vc->gfx.gls = console_gl_init_context();
+        vc->gfx.gls = qemu_gl_init_shader();
         if (vc->gfx.ds) {
             surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds);
         }
diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 01ebf2c..147ad6f 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -96,7 +96,7 @@
             return;
         }
         gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
-        vc->gfx.gls = console_gl_init_context();
+        vc->gfx.gls = qemu_gl_init_shader();
         if (vc->gfx.ds) {
             surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds);
         }
@@ -178,8 +178,7 @@
 
     gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
 
-    if (vc->gfx.guest_fb.framebuffer  == 0 ||
-        vc->gfx.w == 0 || vc->gfx.h == 0) {
+    if (backing_id == 0 || vc->gfx.w == 0 || vc->gfx.h == 0) {
         gtk_gl_area_set_scanout_mode(vc, false);
         return;
     }
diff --git a/ui/gtk.c b/ui/gtk.c
index 5bd87c2..342e96f 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1702,7 +1702,12 @@
     GtkDisplayState *s = opaque;
     VirtualConsole *vc = gd_vc_find_current(s);
 
+#if VTE_CHECK_VERSION(0, 50, 0)
+    vte_terminal_copy_clipboard_format(VTE_TERMINAL(vc->vte.terminal),
+                                       VTE_FORMAT_TEXT);
+#else
     vte_terminal_copy_clipboard(VTE_TERMINAL(vc->vte.terminal));
+#endif
 }
 
 static void gd_vc_adjustment_changed(GtkAdjustment *adjustment, void *opaque)
diff --git a/ui/input-keymap.c b/ui/input-keymap.c
index cf979c2..3a19a16 100644
--- a/ui/input-keymap.c
+++ b/ui/input-keymap.c
@@ -5,333 +5,37 @@
 
 #include "standard-headers/linux/input.h"
 
-static int linux_to_qcode[KEY_CNT] = {
-    [KEY_ESC]            = Q_KEY_CODE_ESC,
-    [KEY_1]              = Q_KEY_CODE_1,
-    [KEY_2]              = Q_KEY_CODE_2,
-    [KEY_3]              = Q_KEY_CODE_3,
-    [KEY_4]              = Q_KEY_CODE_4,
-    [KEY_5]              = Q_KEY_CODE_5,
-    [KEY_6]              = Q_KEY_CODE_6,
-    [KEY_7]              = Q_KEY_CODE_7,
-    [KEY_8]              = Q_KEY_CODE_8,
-    [KEY_9]              = Q_KEY_CODE_9,
-    [KEY_0]              = Q_KEY_CODE_0,
-    [KEY_MINUS]          = Q_KEY_CODE_MINUS,
-    [KEY_EQUAL]          = Q_KEY_CODE_EQUAL,
-    [KEY_BACKSPACE]      = Q_KEY_CODE_BACKSPACE,
-    [KEY_TAB]            = Q_KEY_CODE_TAB,
-    [KEY_Q]              = Q_KEY_CODE_Q,
-    [KEY_W]              = Q_KEY_CODE_W,
-    [KEY_E]              = Q_KEY_CODE_E,
-    [KEY_R]              = Q_KEY_CODE_R,
-    [KEY_T]              = Q_KEY_CODE_T,
-    [KEY_Y]              = Q_KEY_CODE_Y,
-    [KEY_U]              = Q_KEY_CODE_U,
-    [KEY_I]              = Q_KEY_CODE_I,
-    [KEY_O]              = Q_KEY_CODE_O,
-    [KEY_P]              = Q_KEY_CODE_P,
-    [KEY_LEFTBRACE]      = Q_KEY_CODE_BRACKET_LEFT,
-    [KEY_RIGHTBRACE]     = Q_KEY_CODE_BRACKET_RIGHT,
-    [KEY_ENTER]          = Q_KEY_CODE_RET,
-    [KEY_LEFTCTRL]       = Q_KEY_CODE_CTRL,
-    [KEY_A]              = Q_KEY_CODE_A,
-    [KEY_S]              = Q_KEY_CODE_S,
-    [KEY_D]              = Q_KEY_CODE_D,
-    [KEY_F]              = Q_KEY_CODE_F,
-    [KEY_G]              = Q_KEY_CODE_G,
-    [KEY_H]              = Q_KEY_CODE_H,
-    [KEY_J]              = Q_KEY_CODE_J,
-    [KEY_K]              = Q_KEY_CODE_K,
-    [KEY_L]              = Q_KEY_CODE_L,
-    [KEY_SEMICOLON]      = Q_KEY_CODE_SEMICOLON,
-    [KEY_APOSTROPHE]     = Q_KEY_CODE_APOSTROPHE,
-    [KEY_GRAVE]          = Q_KEY_CODE_GRAVE_ACCENT,
-    [KEY_LEFTSHIFT]      = Q_KEY_CODE_SHIFT,
-    [KEY_BACKSLASH]      = Q_KEY_CODE_BACKSLASH,
-    [KEY_102ND]          = Q_KEY_CODE_LESS,
-    [KEY_Z]              = Q_KEY_CODE_Z,
-    [KEY_X]              = Q_KEY_CODE_X,
-    [KEY_C]              = Q_KEY_CODE_C,
-    [KEY_V]              = Q_KEY_CODE_V,
-    [KEY_B]              = Q_KEY_CODE_B,
-    [KEY_N]              = Q_KEY_CODE_N,
-    [KEY_M]              = Q_KEY_CODE_M,
-    [KEY_COMMA]          = Q_KEY_CODE_COMMA,
-    [KEY_DOT]            = Q_KEY_CODE_DOT,
-    [KEY_SLASH]          = Q_KEY_CODE_SLASH,
-    [KEY_RIGHTSHIFT]     = Q_KEY_CODE_SHIFT_R,
-    [KEY_LEFTALT]        = Q_KEY_CODE_ALT,
-    [KEY_SPACE]          = Q_KEY_CODE_SPC,
-    [KEY_CAPSLOCK]       = Q_KEY_CODE_CAPS_LOCK,
-    [KEY_F1]             = Q_KEY_CODE_F1,
-    [KEY_F2]             = Q_KEY_CODE_F2,
-    [KEY_F3]             = Q_KEY_CODE_F3,
-    [KEY_F4]             = Q_KEY_CODE_F4,
-    [KEY_F5]             = Q_KEY_CODE_F5,
-    [KEY_F6]             = Q_KEY_CODE_F6,
-    [KEY_F7]             = Q_KEY_CODE_F7,
-    [KEY_F8]             = Q_KEY_CODE_F8,
-    [KEY_F9]             = Q_KEY_CODE_F9,
-    [KEY_F10]            = Q_KEY_CODE_F10,
-    [KEY_NUMLOCK]        = Q_KEY_CODE_NUM_LOCK,
-    [KEY_SCROLLLOCK]     = Q_KEY_CODE_SCROLL_LOCK,
-    [KEY_KP0]            = Q_KEY_CODE_KP_0,
-    [KEY_KP1]            = Q_KEY_CODE_KP_1,
-    [KEY_KP2]            = Q_KEY_CODE_KP_2,
-    [KEY_KP3]            = Q_KEY_CODE_KP_3,
-    [KEY_KP4]            = Q_KEY_CODE_KP_4,
-    [KEY_KP5]            = Q_KEY_CODE_KP_5,
-    [KEY_KP6]            = Q_KEY_CODE_KP_6,
-    [KEY_KP7]            = Q_KEY_CODE_KP_7,
-    [KEY_KP8]            = Q_KEY_CODE_KP_8,
-    [KEY_KP9]            = Q_KEY_CODE_KP_9,
-    [KEY_KPMINUS]        = Q_KEY_CODE_KP_SUBTRACT,
-    [KEY_KPPLUS]         = Q_KEY_CODE_KP_ADD,
-    [KEY_KPDOT]          = Q_KEY_CODE_KP_DECIMAL,
-    [KEY_KPENTER]        = Q_KEY_CODE_KP_ENTER,
-    [KEY_KPSLASH]        = Q_KEY_CODE_KP_DIVIDE,
-    [KEY_KPASTERISK]     = Q_KEY_CODE_KP_MULTIPLY,
-    [KEY_F11]            = Q_KEY_CODE_F11,
-    [KEY_F12]            = Q_KEY_CODE_F12,
-    [KEY_RO]             = Q_KEY_CODE_RO,
-    [KEY_HIRAGANA]       = Q_KEY_CODE_HIRAGANA,
-    [KEY_HENKAN]         = Q_KEY_CODE_HENKAN,
-    [KEY_RIGHTCTRL]      = Q_KEY_CODE_CTRL_R,
-    [KEY_SYSRQ]          = Q_KEY_CODE_SYSRQ,
-    [KEY_RIGHTALT]       = Q_KEY_CODE_ALT_R,
-    [KEY_HOME]           = Q_KEY_CODE_HOME,
-    [KEY_UP]             = Q_KEY_CODE_UP,
-    [KEY_PAGEUP]         = Q_KEY_CODE_PGUP,
-    [KEY_LEFT]           = Q_KEY_CODE_LEFT,
-    [KEY_RIGHT]          = Q_KEY_CODE_RIGHT,
-    [KEY_END]            = Q_KEY_CODE_END,
-    [KEY_DOWN]           = Q_KEY_CODE_DOWN,
-    [KEY_PAGEDOWN]       = Q_KEY_CODE_PGDN,
-    [KEY_INSERT]         = Q_KEY_CODE_INSERT,
-    [KEY_DELETE]         = Q_KEY_CODE_DELETE,
-    [KEY_POWER]          = Q_KEY_CODE_POWER,
-    [KEY_KPCOMMA]        = Q_KEY_CODE_KP_COMMA,
-    [KEY_YEN]            = Q_KEY_CODE_YEN,
-    [KEY_LEFTMETA]       = Q_KEY_CODE_META_L,
-    [KEY_RIGHTMETA]      = Q_KEY_CODE_META_R,
-    [KEY_MENU]           = Q_KEY_CODE_MENU,
-    [KEY_PAUSE]          = Q_KEY_CODE_PAUSE,
-
-    [KEY_SLEEP]          = Q_KEY_CODE_SLEEP,
-    [KEY_WAKEUP]         = Q_KEY_CODE_WAKE,
-    [KEY_CALC]           = Q_KEY_CODE_CALCULATOR,
-    [KEY_MAIL]           = Q_KEY_CODE_MAIL,
-    [KEY_COMPUTER]       = Q_KEY_CODE_COMPUTER,
-
-    [KEY_STOP]           = Q_KEY_CODE_STOP,
-    [KEY_BOOKMARKS]      = Q_KEY_CODE_AC_BOOKMARKS,
-    [KEY_BACK]           = Q_KEY_CODE_AC_BACK,
-    [KEY_FORWARD]        = Q_KEY_CODE_AC_FORWARD,
-    [KEY_HOMEPAGE]       = Q_KEY_CODE_AC_HOME,
-    [KEY_REFRESH]        = Q_KEY_CODE_AC_REFRESH,
-    [KEY_FIND]           = Q_KEY_CODE_FIND,
-
-    [KEY_NEXTSONG]       = Q_KEY_CODE_AUDIONEXT,
-    [KEY_PREVIOUSSONG]   = Q_KEY_CODE_AUDIOPREV,
-    [KEY_STOPCD]         = Q_KEY_CODE_AUDIOSTOP,
-    [KEY_PLAYCD]         = Q_KEY_CODE_AUDIOPLAY,
-    [KEY_MUTE]           = Q_KEY_CODE_AUDIOMUTE,
-    [KEY_VOLUMEDOWN]     = Q_KEY_CODE_VOLUMEDOWN,
-    [KEY_VOLUMEUP]       = Q_KEY_CODE_VOLUMEUP,
-};
-
-static const int qcode_to_number[] = {
-    [Q_KEY_CODE_SHIFT] = 0x2a,
-    [Q_KEY_CODE_SHIFT_R] = 0x36,
-
-    [Q_KEY_CODE_ALT] = 0x38,
-    [Q_KEY_CODE_ALT_R] = 0xb8,
-    [Q_KEY_CODE_CTRL] = 0x1d,
-    [Q_KEY_CODE_CTRL_R] = 0x9d,
-
-    [Q_KEY_CODE_META_L] = 0xdb,
-    [Q_KEY_CODE_META_R] = 0xdc,
-    [Q_KEY_CODE_MENU] = 0xdd,
-
-    [Q_KEY_CODE_ESC] = 0x01,
-
-    [Q_KEY_CODE_1] = 0x02,
-    [Q_KEY_CODE_2] = 0x03,
-    [Q_KEY_CODE_3] = 0x04,
-    [Q_KEY_CODE_4] = 0x05,
-    [Q_KEY_CODE_5] = 0x06,
-    [Q_KEY_CODE_6] = 0x07,
-    [Q_KEY_CODE_7] = 0x08,
-    [Q_KEY_CODE_8] = 0x09,
-    [Q_KEY_CODE_9] = 0x0a,
-    [Q_KEY_CODE_0] = 0x0b,
-    [Q_KEY_CODE_MINUS] = 0x0c,
-    [Q_KEY_CODE_EQUAL] = 0x0d,
-    [Q_KEY_CODE_BACKSPACE] = 0x0e,
-
-    [Q_KEY_CODE_TAB] = 0x0f,
-    [Q_KEY_CODE_Q] = 0x10,
-    [Q_KEY_CODE_W] = 0x11,
-    [Q_KEY_CODE_E] = 0x12,
-    [Q_KEY_CODE_R] = 0x13,
-    [Q_KEY_CODE_T] = 0x14,
-    [Q_KEY_CODE_Y] = 0x15,
-    [Q_KEY_CODE_U] = 0x16,
-    [Q_KEY_CODE_I] = 0x17,
-    [Q_KEY_CODE_O] = 0x18,
-    [Q_KEY_CODE_P] = 0x19,
-    [Q_KEY_CODE_BRACKET_LEFT] = 0x1a,
-    [Q_KEY_CODE_BRACKET_RIGHT] = 0x1b,
-    [Q_KEY_CODE_RET] = 0x1c,
-
-    [Q_KEY_CODE_A] = 0x1e,
-    [Q_KEY_CODE_S] = 0x1f,
-    [Q_KEY_CODE_D] = 0x20,
-    [Q_KEY_CODE_F] = 0x21,
-    [Q_KEY_CODE_G] = 0x22,
-    [Q_KEY_CODE_H] = 0x23,
-    [Q_KEY_CODE_J] = 0x24,
-    [Q_KEY_CODE_K] = 0x25,
-    [Q_KEY_CODE_L] = 0x26,
-    [Q_KEY_CODE_SEMICOLON] = 0x27,
-    [Q_KEY_CODE_APOSTROPHE] = 0x28,
-    [Q_KEY_CODE_GRAVE_ACCENT] = 0x29,
-
-    [Q_KEY_CODE_BACKSLASH] = 0x2b,
-    [Q_KEY_CODE_Z] = 0x2c,
-    [Q_KEY_CODE_X] = 0x2d,
-    [Q_KEY_CODE_C] = 0x2e,
-    [Q_KEY_CODE_V] = 0x2f,
-    [Q_KEY_CODE_B] = 0x30,
-    [Q_KEY_CODE_N] = 0x31,
-    [Q_KEY_CODE_M] = 0x32,
-    [Q_KEY_CODE_COMMA] = 0x33,
-    [Q_KEY_CODE_DOT] = 0x34,
-    [Q_KEY_CODE_SLASH] = 0x35,
-
-    [Q_KEY_CODE_ASTERISK] = 0x37,
-
-    [Q_KEY_CODE_SPC] = 0x39,
-    [Q_KEY_CODE_CAPS_LOCK] = 0x3a,
-    [Q_KEY_CODE_F1] = 0x3b,
-    [Q_KEY_CODE_F2] = 0x3c,
-    [Q_KEY_CODE_F3] = 0x3d,
-    [Q_KEY_CODE_F4] = 0x3e,
-    [Q_KEY_CODE_F5] = 0x3f,
-    [Q_KEY_CODE_F6] = 0x40,
-    [Q_KEY_CODE_F7] = 0x41,
-    [Q_KEY_CODE_F8] = 0x42,
-    [Q_KEY_CODE_F9] = 0x43,
-    [Q_KEY_CODE_F10] = 0x44,
-    [Q_KEY_CODE_NUM_LOCK] = 0x45,
-    [Q_KEY_CODE_SCROLL_LOCK] = 0x46,
-
-    [Q_KEY_CODE_KP_DIVIDE] = 0xb5,
-    [Q_KEY_CODE_KP_MULTIPLY] = 0x37,
-    [Q_KEY_CODE_KP_SUBTRACT] = 0x4a,
-    [Q_KEY_CODE_KP_ADD] = 0x4e,
-    [Q_KEY_CODE_KP_ENTER] = 0x9c,
-    [Q_KEY_CODE_KP_DECIMAL] = 0x53,
-    [Q_KEY_CODE_SYSRQ] = 0x54,
-    [Q_KEY_CODE_PAUSE] = 0xc6,
-
-    [Q_KEY_CODE_KP_0] = 0x52,
-    [Q_KEY_CODE_KP_1] = 0x4f,
-    [Q_KEY_CODE_KP_2] = 0x50,
-    [Q_KEY_CODE_KP_3] = 0x51,
-    [Q_KEY_CODE_KP_4] = 0x4b,
-    [Q_KEY_CODE_KP_5] = 0x4c,
-    [Q_KEY_CODE_KP_6] = 0x4d,
-    [Q_KEY_CODE_KP_7] = 0x47,
-    [Q_KEY_CODE_KP_8] = 0x48,
-    [Q_KEY_CODE_KP_9] = 0x49,
-
-    [Q_KEY_CODE_LESS] = 0x56,
-
-    [Q_KEY_CODE_F11] = 0x57,
-    [Q_KEY_CODE_F12] = 0x58,
-
-    [Q_KEY_CODE_PRINT] = 0xb7,
-
-    [Q_KEY_CODE_HOME] = 0xc7,
-    [Q_KEY_CODE_PGUP] = 0xc9,
-    [Q_KEY_CODE_PGDN] = 0xd1,
-    [Q_KEY_CODE_END] = 0xcf,
-
-    [Q_KEY_CODE_LEFT] = 0xcb,
-    [Q_KEY_CODE_UP] = 0xc8,
-    [Q_KEY_CODE_DOWN] = 0xd0,
-    [Q_KEY_CODE_RIGHT] = 0xcd,
-
-    [Q_KEY_CODE_INSERT] = 0xd2,
-    [Q_KEY_CODE_DELETE] = 0xd3,
-
-    [Q_KEY_CODE_RO] = 0x73,
-    [Q_KEY_CODE_HIRAGANA] = 0x70,
-    [Q_KEY_CODE_HENKAN] = 0x79,
-    [Q_KEY_CODE_POWER] = 0xde,
-    [Q_KEY_CODE_YEN] = 0x7d,
-    [Q_KEY_CODE_KP_COMMA] = 0x7e,
-
-    [Q_KEY_CODE_SLEEP] = 0xdf,
-    [Q_KEY_CODE_WAKE] = 0xe3,
-    [Q_KEY_CODE_CALCULATOR] = 0xa1,
-    [Q_KEY_CODE_MAIL] = 0xec,
-    [Q_KEY_CODE_COMPUTER] = 0xeb,
-
-    [Q_KEY_CODE_STOP] = 0xe8,
-    [Q_KEY_CODE_AC_BOOKMARKS] = 0xe6,
-    [Q_KEY_CODE_AC_BACK] = 0xea,
-    [Q_KEY_CODE_AC_FORWARD] = 0xe9,
-    [Q_KEY_CODE_AC_HOME] = 0xb2,
-    [Q_KEY_CODE_AC_REFRESH] = 0xe7,
-    [Q_KEY_CODE_FIND] = 0xe5,
-
-    [Q_KEY_CODE_AUDIONEXT] = 0x99,
-    [Q_KEY_CODE_AUDIOPREV] = 0x90,
-    [Q_KEY_CODE_AUDIOSTOP] = 0xa4,
-    [Q_KEY_CODE_AUDIOPLAY] = 0xa2,
-    [Q_KEY_CODE_AUDIOMUTE] = 0xa0,
-    [Q_KEY_CODE_VOLUMEDOWN] = 0xae,
-    [Q_KEY_CODE_VOLUMEUP] = 0xb0,
-
-    [Q_KEY_CODE__MAX] = 0,
-};
-
-static int number_to_qcode[0x100];
+#include "ui/input-keymap-linux-to-qcode.c"
+#include "ui/input-keymap-qcode-to-qnum.c"
+#include "ui/input-keymap-qnum-to-qcode.c"
 
 int qemu_input_linux_to_qcode(unsigned int lnx)
 {
-    assert(lnx < KEY_CNT);
-    return linux_to_qcode[lnx];
+    if (lnx >= qemu_input_map_linux_to_qcode_len) {
+        return 0;
+    }
+    return qemu_input_map_linux_to_qcode[lnx];
 }
 
 int qemu_input_key_value_to_number(const KeyValue *value)
 {
     if (value->type == KEY_VALUE_KIND_QCODE) {
-        return qcode_to_number[value->u.qcode.data];
+        if (value->u.qcode.data >= qemu_input_map_qcode_to_qnum_len) {
+            return 0;
+        }
+        return qemu_input_map_qcode_to_qnum[value->u.qcode.data];
     } else {
         assert(value->type == KEY_VALUE_KIND_NUMBER);
         return value->u.number.data;
     }
 }
 
-int qemu_input_key_number_to_qcode(uint8_t nr)
+int qemu_input_key_number_to_qcode(unsigned int nr)
 {
-    static int first = true;
-
-    if (first) {
-        int qcode, number;
-        first = false;
-        for (qcode = 0; qcode < Q_KEY_CODE__MAX; qcode++) {
-            number = qcode_to_number[qcode];
-            assert(number < ARRAY_SIZE(number_to_qcode));
-            number_to_qcode[number] = qcode;
-        }
+    if (nr >= qemu_input_map_qnum_to_qcode_len) {
+        return 0;
     }
-
-    return number_to_qcode[nr];
+    return qemu_input_map_qnum_to_qcode[nr];
 }
 
 int qemu_input_key_value_to_qcode(const KeyValue *value)
diff --git a/ui/input.c b/ui/input.c
index 3422d4a..290b473 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -157,9 +157,16 @@
     }
 
     for (e = events; e != NULL; e = e->next) {
-        InputEvent *event = e->value;
+        InputEvent *evt = e->value;
 
-        qemu_input_event_send(con, event);
+        if (evt->type == INPUT_EVENT_KIND_KEY &&
+            evt->u.key.data->key->type == KEY_VALUE_KIND_NUMBER) {
+            KeyValue *key = evt->u.key.data->key;
+            QKeyCode code = qemu_input_key_number_to_qcode(key->u.qcode.data);
+            qemu_input_event_send_key_qcode(con, code, evt->u.key.data->down);
+        } else {
+            qemu_input_event_send(con, evt);
+        }
     }
 
     qemu_input_event_sync();
@@ -341,6 +348,11 @@
 
 void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
 {
+    /* Expect all parts of QEMU to send events with QCodes exclusively.
+     * Key numbers are only supported as end-user input via QMP */
+    assert(!(evt->type == INPUT_EVENT_KIND_KEY &&
+             evt->u.key.data->key->type == KEY_VALUE_KIND_NUMBER));
+
     if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) {
         return;
     }
@@ -374,7 +386,7 @@
     replay_input_sync_event();
 }
 
-InputEvent *qemu_input_event_new_key(KeyValue *key, bool down)
+static InputEvent *qemu_input_event_new_key(KeyValue *key, bool down)
 {
     InputEvent *evt = g_new0(InputEvent, 1);
     evt->u.key.data = g_new0(InputKeyEvent, 1);
@@ -400,10 +412,8 @@
 
 void qemu_input_event_send_key_number(QemuConsole *src, int num, bool down)
 {
-    KeyValue *key = g_new0(KeyValue, 1);
-    key->type = KEY_VALUE_KIND_NUMBER;
-    key->u.number.data = num;
-    qemu_input_event_send_key(src, key, down);
+    QKeyCode code = qemu_input_key_number_to_qcode(num);
+    qemu_input_event_send_key_qcode(src, code, down);
 }
 
 void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down)
diff --git a/ui/keycodemapdb b/ui/keycodemapdb
new file mode 160000
index 0000000..56ce565
--- /dev/null
+++ b/ui/keycodemapdb
@@ -0,0 +1 @@
+Subproject commit 56ce5650d2c6ea216b4580df44b9a6dd3bc92c3b
diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c
index 9110491..5e1073a 100644
--- a/ui/sdl2-gl.c
+++ b/ui/sdl2-gl.c
@@ -90,7 +90,7 @@
     scon->surface = new_surface;
 
     if (!new_surface) {
-        console_gl_fini_context(scon->gls);
+        qemu_gl_fini_shader(scon->gls);
         scon->gls = NULL;
         sdl2_window_destroy(scon);
         return;
@@ -98,7 +98,7 @@
 
     if (!scon->real_window) {
         sdl2_window_create(scon);
-        scon->gls = console_gl_init_context();
+        scon->gls = qemu_gl_init_shader();
     } else if (old_surface &&
                ((surface_width(old_surface)  != surface_width(new_surface)) ||
                 (surface_height(old_surface) != surface_height(new_surface)))) {
diff --git a/ui/shader.c b/ui/shader.c
index 1ffddbe..008458b 100644
--- a/ui/shader.c
+++ b/ui/shader.c
@@ -28,9 +28,19 @@
 #include "qemu-common.h"
 #include "ui/shader.h"
 
+#include "shader/texture-blit-vert.h"
+#include "shader/texture-blit-flip-vert.h"
+#include "shader/texture-blit-frag.h"
+
+struct QemuGLShader {
+    GLint texture_blit_prog;
+    GLint texture_blit_flip_prog;
+    GLint texture_blit_vao;
+};
+
 /* ---------------------------------------------------------------------- */
 
-GLuint qemu_gl_init_texture_blit(GLint texture_blit_prog)
+static GLuint qemu_gl_init_texture_blit(GLint texture_blit_prog)
 {
     static const GLfloat in_position[] = {
         -1, -1,
@@ -60,17 +70,18 @@
     return vao;
 }
 
-void qemu_gl_run_texture_blit(GLint texture_blit_prog,
-                              GLint texture_blit_vao)
+void qemu_gl_run_texture_blit(QemuGLShader *gls, bool flip)
 {
-    glUseProgram(texture_blit_prog);
-    glBindVertexArray(texture_blit_vao);
+    glUseProgram(flip
+                 ? gls->texture_blit_flip_prog
+                 : gls->texture_blit_prog);
+    glBindVertexArray(gls->texture_blit_vao);
     glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
 }
 
 /* ---------------------------------------------------------------------- */
 
-GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src)
+static GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src)
 {
     GLuint shader;
     GLint status, length;
@@ -94,7 +105,7 @@
     return shader;
 }
 
-GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag)
+static GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag)
 {
     GLuint program;
     GLint status, length;
@@ -117,8 +128,8 @@
     return program;
 }
 
-GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src,
-                                           const GLchar *frag_src)
+static GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src,
+                                                  const GLchar *frag_src)
 {
     GLuint vert_shader, frag_shader, program;
 
@@ -134,3 +145,31 @@
 
     return program;
 }
+
+/* ---------------------------------------------------------------------- */
+
+QemuGLShader *qemu_gl_init_shader(void)
+{
+    QemuGLShader *gls = g_new0(QemuGLShader, 1);
+
+    gls->texture_blit_prog = qemu_gl_create_compile_link_program
+        (texture_blit_vert_src, texture_blit_frag_src);
+    gls->texture_blit_flip_prog = qemu_gl_create_compile_link_program
+        (texture_blit_flip_vert_src, texture_blit_frag_src);
+    if (!gls->texture_blit_prog || !gls->texture_blit_flip_prog) {
+        exit(1);
+    }
+
+    gls->texture_blit_vao =
+        qemu_gl_init_texture_blit(gls->texture_blit_prog);
+
+    return gls;
+}
+
+void qemu_gl_fini_shader(QemuGLShader *gls)
+{
+    if (!gls) {
+        return;
+    }
+    g_free(gls);
+}
diff --git a/ui/shader/texture-blit-flip.vert b/ui/shader/texture-blit-flip.vert
new file mode 100644
index 0000000..ba081fa
--- /dev/null
+++ b/ui/shader/texture-blit-flip.vert
@@ -0,0 +1,10 @@
+
+#version 300 es
+
+in vec2  in_position;
+out vec2 ex_tex_coord;
+
+void main(void) {
+    gl_Position = vec4(in_position, 0.0, 1.0);
+    ex_tex_coord = vec2(1.0 + in_position.x, 1.0 + in_position.y) * 0.5;
+}
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 0963c78..ad1ceaf 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1019,7 +1019,7 @@
         ssd->gl_unblock_bh = qemu_bh_new(qemu_spice_gl_unblock_bh, ssd);
         ssd->gl_unblock_timer = timer_new_ms(QEMU_CLOCK_REALTIME,
                                              qemu_spice_gl_block_timer, ssd);
-        ssd->gls = console_gl_init_context();
+        ssd->gls = qemu_gl_init_shader();
         ssd->have_surface = false;
         ssd->have_scanout = false;
     }
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index d149383..b47fb45 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -149,6 +149,54 @@
     return PF_UNSPEC;
 }
 
+static int create_fast_reuse_socket(struct addrinfo *e)
+{
+    int slisten = qemu_socket(e->ai_family, e->ai_socktype, e->ai_protocol);
+    if (slisten < 0) {
+        return -1;
+    }
+    socket_set_fast_reuse(slisten);
+    return slisten;
+}
+
+static int try_bind(int socket, InetSocketAddress *saddr, struct addrinfo *e)
+{
+#ifndef IPV6_V6ONLY
+    return bind(socket, e->ai_addr, e->ai_addrlen);
+#else
+    /*
+     * Deals with first & last cases in matrix in comment
+     * for inet_ai_family_from_address().
+     */
+    int v6only =
+        ((!saddr->has_ipv4 && !saddr->has_ipv6) ||
+         (saddr->has_ipv4 && saddr->ipv4 &&
+          saddr->has_ipv6 && saddr->ipv6)) ? 0 : 1;
+    int stat;
+
+ rebind:
+    if (e->ai_family == PF_INET6) {
+        qemu_setsockopt(socket, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
+                        sizeof(v6only));
+    }
+
+    stat = bind(socket, e->ai_addr, e->ai_addrlen);
+    if (!stat) {
+        return 0;
+    }
+
+    /* If we got EADDRINUSE from an IPv6 bind & v6only is unset,
+     * it could be that the IPv4 port is already claimed, so retry
+     * with v6only set
+     */
+    if (e->ai_family == PF_INET6 && errno == EADDRINUSE && !v6only) {
+        v6only = 1;
+        goto rebind;
+    }
+    return stat;
+#endif
+}
+
 static int inet_listen_saddr(InetSocketAddress *saddr,
                              int port_offset,
                              bool update_addr,
@@ -158,7 +206,10 @@
     char port[33];
     char uaddr[INET6_ADDRSTRLEN+1];
     char uport[33];
-    int slisten, rc, port_min, port_max, p;
+    int rc, port_min, port_max, p;
+    int slisten = 0;
+    int saved_errno = 0;
+    bool socket_created = false;
     Error *err = NULL;
 
     memset(&ai,0, sizeof(ai));
@@ -210,75 +261,66 @@
         return -1;
     }
 
-    /* create socket + bind */
+    /* create socket + bind/listen */
     for (e = res; e != NULL; e = e->ai_next) {
         getnameinfo((struct sockaddr*)e->ai_addr,e->ai_addrlen,
 		        uaddr,INET6_ADDRSTRLEN,uport,32,
 		        NI_NUMERICHOST | NI_NUMERICSERV);
-        slisten = qemu_socket(e->ai_family, e->ai_socktype, e->ai_protocol);
+
+        slisten = create_fast_reuse_socket(e);
         if (slisten < 0) {
-            if (!e->ai_next) {
-                error_setg_errno(errp, errno, "Failed to create socket");
-            }
             continue;
         }
 
-        socket_set_fast_reuse(slisten);
-
+        socket_created = true;
         port_min = inet_getport(e);
         port_max = saddr->has_to ? saddr->to + port_offset : port_min;
         for (p = port_min; p <= port_max; p++) {
-#ifdef IPV6_V6ONLY
-            /*
-             * Deals with first & last cases in matrix in comment
-             * for inet_ai_family_from_address().
-             */
-            int v6only =
-                ((!saddr->has_ipv4 && !saddr->has_ipv6) ||
-                 (saddr->has_ipv4 && saddr->ipv4 &&
-                  saddr->has_ipv6 && saddr->ipv6)) ? 0 : 1;
-#endif
             inet_setport(e, p);
-#ifdef IPV6_V6ONLY
-        rebind:
-            if (e->ai_family == PF_INET6) {
-                qemu_setsockopt(slisten, IPPROTO_IPV6, IPV6_V6ONLY, &v6only,
-                                sizeof(v6only));
-            }
-#endif
-            if (bind(slisten, e->ai_addr, e->ai_addrlen) == 0) {
-                goto listen;
-            }
-
-#ifdef IPV6_V6ONLY
-            /* If we got EADDRINUSE from an IPv6 bind & V6ONLY is unset,
-             * it could be that the IPv4 port is already claimed, so retry
-             * with V6ONLY set
-             */
-            if (e->ai_family == PF_INET6 && errno == EADDRINUSE && !v6only) {
-                v6only = 1;
-                goto rebind;
-            }
-#endif
-
-            if (p == port_max) {
-                if (!e->ai_next) {
+            rc = try_bind(slisten, saddr, e);
+            if (rc) {
+                if (errno == EADDRINUSE) {
+                    continue;
+                } else {
                     error_setg_errno(errp, errno, "Failed to bind socket");
+                    goto listen_failed;
                 }
             }
+            if (!listen(slisten, 1)) {
+                goto listen_ok;
+            }
+            if (errno != EADDRINUSE) {
+                error_setg_errno(errp, errno, "Failed to listen on socket");
+                goto listen_failed;
+            }
+            /* Someone else managed to bind to the same port and beat us
+             * to listen on it! Socket semantics does not allow us to
+             * recover from this situation, so we need to recreate the
+             * socket to allow bind attempts for subsequent ports:
+             */
+            closesocket(slisten);
+            slisten = create_fast_reuse_socket(e);
+            if (slisten < 0) {
+                error_setg_errno(errp, errno,
+                                 "Failed to recreate failed listening socket");
+                goto listen_failed;
+            }
         }
+    }
+    error_setg_errno(errp, errno,
+                     socket_created ?
+                     "Failed to find an available port" :
+                     "Failed to create a socket");
+listen_failed:
+    saved_errno = errno;
+    if (slisten >= 0) {
         closesocket(slisten);
     }
     freeaddrinfo(res);
+    errno = saved_errno;
     return -1;
 
-listen:
-    if (listen(slisten,1) != 0) {
-        error_setg_errno(errp, errno, "Failed to listen on socket");
-        closesocket(slisten);
-        freeaddrinfo(res);
-        return -1;
-    }
+listen_ok:
     if (update_addr) {
         g_free(saddr->host);
         saddr->host = g_strdup(uaddr);
diff --git a/vl.c b/vl.c
index d7c3492..0723835 100644
--- a/vl.c
+++ b/vl.c
@@ -4905,6 +4905,7 @@
     res_free();
 
     /* vhost-user must be cleaned up before chardevs.  */
+    tpm_cleanup();
     net_cleanup();
     audio_cleanup();
     monitor_cleanup();