Ian Campbell
2013-Sep-25 11:21 UTC
[PATCH] xen: arm: handle new 64-bit zImage magic numbers
Upstream commit 4370eec05a88 "arm64: Expand arm64 image header" ended up changing the zImage magic (which was actually the initial branch instruction encoding!). The new header has a proper magic number at a fixed location. Support that as well as the original magic. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- xen/arch/arm/kernel.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index f12f895..eb0b096 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -27,7 +27,8 @@ #define ZIMAGE32_MAGIC 0x016f2818 -#define ZIMAGE64_MAGIC 0x14000008 +#define ZIMAGE64_MAGIC_V0 0x14000008 +#define ZIMAGE64_MAGIC_V1 0x644d5241 /* "ARM\x64" */ struct minimal_dtb_header { uint32_t magic; @@ -126,11 +127,16 @@ static int kernel_try_zimage64_prepare(struct kernel_info *info, { /* linux/Documentation/arm64/booting.txt */ struct { - uint32_t magic; + uint32_t magic0; uint32_t res0; uint64_t text_offset; /* Image load offset */ uint64_t res1; uint64_t res2; + uint64_t res3; + uint64_t res4; + uint64_t res5; + uint32_t magic1; + uint32_t res6; } zimage; uint64_t start, end; @@ -139,7 +145,8 @@ static int kernel_try_zimage64_prepare(struct kernel_info *info, copy_from_paddr(&zimage, addr, sizeof(zimage), DEV_SHARED); - if (zimage.magic != ZIMAGE64_MAGIC) + if ( zimage.magic0 != ZIMAGE64_MAGIC_V0 && + zimage.magic1 != ZIMAGE64_MAGIC_V1 ) return -EINVAL; /* Currently there is no length in the header, so just use the size */ -- 1.7.10.4
Tim Deegan
2013-Sep-26 13:10 UTC
Re: [PATCH] xen: arm: handle new 64-bit zImage magic numbers
At 12:21 +0100 on 25 Sep (1380111695), Ian Campbell wrote:> Upstream commit 4370eec05a88 "arm64: Expand arm64 image header" ended up > changing the zImage magic (which was actually the initial branch instruction > encoding!). The new header has a proper magic number at a fixed location. Support that as well as the original magic. > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>Acked-by: Tim Deegan <tim@xen.org>
Ian Campbell
2013-Sep-26 15:07 UTC
Re: [PATCH] xen: arm: handle new 64-bit zImage magic numbers
On Thu, 2013-09-26 at 14:10 +0100, Tim Deegan wrote:> At 12:21 +0100 on 25 Sep (1380111695), Ian Campbell wrote: > > Upstream commit 4370eec05a88 "arm64: Expand arm64 image header" ended up > > changing the zImage magic (which was actually the initial branch instruction > > encoding!). The new header has a proper magic number at a fixed location. Support that as well as the original magic. > > > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > > Acked-by: Tim Deegan <tim@xen.org>Applied, thanks.