文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Lguest boot

Lguest boot

时间:2010-05-17  来源:baozhao

从patch整体来看, 2.6.24后lguest是较早切入了Kernel的启动过程,而2.6.23是后期才切入。
 

一  2.6.23之前


http://www.kernel.org/doc/ols/2007/ols2007v2-pages-173-178.pdf


中说到How does the kernel know it’s an lguest guest? The
first code the x86 kernel runs are is startup_32 in head.S. This tests if paging is already enabled: if it is,
we know we’re under some kind of hypervisor. We end up trying all the registered paravirt_probe func-
tions, and end up in the one in drivers/lguest/lguest.c.

 

http://lkml.org/lkml/2007/4/10/74

中lguest_maybe_init 函数

 

二 2.6.23

但是出现了变化

下面的链接

http://lkml.org/lkml/2007/5/6/196

[PATCH 2/3] lguest: 2.6.21-mm1 update: lguest-magic-signature.patch

解释了在2.6.23.2内核代码,




启动过程:


函数调用流程


main函数的流程(Documentation/lguest/lguest.c)


 

 http://lkml.indiana.edu/hypermail/linux/kernel/0705.0/1995.html



1 . 得到第一条指令地址,返回在start中(实际为entry_point( Documentation/lguest/lguest.c)



start = load_kernel(open_or_die(argv[optind+1], O_RDONLY), &page_offset);

 

2 初始化各寄存器, 为启动做好准备


tell_kernel(pgdir, start, page_offset) => write=>  initialize(file, (const u32 __user *)input); ==>  setup_regs(lg->regs, args[2]); 将准备好cs:eip


3 run_guest

entry_point( Documentation/lguest/lguest.c)==>GenuineLguest(drivers/lguest/lguest_asm.S)  ==> lguest_init (drivers/lguest/lguest.c)=>start_kernel


三 2.6.24


次要变化: 对page_offset的处理
 

[RFC PATCH 2/3] lguest: Boot with virtual == physical to get closer to native Linux.

http://lkml.org/lkml/2007/5/4/203
正 式的补丁  [patch 31/43] lguest: Boot with virtual == physical to get closer to native Linux. https://lists.linux-foundation.org/pipermail/virtualization/2007-September/008948.html  




主要 变化:修改了Boot protocol , 增加虚拟机启动标志

见 Documentation/i386/boot.txt(自2.6.24开始)

 

[Lguest] [PATCH 0/5] Boot protocol changes    http://lists.ozlabs.org/pipermail/lguest/2007-October/000579.html   [PATCH 4/5] Revert lguest magic and use hook in head.S

http://lists.ozlabs.org/pipermail/lguest/2007-October/000583.html


2.6.34 的具体分析

从map_elf 和load_bzimage来看, lguest的启动直接跳过setup()函数, 而进入
/arch/x86/kernel/head_32.S 中的startup_32(), 参见ULK 3RD 附录A.

startup_32有对lguest的入口 lguest_entry,在arch/x86/lguest/i386_head.S中有ENTRY(lguest_entry)
#ifdef CONFIG_PARAVIRT
    /* This is can only trip for a broken bootloader... */
    cmpw $0x207, pa(boot_params + BP_version)
    jb default_entry
/* Paravirt-compatible boot parameters.  Look to see what architecture
        we're booting under. */
    movl pa(boot_params + BP_hardware_subarch), %eax
    cmpl $num_subarch_entries, %eax
    jae bad_subarch

    movl pa(subarch_entries)(,%eax,4), %eax
    subl $__PAGE_OFFSET, %eax
    jmp *%eax


在main()( Documentation/lguest/lguest.c)函数中有如下代码, 可见根本不需要修改内核映像vmlinux或bzImage, 而是直接在代码中设定

 /* Boot protocol version: 2.07 supports the fields for lguest. */
    boot->hdr.version = 0x207;

    /* The hardware_subarch value of "1" tells the Guest it's an lguest. */
    boot->hdr.hardware_subarch = 1;


   
    
 
 
相关阅读 更多 +
排行榜 更多 +
奥丘树海之下小米服手游下载

奥丘树海之下小米服手游下载

角色扮演 下载
网络天才国际服手游下载

网络天才国际服手游下载

休闲益智 下载
御剑红尘手游官方版下载

御剑红尘手游官方版下载

角色扮演 下载