Index: seabios/src/post.c
===================================================================
--- seabios.orig/src/post.c
+++ seabios/src/post.c
@@ -18,6 +18,7 @@
 #include "bregs.h" // struct bregs
 #include "mptable.h" // mptable_init
 #include "boot.h" // IPL
+#include "qemu-cfg.h"
 
 void
 __set_irq(int vector, void *loc)
@@ -158,6 +159,15 @@ post()
     init_ivt();
     init_bda();
 
+    /*
+     * Test for emulator earlier, to be able to runtime check whether
+     * we are on QEMU/KVM/Coreboot etc.
+     *
+     * Would be ideal to be able to runtime test for coreboot in here,
+     * if someone knows how to do so reliably.
+     */
+    qemu_cfg_port_probe();
+
     pic_setup();
     timer_setup();
     mathcp_setup();
Index: seabios/src/qemu-cfg.c
===================================================================
--- seabios.orig/src/qemu-cfg.c
+++ seabios/src/qemu-cfg.c
@@ -10,6 +10,8 @@
 #include "ioport.h"
 #include "qemu-cfg.h"
 
+int qemu_cfg_port = 0;
+
 void
 qemu_cfg_read(u8 *buf, u16 f, int len)
 {
@@ -24,6 +26,8 @@ qemu_cfg_port_probe()
     u8 sig[4] = "QEMU";
     u8 buf[4];
     qemu_cfg_read(buf, QEMU_CFG_SIGNATURE, 4);
-    return *(u32*)buf == *(u32*)sig;
+    if (*(u32*)buf == *(u32*)sig)
+        qemu_cfg_port = 1;
+    return qemu_cfg_port;
 }
 
Index: seabios/src/smbios.c
===================================================================
--- seabios.orig/src/smbios.c
+++ seabios/src/smbios.c
@@ -24,7 +24,7 @@ uuid_probe(u8 *bios_uuid)
         return;
     if (CONFIG_COREBOOT)
         return;
-    if (! qemu_cfg_port_probe())
+    if (!qemu_cfg_port)
         // Feature not available
         return;
 
Index: seabios/src/util.h
===================================================================
--- seabios.orig/src/util.h
+++ seabios/src/util.h
@@ -264,4 +264,7 @@ extern int irq0override;
 // version (auto generated file out/version.c)
 extern const char VERSION[];
 
+// qemu-cfg.c
+extern int qemu_cfg_port;
+
 #endif // util.h
