1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
5 #include <linux/memblock.h>
10 static int __init __uml_load_file(const char *filename, void *buf, int size)
14 fd = os_open_file(filename, of_read(OPENFLAGS()), 0);
16 printk(KERN_ERR "Opening '%s' failed - err = %d\n", filename,
20 n = os_read_file(fd, buf, size);
22 printk(KERN_ERR "Read of %d bytes from '%s' failed, "
32 void *uml_load_file(const char *filename, unsigned long long *size)
42 err = os_file_size(filename, size);
47 printk(KERN_ERR "\"%s\" is empty\n", filename);
51 area = memblock_alloc(*size, SMP_CACHE_BYTES);
53 panic("%s: Failed to allocate %llu bytes\n", __func__, *size);
55 if (__uml_load_file(filename, area, *size)) {
56 memblock_free(area, *size);