提交 7806a49a 编写于 作者: H H. Peter Anvin

x86, reboot: Fix relocations in reboot_32.S

The use of base for %ebx in this file is arbitrary, *except* that we
also use it to compute the real-mode segment.  Therefore, make it so
that r_base really is the true address to which %ebx points.

This resolves kernel bugzilla 33302.
Reported-and-tested-by: NAlexey Zaytsev <alexey.zaytsev@gmail.com>
Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/n/tip-08os5wi3yq1no0y4i5m4z7he@git.kernel.org
上级 2be19102
...@@ -21,26 +21,26 @@ r_base = . ...@@ -21,26 +21,26 @@ r_base = .
/* Get our own relocated address */ /* Get our own relocated address */
call 1f call 1f
1: popl %ebx 1: popl %ebx
subl $1b, %ebx subl $(1b - r_base), %ebx
/* Compute the equivalent real-mode segment */ /* Compute the equivalent real-mode segment */
movl %ebx, %ecx movl %ebx, %ecx
shrl $4, %ecx shrl $4, %ecx
/* Patch post-real-mode segment jump */ /* Patch post-real-mode segment jump */
movw dispatch_table(%ebx,%eax,2),%ax movw (dispatch_table - r_base)(%ebx,%eax,2),%ax
movw %ax, 101f(%ebx) movw %ax, (101f - r_base)(%ebx)
movw %cx, 102f(%ebx) movw %cx, (102f - r_base)(%ebx)
/* Set up the IDT for real mode. */ /* Set up the IDT for real mode. */
lidtl machine_real_restart_idt(%ebx) lidtl (machine_real_restart_idt - r_base)(%ebx)
/* /*
* Set up a GDT from which we can load segment descriptors for real * Set up a GDT from which we can load segment descriptors for real
* mode. The GDT is not used in real mode; it is just needed here to * mode. The GDT is not used in real mode; it is just needed here to
* prepare the descriptors. * prepare the descriptors.
*/ */
lgdtl machine_real_restart_gdt(%ebx) lgdtl (machine_real_restart_gdt - r_base)(%ebx)
/* /*
* Load the data segment registers with 16-bit compatible values * Load the data segment registers with 16-bit compatible values
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册