]> xenbits.xensource.com Git - seabios.git/commitdiff
smbios: Use integer signature instead of string signature
authorKevin O'Connor <kevin@koconnor.net>
Thu, 9 Apr 2015 15:57:44 +0000 (11:57 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 10 Apr 2015 04:38:06 +0000 (00:38 -0400)
Change the smbios structure to use a 4 byte u32 signature field
instead of a 4 byte character string field.  In practice, this allows
the compiler to place the signature in the initialize code segment and
thus makes it less likely the signature would be found in the
f-segment.  (If the smbios signature is found in the f-segment it can
confuse some table scans.)

Reviewed-by: Bruce Rogers <brogers@suse.com>
Tested-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/fw/biostables.c
src/fw/smbios.c
src/std/smbios.h

index 50a891be88782903464494c660f018da0c0a2aef..450aca282e4541a79ddf911791de964b40dde610 100644 (file)
@@ -271,7 +271,7 @@ copy_smbios(void *pos)
     if (SMBiosAddr)
         return;
     struct smbios_entry_point *p = pos;
-    if (memcmp(p->anchor_string, "_SM_", 4))
+    if (p->signature != SMBIOS_SIGNATURE)
         return;
     if (checksum(pos, 0x10) != 0)
         return;
index dba0541338cb278dc60306ab90b885ce1919e0b3..f3b5ad9dd9a02d8c21e86276246d07d8d66c4f39 100644 (file)
@@ -37,7 +37,7 @@ smbios_entry_point_setup(u16 max_structure_size,
 
     struct smbios_entry_point ep;
     memset(&ep, 0, sizeof(ep));
-    memcpy(ep.anchor_string, "_SM_", 4);
+    ep.signature = SMBIOS_SIGNATURE;
     ep.length = 0x1f;
     ep.smbios_major_version = 2;
     ep.smbios_minor_version = 4;
index 05137167a21dc135cf03c5df4df05bb052da7ba4..4ccf2ea348eead3eafb6b9da2f5ce88e65c1acd4 100644 (file)
@@ -3,11 +3,13 @@
 
 #include "types.h" // u32
 
+#define SMBIOS_SIGNATURE 0x5f4d535f // "_SM_"
+
 /* SMBIOS entry point -- must be written to a 16-bit aligned address
    between 0xf0000 and 0xfffff.
  */
 struct smbios_entry_point {
-    char anchor_string[4];
+    u32 signature;
     u8 checksum;
     u8 length;
     u8 smbios_major_version;