mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-24 08:28:37 -07:00
There is currently no way to open(O_RDONLY) and mmap(PROT_READ) when creating a memory region from a file. This functionality is needed since the underlying host file may not allow writing. Add a bool readonly argument to memory_region_init_ram_from_file() and the APIs it calls. Extend memory_region_init_ram_from_file() rather than introducing a memory_region_init_rom_from_file() API so that callers can easily make a choice between read/write and read-only at runtime without calling different APIs. No new RAMBlock flag is introduced for read-only because it's unclear whether RAMBlocks need to know that they are read-only. Pass a bool readonly argument instead. Both of these design decisions can be changed in the future. It just seemed like the simplest approach to me. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20210104171320.575838-2-stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> |
||
|---|---|---|
| .. | ||
| user | ||
| address-spaces.h | ||
| cpu-all.h | ||
| cpu-common.h | ||
| cpu-defs.h | ||
| cpu_ldst.h | ||
| cputlb.h | ||
| exec-all.h | ||
| gdbstub.h | ||
| gen-icount.h | ||
| helper-gen.h | ||
| helper-head.h | ||
| helper-proto.h | ||
| helper-tcg.h | ||
| hwaddr.h | ||
| ioport.h | ||
| log.h | ||
| memattrs.h | ||
| memop.h | ||
| memory-internal.h | ||
| memory.h | ||
| memory_ldst.h.inc | ||
| memory_ldst_cached.h.inc | ||
| memory_ldst_phys.h.inc | ||
| plugin-gen.h | ||
| poison.h | ||
| ram_addr.h | ||
| ramblock.h | ||
| ramlist.h | ||
| softmmu-semi.h | ||
| target_page.h | ||
| tb-context.h | ||
| tb-hash.h | ||
| tb-lookup.h | ||
| translate-all.h | ||
| translator.h | ||