[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2] xen/arm: support compressed kernels
On 12/08/15 15:47, Stefano Stabellini wrote: > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> > CC: julien.grall@xxxxxxxxxx > CC: ian.campbell@xxxxxxxxxx > --- > xen/arch/arm/kernel.c | 36 ++++++++++++++++++++++++++++++++++++ > xen/common/Makefile | 2 +- > xen/include/asm-arm/byteorder.h | 2 ++ > 3 files changed, 39 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c > index f641b12..ca50cdd 100644 > --- a/xen/arch/arm/kernel.c > +++ b/xen/arch/arm/kernel.c > @@ -13,6 +13,8 @@ > #include <asm/byteorder.h> > #include <asm/setup.h> > #include <xen/libfdt/libfdt.h> > +#include <xen/decompress.h> > +#include <xen/vmap.h> > > #include "kernel.h" > > @@ -310,6 +312,38 @@ static int kernel_zimage64_probe(struct kernel_info > *info, > > return 0; > } > + > +static int kernel_zimage64_compressed_probe(struct kernel_info *info, > + paddr_t addr, paddr_t size) > +{ > + char *output, *input; > + unsigned char magic[2]; > + int rc; > + unsigned kernel_order_in; > + unsigned kernel_order_out; > + paddr_t output_size; > + > + copy_from_paddr(magic, addr, sizeof(magic)); Need a size check before assuming sufficient length. (All of the arm probe functions suffer in a similar way.) > + > + if (!((magic[0] == 0x1f) && ((magic[1] == 0x8b) || (magic[1] == 0x9e)))) > + return -EINVAL; > + > + kernel_order_in = get_order_from_bytes(size); > + input = (char *)ioremap_cache(addr, size); > + > + output_size = output_length(input, size); > + kernel_order_out = get_order_from_bytes(output_size); > + output = (char *)alloc_xenheap_pages(kernel_order_out, 0); > + > + rc = decompress(input, size, output); > + clean_dcache_va_range(output, output_size); > + iounmap(input); > + > + if (rc != 0) Xen style. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |