【QEMU系统分析之实例篇(十三)】

发布于:2024-05-05 ⋅ 阅读:(34) ⋅ 点赞:(0)

系列文章目录

第十三章 QEMU系统仿真的机器创建分析实例



前言

本文以 QEMU 8.2.2 为例,分析其作为系统仿真工具的工作过程,并为读者展示各种 QEMU 系统仿真的启动配置实例。
本文读者需要具备一定的 QEMU 系统仿真使用经验,并对 C 语言编程有一定了解。


一、QEMU是什么?

QEMU 是一个通用且开源的机器模拟器和虚拟机。
其官方主页是:https://www.qemu.org/


二、QEMU系统仿真的机器创建分析实例

1.系统仿真的命令行参数

QEMU 作为系统仿真工具,其入口代码在 system/main.c 文件中,初始化函数 qemu_init() 的实现在 system/vl.c 文件中。
前文完成创建目标机器的过程分析,本文将继续后续运行过程的分析,读者需要对 QEMU 系统启动过程的程序代码有所了解,相关内容可以参考《QEMU系统分析之启动篇》系列文章。

..\qemu\8.2.2-qkd\qemu-system-x86_64.exe -cpu "Penryn" -M  "q35,accel=whpx,smm=off" -m "6G" -display "sdl" -audio "sdl,model=hda" -vga "std" -L "data"

2.完成早期后端驱动的设置工作

这部分代码在 system/vl.c 文件中,实现如下:

int qemu_init(int argc, char **argv)
{
...
    qemu_create_early_backends();
...
}

前文分析了创建显示输出和默认设备的过程,本文将继续逐步跟踪创建早期后端驱动的过程,看看系统需要提前创建哪些后端驱动。


qemu_create_early_backends()

函数 qemu_create_early_backends() 代码如下:

static void qemu_create_early_backends(void)
{
    MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
#if defined(CONFIG_SDL)
    const bool use_sdl = (dpy.type == DISPLAY_TYPE_SDL);
#else
    const bool use_sdl = false;
#endif
#if defined(CONFIG_GTK)
    const bool use_gtk = (dpy.type == DISPLAY_TYPE_GTK);
#else
    const bool use_gtk = false;
#endif

    if (dpy.has_window_close && !use_gtk && !use_sdl) {
        error_report("window-close is only valid for GTK and SDL, "
                     "ignoring option");
    }

    qemu_console_early_init();

    if (dpy.has_gl && dpy.gl != DISPLAYGL_MODE_OFF && display_opengl == 0) {
#if defined(CONFIG_OPENGL)
        error_report("OpenGL is not supported by the display");
#else
        error_report("OpenGL support is disabled");
#endif
        exit(1);
    }

    object_option_foreach_add(object_create_early);

    /* spice needs the timers to be initialized by this point */
    /* spice must initialize before audio as it changes the default audiodev */
    /* spice must initialize before chardevs (for spicevmc and spiceport) */
    qemu_spice.init();

    qemu_opts_foreach(qemu_find_opts("chardev"),
                      chardev_init_func, NULL, &error_fatal);

#ifdef CONFIG_VIRTFS
    qemu_opts_foreach(qemu_find_opts("fsdev"),
                      fsdev_init_func, NULL, &error_fatal);
#endif

    /*
     * Note: we need to create audio and block backends before
     * setting machine properties, so they can be referred to.
     */
    configure_blockdev(&bdo_queue, machine_class, snapshot);
    audio_init_audiodevs();
    if (default_audio) {
        audio_create_default_audiodevs();
    }
}

首先我们对控制台进行前期初始化,代码如下:

    qemu_console_early_init();

qemu_console_early_init();

代码如下:

void qemu_console_early_init(void)
{
    /* set the default vc driver */
    if (!object_class_by_name(TYPE_CHARDEV_VC)) {
        type_register(&char_vc_type_info);
    }
}

如果没有类型为 TYPE_CHARDEV_VC 的类,就注册这个类型。


object_option_foreach_add(object_create_early)

然后对需要提前创建的对象,将其加入对象选项表里。


初始化字符设备

接下来,对 ”chardev“ 设备调用函数 chardev_init_func() 完成字符设备的初始化,代码如下:

void qemu_display_early_init(DisplayOptions *opts)
{
...
    qemu_opts_foreach(qemu_find_opts("chardev"),
                      chardev_init_func, NULL, &error_fatal);
...
}

