aboutsummaryrefslogtreecommitdiff
path: root/hw/m68k
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-09-26 13:39:00 +0200
committerLaurent Vivier <laurent@vivier.eu>2022-09-26 23:37:22 +0200
commit2cfa963126fe77fac034a43f986b2bf3e8fe6a4f (patch)
tree0f27ae83441d5ec3b070a87bdc3c0b299015fe38 /hw/m68k
parentb342e56b23dc2a0a1f30e21d67d001a1d0befbf0 (diff)
downloadqemu-2cfa963126fe77fac034a43f986b2bf3e8fe6a4f.zip
qemu-2cfa963126fe77fac034a43f986b2bf3e8fe6a4f.tar.gz
qemu-2cfa963126fe77fac034a43f986b2bf3e8fe6a4f.tar.bz2
m68k: align bootinfo strings and data to 4 bytes
Various tools, such as kexec-tools and m68k-bootinfo, expect each bootinfo entry to be aligned to 4 bytes, not 2 bytes. So adjust the padding to fill this out as such. Also, break apart the padding additions from the other field length additions, so that it's more clear why these magic numbers are being added, and comment them too. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20220926113900.1256630-2-Jason@zx2c4.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/m68k')
-rw-r--r--hw/m68k/bootinfo.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/hw/m68k/bootinfo.h b/hw/m68k/bootinfo.h
index bd8b212..897162b 100644
--- a/hw/m68k/bootinfo.h
+++ b/hw/m68k/bootinfo.h
@@ -48,13 +48,14 @@
stw_phys(as, base, id); \
base += 2; \
stw_phys(as, base, \
- (sizeof(struct bi_record) + strlen(string) + 2) & ~1); \
+ (sizeof(struct bi_record) + strlen(string) + \
+ 1 /* null termination */ + 3 /* padding */) & ~3); \
base += 2; \
for (i = 0; string[i]; i++) { \
stb_phys(as, base++, string[i]); \
} \
stb_phys(as, base++, 0); \
- base = (base + 1) & ~1; \
+ base = (base + 3) & ~3; \
} while (0)
#define BOOTINFODATA(as, base, id, data, len) \
@@ -63,13 +64,14 @@
stw_phys(as, base, id); \
base += 2; \
stw_phys(as, base, \
- (sizeof(struct bi_record) + len + 3) & ~1); \
+ (sizeof(struct bi_record) + len + \
+ 2 /* length field */ + 3 /* padding */) & ~3); \
base += 2; \
stw_phys(as, base, len); \
base += 2; \
for (i = 0; i < len; ++i) { \
stb_phys(as, base++, data[i]); \
} \
- base = (base + 1) & ~1; \
+ base = (base + 3) & ~3; \
} while (0)
#endif