qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

VW ELF loader


From: Alexey Kardashevskiy
Subject: VW ELF loader
Date: Sun, 2 Feb 2020 00:39:32 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1

Hi!

In my effort to "kill SLOF" (the PPC pseries guest firmware), I proceeded to the stage when QEMU needs to load GRUB from the disk. The current workaround is to read it from qcow2, save in a file and then call load_elf(). Not nice.

2 problems with that.

1. when load_elf calls address_space_write() - I need to know where and how much RAM was used to mark this memory "used" for the OF client interface (/memory@0/available FDT property). So I'll need "preload()" hook.

2. (bigger) GRUB comes from PReP partition which is 8MB. load_elf{32|64} consumes filename, not a memory pointer nor a "read_fn" callback - so I thought I need a "read_fn" callback.

And then I discovered that load_elf actually maps the passed file. And here I 
got lost.

Why does not load_elf just map the entire file and parse the bits? It still reads chunks with seek+read and then it maps the file in a loop potentially multiple times - is this even correct? Passing "fd" around is weird.

Why ROMs are different from "-kernel"?

If I want to solve 1 and 2 of my problem, should I just cut-n-paste load_elf and tweak bits rather then add more parameters to already 15-parameters long prototypes? Or I could read GRUB from qcow2 into the memory and change the rest to parse ELF from memory (mapped from a ELF file or read from qcow2)?


Thanks,

ps. VW == very weird, indeed :)

--
Alexey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]