Jonathan Neuschäfer (j.neuschaefer@gmx.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14985
-gerrit
commit 1e795cad1e0e1579c60c329a58147b301f4b8819 Author: Jonathan Neuschäfer j.neuschaefer@gmx.net Date: Fri May 27 09:05:03 2016 +0200
[UNVERIFIED] lb_new_record: Make sure that records are 8-byte aligned
Some records contain uint64_t fields that could trigger an unaligned memory access fault on RISC-V.
I have not yet tested whether this patch breaks any other architectures.
Change-Id: I54ff68ca00009a0977249adc839fadc4a1d6881d Signed-off-by: Jonathan Neuschäfer j.neuschaefer@gmx.net --- src/lib/coreboot_table.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 3af2be6..cf37776 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -87,6 +87,10 @@ struct lb_record *lb_new_record(struct lb_header *header) struct lb_record *rec; rec = lb_last_record(header); if (header->table_entries) { + /* Make sure that the next record is sufficiently aligned to + * avoid an unaligned memory access. */ + rec->size = ALIGN_UP(rec->size, sizeof(uint64_t)); + header->table_bytes += rec->size; } rec = lb_last_record(header);