#0 main (argc=2, argv=0x7fffffffe0a8, envp=0x7fffffffe0c0) at vl.c:4243
#1 pc_init_pci (args=0x7fffffffde70) hw/i386/pc_piix.c:240
#2 pc_init1 (args=0x7fffffffde70, pci_enabled=1, kvmclock_enabled=1) at hw/i386/pc_piix.c:134
Memory related struct
#3 pc_memory_init (system_memory=0x55555624c620, kernel_filename=0x0,
kernel_cmdline=0x5555559b2f66 "", initrd_filename=0x0,
below_4g_mem_size=134217728, above_4g_mem_size=0,
rom_memory=0x555556255360, ram_memory=0x7fffffffdb78,
guest_info=0x555556255430) at hw/i386/pc.c:1156
#4 memory_region_init_ram (mr=0x555556255490,
owner=0x0, name=0x5555559bc6f7 "pc.ram", size=134217728)
at memory.c:1018
#5 qemu_ram_alloc (size=134217728, mr=0x555556255490)
at exec.c:1183
#6 qemu_ram_alloc_from_ptr (size=134217728, host=0x0, mr=0x555556255490)
at exec.c:1103
-> phys_mem_alloc(size);
static void *(*phys_mem_alloc)(size_t size) = qemu_anon_ram_alloc;
-> qemu_anon_ram_alloc (size=134217728) at util/oslib-posix.c:107
#7 kvm_setup_guest_memory (start=0x7fffe4000000, size=134217728)
at kvm-all.c:1840
in the QEMU,
in hw/i386/pc.c
FWCfgState *pc_memory_init(MemoryRegion *system_memory,
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
ram_addr_t below_4g_mem_size,
ram_addr_t above_4g_mem_size,
MemoryRegion *rom_memory,
MemoryRegion **ram_memory,
PcGuestInfo *guest_info)
ram = g_malloc(sizeof(*ram)); /* create instance of ram */
memory_region_init_ram(ram, NULL, "pc.ram", /* initialize struct */
below_4g_mem_size + above_4g_mem_size);
vmstate_register_ram_global(ram);
vmstate_register_ram(mr, NULL);
qemu_ram_set_idstr(memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK,
memory_region_name(mr), dev);
struct MemoryRegion in include/exec/memory.h
struct MemoryRegion {
/* All fields are private - violators will be prosecuted */
const MemoryRegionOps *ops;
const MemoryRegionIOMMUOps *iommu_ops;
void *opaque;
struct Object *owner;
MemoryRegion *parent;
Int128 size;
hwaddr addr;
void (*destructor)(MemoryRegion *mr);
ram_addr_t ram_addr;
bool subpage;
bool terminates;
bool romd_mode;
bool ram;
bool readonly; /* For RAM regions */
bool enabled;
bool rom_device;
bool warning_printed; /* For reservations */
bool flush_coalesced_mmio;
MemoryRegion *alias;
hwaddr alias_offset;
int priority;
bool may_overlap;
QTAILQ_HEAD(subregions, MemoryRegion) subregions;
QTAILQ_ENTRY(MemoryRegion) subregions_link;
QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced;
const char *name;
uint8_t dirty_log_mask;
unsigned ioeventfd_nb;
MemoryRegionIoeventfd *ioeventfds;
NotifierList iommu_notify;
};
typedef struct RAMBlock {
struct MemoryRegion *mr;
uint8_t *host;
ram_addr_t offset;
ram_addr_t length;
uint32_t flags;
char idstr[256];
/* Reads can take either the iothread or the ramlist lock.
* Writes must take both locks.
*/
QTAILQ_ENTRY(RAMBlock) next;
int fd;
} RAMBlock;