小编use*_*636的帖子

Linux内核header.S来源,为什么_end + 3在归零BSS时需要?

在Linux源代码树中,文件arch/x86/boot/header.S具有类似于此的x86代码,以便在被调用之前清除BSS部分main:

...
# Zero the bss
    movw    $__bss_start, %di
    movw    $_end+3, %cx
    xorl    %eax, %eax
    subw    %di, %cx
    shrw    $2, %cx
    rep; stosl
...
Run Code Online (Sandbox Code Playgroud)

为什么_end地址中添加了3个?为什么不movw $_end, %cx代替movw $_end+3, %cx

linux x86 assembly linux-kernel bootloader

7
推荐指数
1
解决办法
236
查看次数

标签 统计

assembly ×1

bootloader ×1

linux ×1

linux-kernel ×1

x86 ×1