diff options
-rw-r--r-- | CHANGELOG | 5 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | dmidecode.c | 12 | ||||
-rw-r--r-- | util.c | 6 | ||||
-rw-r--r-- | util.h | 4 |
5 files changed, 20 insertions, 13 deletions
@@ -2,8 +2,9 @@ Update to support SMBIOS specification version 3.0.0. - * dmidecode.c: Add preliminary support for the new _SM3_ 64-bit - entry point defined in the SMBIOS specification version 3.0.0. + * dmidecode.c: Add support for the new _SM3_ 64-bit entry point + defined in the SMBIOS specification version 3.0.0, including + support of 64-bit addresses and 32-bit table lengths. * dmidecode.c: Add 3 new chassis types (DMI type 3). * dmidecode.c: Add 4 new processor families (DMI type 4). * dmidecode.c: Add 4 new Intel socket types (DMI type 4). @@ -4,7 +4,7 @@ # VPD Decode # # Copyright (C) 2000-2002 Alan Cox <alan@redhat.com> -# Copyright (C) 2002-2007 Jean Delvare <jdelvare@suse.de> +# Copyright (C) 2002-2015 Jean Delvare <jdelvare@suse.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,6 +15,10 @@ CC = gcc CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \ -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef + +# Let lseek and mmap support 64-bit wide offsets +CFLAGS += -D_FILE_OFFSET_BITS=64 + #CFLAGS += -DBIGENDIAN #CFLAGS += -DALIGNMENT_WORKAROUND diff --git a/dmidecode.c b/dmidecode.c index 731026a..693e417 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -4356,7 +4356,7 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver } } -static void dmi_table_dump(u32 base, u16 len, const char *devmem) +static void dmi_table_dump(off_t base, u32 len, const char *devmem) { u8 *buf; @@ -4372,7 +4372,7 @@ static void dmi_table_dump(u32 base, u16 len, const char *devmem) free(buf); } -static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, +static void dmi_table(off_t base, u32 len, u16 num, u16 ver, const char *devmem, u32 flags) { u8 *buf; @@ -4400,7 +4400,8 @@ static void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem, printf("%u structures occupying %u bytes.\n", num, len); if (!(opt.flags & FLAG_FROM_DUMP)) - printf("Table at 0x%08X.\n", base); + printf("Table at 0x%08llX.\n", + (unsigned long long)base); } printf("\n"); } @@ -4555,13 +4556,14 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags) buf[0x07], buf[0x08], buf[0x09]); offset = QWORD(buf + 0x10); - if (!(flags & FLAG_NO_FILE_OFFSET) && offset.h) + if (!(flags & FLAG_NO_FILE_OFFSET) && offset.h && sizeof(off_t) < 8) { fprintf(stderr, "64-bit addresses not supported, sorry.\n"); return 0; } - dmi_table(offset.l, WORD(buf + 0x0C), 0, ver, devmem, flags); + dmi_table(((off_t)offset.h << 32) | offset.l, + WORD(buf + 0x0C), 0, ver, devmem, flags); if (opt.flags & FLAG_DUMP_BIN) { @@ -2,7 +2,7 @@ * Common "util" functions * This file is part of the dmidecode project. * - * Copyright (C) 2002-2010 Jean Delvare <jdelvare@suse.de> + * Copyright (C) 2002-2015 Jean Delvare <jdelvare@suse.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -147,12 +147,12 @@ void *read_file(size_t max_len, const char *filename) * Copy a physical memory chunk into a memory buffer. * This function allocates memory. */ -void *mem_chunk(size_t base, size_t len, const char *devmem) +void *mem_chunk(off_t base, size_t len, const char *devmem) { void *p; int fd; #ifdef USE_MMAP - size_t mmoffset; + off_t mmoffset; void *mmp; #endif @@ -1,7 +1,7 @@ /* * This file is part of the dmidecode project. * - * Copyright (C) 2003-2010 Jean Delvare <jdelvare@suse.de> + * Copyright (C) 2003-2015 Jean Delvare <jdelvare@suse.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,6 @@ int checksum(const u8 *buf, size_t len); void *read_file(size_t len, const char *filename); -void *mem_chunk(size_t base, size_t len, const char *devmem); +void *mem_chunk(off_t base, size_t len, const char *devmem); int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add); u64 u64_range(u64 start, u64 end); |