[coreboot-gerrit] Patch set updated for coreboot: lb_tables: make lb_mainboard and lb_strings align to 128-bits

Ronald G. Minnich (rminnich@gmail.com) gerrit at coreboot.org
Wed Jan 18 22:26:07 CET 2017


Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18165

-gerrit

commit e0f01b4dbf32b7fde412532042cf789004a84309
Author: Ronald G. Minnich <rminnich at gmail.com>
Date:   Tue Jan 17 23:20:48 2017 -0800

    lb_tables: make lb_mainboard and lb_strings align to 128-bits
    
    lb_mainboard and lb_strings were creating records
    aligned to 32 bits, which is fine until you get to
    architectures requiring 64-bits and possibly 128-bits
    alignment.
    
    Change these functions to align their size to 128 bits,
    so they don't force alignments traps on RISC systems
    such as riscv.
    
    Change-Id: I494b942c4866a7912fb48a53f9524db20ac53a8c
    Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
---
 src/lib/coreboot_table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index f8da658..731880a 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -351,7 +351,7 @@ static struct lb_mainboard *lb_mainboard(struct lb_header *header)
 	mainboard->size = (sizeof(*mainboard) +
 		strlen(mainboard_vendor) + 1 +
 		strlen(mainboard_part_number) + 1 +
-		3) & ~3;
+		0xf) & ~0xf;
 
 	mainboard->vendor_idx = 0;
 	mainboard->part_number_idx = strlen(mainboard_vendor) + 1;
@@ -402,7 +402,7 @@ static void lb_strings(struct lb_header *header)
 		rec = (struct lb_string *)lb_new_record(header);
 		len = strlen(strings[i].string);
 		rec->tag = strings[i].tag;
-		rec->size = (sizeof(*rec) + len + 1 + 3) & ~3;
+		rec->size = (sizeof(*rec) + len + 1 + 0xf) & ~0xf;
 		memcpy(rec->string, strings[i].string, len+1);
 	}
 



More information about the coreboot-gerrit mailing list