configure_blockdev(&bdo_queue, machine_class, snapshot)

audio_init_audiodevs()

audio_create_default_audiodevs()

3.调试输出

首先,添加跟踪调试信息,修改后的代码如下:

```c
static void qemu_create_early_backends(void)
{
	...
    huedbg_flag = 1;
    HUEDBG("\n");
    huedbg_dump_device_configs(2);
    HUEDBG("\n");
    qemu_create_early_backends();
    HUEDBG("\n");
    huedbg_dump_device_configs(2);
    HUEDBG("\n");
    huedbg_flag = 0;
    ...
}

运行后,输出信息如下:

[13832]../system/vl.c/qemu_init(3805):
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(134):<<<deep>>>=[2] device_configs=[p(00007ff716d51cc0)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(136):device_configs.tqh_first=[00000183981af480]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(92):<<<deep>>>=[0] conf=[00000183981af480]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(94):type=[1]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(98):cmdline=[vc:80Cx24C]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(99):loc=[p(00000183981af490)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(100):next=[p(00000183981af4a8)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(101):next.tqe_next=[00000183981ae7c0]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(92):<<<deep>>>=[0] conf=[00000183981ae7c0]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(94):type=[2]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(98):cmdline=[vc:80Cx24C]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(99):loc=[p(00000183981ae7d0)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(100):next=[p(00000183981ae7e8)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(101):next.tqe_next=[0000000000000000]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(141):device_configs.tqh_circ.tql_next=[00000183981af480]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(142):device_configs.tqh_circ.tql_prev=[00000183981ae7e8]
[13832]../system/vl.c/qemu_init(3807):
[13832]../ui/console-vc.c/qemu_console_early_init(1085):enter
[13832]../qom/object.c/object_class_by_name(1095):enter
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev-vc) in hash table
[13832]../qom/object.c/object_class_by_name(1099):no type return
[13832]../ui/console-vc.c/qemu_console_early_init(1088):run
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev-vc) in hash table
[13832]../ui/console-vc.c/qemu_console_early_init(1090):run
[13832]../ui/console-vc.c/qemu_console_early_init(1092):exit
[13832]../qom/object.c/object_class_by_name(1095):enter
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev-vc) in hash table
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../qom/object.c/type_initialize(337):name=[chardev-vc] new ti->class enter
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../ui/console-vc.c/char_vc_class_init(1065):enter
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../ui/console-vc.c/char_vc_class_init(1073):exit
[13832]../qom/object.c/type_initialize(410):name=[chardev-vc] new class return
[13832]../qom/object.c/object_class_by_name(1105):class(chardev-vc) return
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/object_class_by_name(1095):enter
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev-vc) in hash table
[13832]../qom/object.c/object_class_by_name(1105):class(chardev-vc) return
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev-vc) in hash table
[13832]../qom/object.c/object_new_with_type(789):try type_initialize(chardev-vc)
[13832]../qom/object.c/object_new_with_type(799):obj(chardev-vc) alloc
[13832]../qom/object.c/object_new_with_type(808):try object_initialize_with_type(chardev-vc)
[13832]../qom/object.c/object_initialize_with_type(568):obj with type(chardev-vc) enter
[13832]../qom/object.c/object_initialize_with_type(576):mapping obj(chardev-vc).class with type(chardev-vc).class
[13832]../qom/object.c/object_initialize_with_type(579):try object_class_property_init_all(chardev-vc)
[13832]../qom/object.c/object_class_property_init_all(552):obj(chardev-vc) enter
[13832]../qom/object.c/object_class_property_iter_init(1440):objclass{chardev-vc} enter
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(chardev-vc) has parent(chardev)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(chardev-vc) return
[13832]../qom/object.c/object_class_property_iter_init(1443):objclass{chardev-vc} return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(chardev) has parent(object)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(chardev) return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[13832]../qom/object.c/object_class_property_init_all(555):prop name=[type] type=[string] desc=[(null)] init=[0000000000000000]
[13832]../qom/object.c/object_class_property_init_all(563):obj(chardev-vc) return
[13832]../qom/object.c/object_initialize_with_type(583):try object_init_with_type(chardev-vc)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[chardev-vc] ti->name=[chardev-vc] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[chardev-vc] ti->name=[chardev] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[chardev-vc] ti->name=[object] enter
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[chardev-vc] ti->name=[object] return
[13832]../qom/object.c/object_init_with_type(423):name=[chardev] ti->instance_init() before
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/object_init_with_type(425):name=[chardev] ti->instance_init() after
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[chardev-vc] ti->name=[chardev] return
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[chardev-vc] ti->name=[chardev-vc] return
[13832]../qom/object.c/object_initialize_with_type(585):try object_post_init_with_type(chardev-vc)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[chardev-vc] ti->name=[chardev-vc] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(chardev)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[chardev-vc] ti->name=[chardev] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[chardev-vc] ti->name=[object] enter
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_initialize_with_type(587):obj(chardev-vc) return
[13832]../qom/object.c/object_new_with_type(812):obj(chardev-vc) return
[13832]../ui/console-vc.c/vc_chr_open(978):enter
[13832]../qom/object.c/type_table_lookup(103):lookup type(chardev-vc) in hash table
[13832]../qom/object.c/type_table_lookup(103):lookup type(qemu-fixed-text-console) in hash table
[13832]../qom/object.c/object_new_with_type(789):try type_initialize(qemu-fixed-text-console)
[13832]../qom/object.c/object_new_with_type(799):obj(qemu-fixed-text-console) alloc
[13832]../qom/object.c/object_new_with_type(808):try object_initialize_with_type(qemu-fixed-text-console)
[13832]../qom/object.c/object_initialize_with_type(568):obj with type(qemu-fixed-text-console) enter
[13832]../qom/object.c/object_initialize_with_type(576):mapping obj(qemu-fixed-text-console).class with type(qemu-fixed-text-console).class
[13832]../qom/object.c/object_initialize_with_type(579):try object_class_property_init_all(qemu-fixed-text-console)
[13832]../qom/object.c/object_class_property_init_all(552):obj(qemu-fixed-text-console) enter
[13832]../qom/object.c/object_class_property_iter_init(1440):objclass{qemu-fixed-text-console} enter
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-text-console)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(qemu-fixed-text-console) has parent(qemu-text-console)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(qemu-fixed-text-console) return
[13832]../qom/object.c/object_class_property_iter_init(1443):objclass{qemu-fixed-text-console} return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-console)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(qemu-text-console) has parent(qemu-console)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(qemu-text-console) return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(qemu-console) has parent(object)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(qemu-console) return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[13832]../qom/object.c/object_class_property_init_all(555):prop name=[type] type=[string] desc=[(null)] init=[0000000000000000]
[13832]../qom/object.c/object_class_property_init_all(563):obj(qemu-fixed-text-console) return
[13832]../qom/object.c/object_initialize_with_type(583):try object_init_with_type(qemu-fixed-text-console)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-fixed-text-console] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-text-console)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-text-console] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-console)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-console] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[qemu-fixed-text-console] ti->name=[object] enter
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[qemu-fixed-text-console] ti->name=[object] return
[13832]../qom/object.c/object_init_with_type(423):name=[qemu-console] ti->instance_init() before
[13832]../qom/object.c/type_table_lookup(103):lookup type(qemu-console) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-text-console)
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-console)
[13832]../qom/object.c/object_init_with_type(425):name=[qemu-console] ti->instance_init() after
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-console] return
[13832]../qom/object.c/object_init_with_type(423):name=[qemu-text-console] ti->instance_init() before
[13832]../qom/object.c/type_table_lookup(103):lookup type(qemu-text-console) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-text-console)
[13832]../qom/object.c/type_table_lookup(103):lookup type(qemu-console) in hash table
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-text-console)
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-console)
[13832]../qom/object.c/object_init_with_type(425):name=[qemu-text-console] ti->instance_init() after
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-text-console] return
[13832]../qom/object.c/object_init_with_type(423):name=[qemu-fixed-text-console] ti->instance_init() before
[13832]../qom/object.c/object_init_with_type(425):name=[qemu-fixed-text-console] ti->instance_init() after
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-fixed-text-console] return
[13832]../qom/object.c/object_initialize_with_type(585):try object_post_init_with_type(qemu-fixed-text-console)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-fixed-text-console] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-text-console)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-text-console] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(qemu-console)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[qemu-fixed-text-console] ti->name=[qemu-console] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[qemu-fixed-text-console] ti->name=[object] enter
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_initialize_with_type(587):obj(qemu-fixed-text-console) return
[13832]../qom/object.c/object_new_with_type(812):obj(qemu-fixed-text-console) return
[13832]../ui/console-vc.c/vc_chr_open(1026):enter
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[13832]../qom/object.c/type_table_lookup(103):lookup type(container) in hash table
[13832]../qom/object.c/object_new_with_type(789):try type_initialize(container)
[13832]../qom/object.c/object_new_with_type(799):obj(container) alloc
[13832]../qom/object.c/object_new_with_type(808):try object_initialize_with_type(container)
[13832]../qom/object.c/object_initialize_with_type(568):obj with type(container) enter
[13832]../qom/object.c/object_initialize_with_type(576):mapping obj(container).class with type(container).class
[13832]../qom/object.c/object_initialize_with_type(579):try object_class_property_init_all(container)
[13832]../qom/object.c/object_class_property_init_all(552):obj(container) enter
[13832]../qom/object.c/object_class_property_iter_init(1440):objclass{container} enter
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[13832]../qom/object.c/object_class_property_iter_init(1443):objclass{container} return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[13832]../qom/object.c/object_class_property_init_all(555):prop name=[type] type=[string] desc=[(null)] init=[0000000000000000]
[13832]../qom/object.c/object_class_property_init_all(563):obj(container) return
[13832]../qom/object.c/object_initialize_with_type(583):try object_init_with_type(container)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[container] ti->name=[container] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_init_with_type(416):obj->class->type->name=[container] ti->name=[object] enter
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[container] ti->name=[object] return
[13832]../qom/object.c/object_init_with_type(427):obj->class->type->name=[container] ti->name=[container] return
[13832]../qom/object.c/object_initialize_with_type(585):try object_post_init_with_type(container)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[container] ti->name=[container] enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_post_init_with_type(433):obj->class->type->name=[container] ti->name=[object] enter
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_post_init_with_type(444):return
[13832]../qom/object.c/object_initialize_with_type(587):obj(container) return
[13832]../qom/object.c/object_new_with_type(812):obj(container) return
[13832]../qom/object.c/object_property_try_add(1309):name=[chardevs] enter!
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[13832]../qom/object.c/object_property_try_add(1350):name=[chardevs] return-3!
[13832]../qom/object.c/object_property_try_add(1309):name=[compat_monitor0] enter!
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(194):parent_type(object)
[13832]../qom/object.c/object_class_get_parent(1138):objclass(container) has parent(object)
[13832]../qom/object.c/object_class_get_parent(1141):objclass(container) return
[13832]../qom/object.c/object_class_get_parent(1130):enter
[13832]../qom/object.c/type_get_parent(196):no parent_type
[13832]../qom/object.c/object_class_get_parent(1134):objclass(object) has no parent return
[13832]../qom/object.c/object_property_try_add(1350):name=[compat_monitor0] return-3!
[13832]../system/vl.c/qemu_create_early_backends(2027):
[13832]../blockdev.c/drive_new(879):value=[cdrom]
[13832]../blockdev.c/drive_new(1019):
[13832]../blockdev.c/blockdev_init(484):
[13832]../blockdev.c/drive_new(1021):
[13832]../blockdev.c/drive_new(879):value=[(null)]
[13832]../blockdev.c/drive_new(1019):
[13832]../blockdev.c/blockdev_init(484):
[13832]../blockdev.c/drive_new(1021):
[13832]../system/vl.c/qemu_create_early_backends(2029):
[13832]../system/vl.c/qemu_create_early_backends(2031):
[13832]../system/vl.c/qemu_init(3809):
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(134):<<<deep>>>=[2] device_configs=[p(00007ff716d51cc0)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(136):device_configs.tqh_first=[00000183981af480]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(92):<<<deep>>>=[0] conf=[00000183981af480]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(94):type=[1]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(98):cmdline=[vc:80Cx24C]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(99):loc=[p(00000183981af490)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(100):next=[p(00000183981af4a8)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(101):next.tqe_next=[00000183981ae7c0]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(92):<<<deep>>>=[0] conf=[00000183981ae7c0]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(94):type=[2]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(98):cmdline=[vc:80Cx24C]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(99):loc=[p(00000183981ae7d0)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(100):next=[p(00000183981ae7e8)]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_config(101):next.tqe_next=[0000000000000000]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(141):device_configs.tqh_circ.tql_next=[00000183981af480]
[13832]D:/msys64/home/yuhui/gitee/mingw-qemu/util/huedbg_inline-device_config.c/huedbg_dump_device_configs(142):device_configs.tqh_circ.tql_prev=[00000183981ae7e8]

总结

以上分析了系统初始化过程中创建早期后端驱动的过程。