[coreboot-gerrit] Patch set updated for coreboot: a34cc32 lib/hexdump: Take const void * and size_t as arguments

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Wed Jan 8 04:25:46 CET 2014


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4575

-gerrit

commit a34cc32d7af7539186b0215fddc6cb137edf5906
Author: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Date:   Thu Dec 26 22:53:52 2013 -0500

    lib/hexdump: Take const void * and size_t as arguments
    
    Representing a memory location as an unsigned long is specific to
    32-bit architectures. It also doesn't make sense to represent a length
    assumed to be positive as a signed integer. With this change, it is no
    longer necessary to cast a pointer to unsigned long when passing it to
    hexdump.
    
    Change-Id: I641777d940ceac6f37c363051f1e9c1b3ec3ed95
    Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
---
 src/include/lib.h | 3 ++-
 src/lib/hexdump.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/include/lib.h b/src/include/lib.h
index 5fc390a..6e9c505 100644
--- a/src/include/lib.h
+++ b/src/include/lib.h
@@ -22,6 +22,7 @@
 #ifndef __LIB_H__
 #define __LIB_H__
 #include <stdint.h>
+#include <types.h>
 
 #ifndef __PRE_RAM__ /* Conflicts with inline function in arch/io.h */
 /* Defined in src/lib/clog2.c */
@@ -57,6 +58,6 @@ void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx);
 void post_cache_as_ram(void);
 
 /* Defined in src/lib/hexdump.c */
-void hexdump(unsigned long memory, int length);
+void hexdump(const void *memory, size_t length);
 
 #endif /* __LIB_H__ */
diff --git a/src/lib/hexdump.c b/src/lib/hexdump.c
index d24ae77..82b0a3b 100644
--- a/src/lib/hexdump.c
+++ b/src/lib/hexdump.c
@@ -28,7 +28,7 @@ static int isprint(int c)
 	return (c >= 32 && c <= 126);
 }
 
-void hexdump(unsigned long memory, int length)
+void hexdump(const void* memory, size_t length)
 {
         int i;
         uint8_t *m;
@@ -48,7 +48,7 @@ void hexdump(unsigned long memory, int length)
                 }
 
                 if (all_zero < 2) {
-                        printk(BIOS_DEBUG, "%08lx:", memory + i);
+                        printk(BIOS_DEBUG, "%p:", memory + i);
                         for (j = 0; j < 16; j++)
                                 printk(BIOS_DEBUG, " %02x", m[i+j]);
                         printk(BIOS_DEBUG, "  ");



More information about the coreboot-gerrit mailing list