[Crosstoolchain-logs] [device-tree-compiler] 13/357: Ensure that the reserve map is doubleword aligned in blob and asm output.

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:05:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit 47f23dee09ffa076467128b0fd01ac9d5762829f
Author: David Gibson <dgibson at sneetch.(none)>
Date:   Mon Jul 11 17:19:26 2005 +1000

    Ensure that the reserve map is doubleword aligned in blob and asm output.
---
 flattree.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/flattree.c b/flattree.c
index dd6bc1d..9b97191 100644
--- a/flattree.c
+++ b/flattree.c
@@ -291,6 +291,7 @@ static void make_bph(struct boot_param_header *bph,
 			     int reservenum,
 			     int dtsize, int strsize)
 {
+	int reserve_off;
 	int reservesize = (reservenum+1) * sizeof(struct reserve_entry);
 
 	memset(bph, 0xff, sizeof(*bph));
@@ -299,11 +300,14 @@ static void make_bph(struct boot_param_header *bph,
 	bph->version = vi->version;
 	bph->last_comp_version = vi->last_comp_version;
 
-	bph->off_mem_rsvmap = cpu_to_be32(vi->hdr_size);
-	bph->off_dt_struct = cpu_to_be32(vi->hdr_size + reservesize);
-	bph->off_dt_strings = cpu_to_be32(vi->hdr_size + reservesize
+	/* Reserve map should be doubleword aligned */
+	reserve_off = ALIGN(vi->hdr_size, 8);
+
+	bph->off_mem_rsvmap = cpu_to_be32(reserve_off);
+	bph->off_dt_struct = cpu_to_be32(reserve_off + reservesize);
+	bph->off_dt_strings = cpu_to_be32(reserve_off + reservesize
 					  + dtsize);
-	bph->totalsize = cpu_to_be32(vi->hdr_size + reservesize
+	bph->totalsize = cpu_to_be32(reserve_off + reservesize
 				     + dtsize + strsize);
 		
 	if (vi->flags & FTF_BOOTCPUID)
@@ -336,6 +340,10 @@ void write_dt_blob(FILE *f, struct node *tree, int version, int reservenum)
 
 	make_bph(&bph, vi, reservenum, dtbuf.len, strbuf.len);
 
+	/* Align the reserve map to an 8 byte boundary */
+	for (i = vi->hdr_size; i < be32_to_cpu(bph.off_mem_rsvmap); i++)
+		fputc(0, f);
+
 	fwrite(&bph, vi->hdr_size, 1, f);
 	for (i = 0; i < reservenum+1; i++)
 		fwrite(&re, sizeof(re), 1, f);
@@ -408,6 +416,8 @@ void write_dt_asm(FILE *f, struct node *tree, int version, int reservenum)
 		fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n",
 			symprefix, symprefix);
 
+	/* align the reserve map to a doubleword boundary */
+	asm_emit_align(f, 8);
 	emit_label(f, symprefix, "reserve_map");
 	/* reserve map entry for the device tree itself */
 	fprintf(f, "\t.long\t0, _%s_blob_start\n", symprefix);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list