understanding_qemu
  • Introduction
  • 设备模型
    • 设备类型注册
    • 设备类型初始化
    • 设备实例化
    • DeviceClass实例化细节
    • 面向对象的设备模型
    • 接口
    • 类型、对象和接口之间的转换
    • PCDIMM
      • PCDIMM类型
      • PCDIMM实例
      • 插入系统
      • 创建ACPI表
      • NVDIMM
  • 地址空间
    • 从初始化开始
    • MemoryRegion
    • AddressSpace Part1
    • FlatView
    • RAMBlock
    • AddressSpace Part2
    • 眼见为实
    • 添加MemoryRegion
  • APIC
    • 纯Qemu模拟
    • Qemu/kernel混合模拟
    • APICV
  • Live Migration
    • 从用法说起
    • 整体架构
    • VMStateDescription
    • 内存热迁移
    • postcopy
  • FW_CFG
    • 规范解读
    • Linux Guest
    • SeaBios
  • Machine
    • MachineType
    • PCMachine
  • CPU
    • TYPE_CPU
    • X86_CPU
  • MemoryBackend
    • MemoryBackend类层次结构
    • MemoryBackend初始化流程
Powered by GitBook
On this page

Was this helpful?

  1. 地址空间

从初始化开始

刚开始看这部分代码的时候是一脸懵逼的,感觉哪里都连接着哪里不知道从哪里入手。既然如此,那还是从初始化的流程上开始看吧。

main()
  cpu_exec_init_all()
    io_mem_init()
    {
      memory_region_init_io(&io_mem_rom, NULL, &readonly_mem_ops, NULL, NULL, UINT64_MAX);
      memory_region_init_io(&io_mem_unassigned, NULL, &unassigned_mem_ops, NULL, NULL, UINT64_MAX);
      memory_region_init_io(&io_mem_notdirty, NULL, &notdirty_mem_ops, NULL, NULL, UINT64_MAX);
      memory_region_clear_global_locking(&io_mem_notdirty);
      memory_region_init_io(&io_mem_watch, NULL, &watch_mem_ops, NULL, NULL, UINT64_MAX);
    }
    memory_map_init()
    {
      memory_region_init(system_memory, NULL, "system", UINT64_MAX);
      address_space_init(&address_space_memory, system_memory, "memory");
      memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io", 65536);
      address_space_init(&address_space_io, system_io, "I/O");
    }

这部分代码是在main函数中开始的部分执行的。其中主要使用了两个函数:

  • memory_region_init

  • address_space_init

既然如此,那我们就挨个了解一下。

Previous地址空间NextMemoryRegion

Last updated 6 years ago

Was this helpful?