SPARC32: mark initrd memory as mapped and in use before booting kernel

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland
2019-01-25 16:11:29 +00:00
parent c87d0eb00c
commit f633f31bcb
3 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,8 @@
uint32_t kernel_image;
uint32_t kernel_size;
uint32_t initrd_image;
uint32_t initrd_size;
uint32_t qemu_cmdline;
uint32_t cmdline_size;
char boot_device;

View File

@ -932,6 +932,16 @@ arch_init( void )
obp_arg.argv[1] = cmdline;
qemu_cmdline = (uint32_t)cmdline;
initrd_size = fw_cfg_read_i32(FW_CFG_INITRD_SIZE);
if (initrd_size) {
initrd_image = fw_cfg_read_i32(FW_CFG_INITRD_ADDR);
/* Mark initrd memory as mapped 1:1 and in use */
ofmem_claim_phys(PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_size), 0);
ofmem_claim_virt(PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_size), 0);
ofmem_map(PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_size), -1);
}
/* Setup nvram variables */
push_str("/options");
fword("find-device");

View File

@ -106,6 +106,8 @@ void ob_intr(int intr);
/* arch/sparc32/boot.c */
extern uint32_t kernel_image;
extern uint32_t kernel_size;
extern uint32_t initrd_image;
extern uint32_t initrd_size;
extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size;
extern char boot_device;