mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com> --HG-- rename : linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_pre.h => linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch.h rename : patches/linux-2.6.17/blktap-aio-16_03_06.patch => patches/linux-2.6.18/blktap-aio-16_03_06.patch rename : patches/linux-2.6.17/fix-ide-cd-pio-mode.patch => patches/linux-2.6.18/fix-ide-cd-pio-mode.patch rename : patches/linux-2.6.17/git-3566561bfadffcb5dbc85d576be80c0dbf2cccc9.patch => patches/linux-2.6.18/git-3566561bfadffcb5dbc85d576be80c0dbf2cccc9.patch rename : patches/linux-2.6.17/git-4bfaaef01a1badb9e8ffb0c0a37cd2379008d21f.patch => patches/linux-2.6.18/git-4bfaaef01a1badb9e8ffb0c0a37cd2379008d21f.patch rename : patches/linux-2.6.17/git-dbaab49f92ff6ae6255762a948375e4036cbdbd2.patch => patches/linux-2.6.18/git-dbaab49f92ff6ae6255762a948375e4036cbdbd2.patch rename : patches/linux-2.6.17/i386-mach-io-check-nmi.patch => patches/linux-2.6.18/i386-mach-io-check-nmi.patch rename : patches/linux-2.6.17/ipv6-no-autoconf.patch => patches/linux-2.6.18/ipv6-no-autoconf.patch rename : patches/linux-2.6.17/linux-2.6.19-rc1-kexec-move_segment_code-i386.patch => patches/linux-2.6.18/linux-2.6.19-rc1-kexec-move_segment_code-i386.patch rename : patches/linux-2.6.17/linux-2.6.19-rc1-kexec-move_segment_code-x86_64.patch => patches/linux-2.6.18/linux-2.6.19-rc1-kexec-move_segment_code-x86_64.patch rename : patches/linux-2.6.17/net-csum.patch => patches/linux-2.6.18/net-csum.patch rename : patches/linux-2.6.17/net-gso-5-rcv-mss.patch => patches/linux-2.6.18/net-gso-5-rcv-mss.patch rename : patches/linux-2.6.17/net-gso-6-linear-segmentation.patch => patches/linux-2.6.18/net-gso-6-linear-segmentation.patch rename : patches/linux-2.6.17/pmd-shared.patch => patches/linux-2.6.18/pmd-shared.patch rename : patches/linux-2.6.17/rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch => patches/linux-2.6.18/rename-TSS_sysenter_esp0-SYSENTER_stack_esp0.patch rename : patches/linux-2.6.17/series => patches/linux-2.6.18/series rename : patches/linux-2.6.17/x86-elfnote-as-preprocessor-macro.patch => patches/linux-2.6.18/x86-elfnote-as-preprocessor-macro.patch rename : patches/linux-2.6.17/x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch => patches/linux-2.6.18/x86-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch rename : patches/linux-2.6.17/x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch => patches/linux-2.6.18/x86_64-put-note-sections-into-a-pt_note-segment-in-vmlinux.patch rename : patches/linux-2.6.17/xen-hotplug.patch => patches/linux-2.6.18/xen-hotplug.patch rename : patches/linux-2.6.17/xenoprof-generic.patch => patches/linux-2.6.18/xenoprof-generic.patch
144 lines
3.7 KiB
Diff
144 lines
3.7 KiB
Diff
diff -pruN ../orig-linux-2.6.18/arch/x86_64/kernel/machine_kexec.c ./arch/x86_64/kernel/machine_kexec.c
|
|
--- ../orig-linux-2.6.18/arch/x86_64/kernel/machine_kexec.c 2007-01-12 16:03:49.000000000 +0000
|
|
+++ ./arch/x86_64/kernel/machine_kexec.c 2007-01-12 16:04:02.000000000 +0000
|
|
@@ -112,47 +112,6 @@ static int init_pgtable(struct kimage *i
|
|
return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT);
|
|
}
|
|
|
|
-static void set_idt(void *newidt, u16 limit)
|
|
-{
|
|
- struct desc_ptr curidt;
|
|
-
|
|
- /* x86-64 supports unaliged loads & stores */
|
|
- curidt.size = limit;
|
|
- curidt.address = (unsigned long)newidt;
|
|
-
|
|
- __asm__ __volatile__ (
|
|
- "lidtq %0\n"
|
|
- : : "m" (curidt)
|
|
- );
|
|
-};
|
|
-
|
|
-
|
|
-static void set_gdt(void *newgdt, u16 limit)
|
|
-{
|
|
- struct desc_ptr curgdt;
|
|
-
|
|
- /* x86-64 supports unaligned loads & stores */
|
|
- curgdt.size = limit;
|
|
- curgdt.address = (unsigned long)newgdt;
|
|
-
|
|
- __asm__ __volatile__ (
|
|
- "lgdtq %0\n"
|
|
- : : "m" (curgdt)
|
|
- );
|
|
-};
|
|
-
|
|
-static void load_segments(void)
|
|
-{
|
|
- __asm__ __volatile__ (
|
|
- "\tmovl %0,%%ds\n"
|
|
- "\tmovl %0,%%es\n"
|
|
- "\tmovl %0,%%ss\n"
|
|
- "\tmovl %0,%%fs\n"
|
|
- "\tmovl %0,%%gs\n"
|
|
- : : "a" (__KERNEL_DS) : "memory"
|
|
- );
|
|
-}
|
|
-
|
|
int machine_kexec_prepare(struct kimage *image)
|
|
{
|
|
unsigned long start_pgtable;
|
|
@@ -209,23 +168,6 @@ NORET_TYPE void machine_kexec(struct kim
|
|
page_list[PA_TABLE_PAGE] =
|
|
(unsigned long)__pa(page_address(image->control_code_page));
|
|
|
|
- /* The segment registers are funny things, they have both a
|
|
- * visible and an invisible part. Whenever the visible part is
|
|
- * set to a specific selector, the invisible part is loaded
|
|
- * with from a table in memory. At no other time is the
|
|
- * descriptor table in memory accessed.
|
|
- *
|
|
- * I take advantage of this here by force loading the
|
|
- * segments, before I zap the gdt with an invalid value.
|
|
- */
|
|
- load_segments();
|
|
- /* The gdt & idt are now invalid.
|
|
- * If you want to load them you must set up your own idt & gdt.
|
|
- */
|
|
- set_gdt(phys_to_virt(0),0);
|
|
- set_idt(phys_to_virt(0),0);
|
|
-
|
|
- /* now call it */
|
|
relocate_kernel((unsigned long)image->head, (unsigned long)page_list,
|
|
image->start);
|
|
}
|
|
diff -pruN ../orig-linux-2.6.18/arch/x86_64/kernel/relocate_kernel.S ./arch/x86_64/kernel/relocate_kernel.S
|
|
--- ../orig-linux-2.6.18/arch/x86_64/kernel/relocate_kernel.S 2007-01-12 16:03:49.000000000 +0000
|
|
+++ ./arch/x86_64/kernel/relocate_kernel.S 2007-01-12 16:04:02.000000000 +0000
|
|
@@ -159,13 +159,39 @@ relocate_new_kernel:
|
|
movq PTR(PA_PGD)(%rsi), %r9
|
|
movq %r9, %cr3
|
|
|
|
+ /* setup idt */
|
|
+ movq %r8, %rax
|
|
+ addq $(idt_80 - relocate_kernel), %rax
|
|
+ lidtq (%rax)
|
|
+
|
|
+ /* setup gdt */
|
|
+ movq %r8, %rax
|
|
+ addq $(gdt - relocate_kernel), %rax
|
|
+ movq %r8, %r9
|
|
+ addq $((gdt_80 - relocate_kernel) + 2), %r9
|
|
+ movq %rax, (%r9)
|
|
+
|
|
+ movq %r8, %rax
|
|
+ addq $(gdt_80 - relocate_kernel), %rax
|
|
+ lgdtq (%rax)
|
|
+
|
|
+ /* setup data segment registers */
|
|
+ xorl %eax, %eax
|
|
+ movl %eax, %ds
|
|
+ movl %eax, %es
|
|
+ movl %eax, %fs
|
|
+ movl %eax, %gs
|
|
+ movl %eax, %ss
|
|
+
|
|
/* setup a new stack at the end of the physical control page */
|
|
lea 4096(%r8), %rsp
|
|
|
|
- /* jump to identity mapped page */
|
|
- addq $(identity_mapped - relocate_kernel), %r8
|
|
- pushq %r8
|
|
- ret
|
|
+ /* load new code segment and jump to identity mapped page */
|
|
+ movq %r8, %rax
|
|
+ addq $(identity_mapped - relocate_kernel), %rax
|
|
+ pushq $(gdt_cs - gdt)
|
|
+ pushq %rax
|
|
+ lretq
|
|
|
|
identity_mapped:
|
|
/* store the start address on the stack */
|
|
@@ -272,5 +298,19 @@ identity_mapped:
|
|
xorq %r13, %r13
|
|
xorq %r14, %r14
|
|
xorq %r15, %r15
|
|
-
|
|
ret
|
|
+
|
|
+ .align 16
|
|
+gdt:
|
|
+ .quad 0x0000000000000000 /* NULL descriptor */
|
|
+gdt_cs:
|
|
+ .quad 0x00af9a000000ffff
|
|
+gdt_end:
|
|
+
|
|
+gdt_80:
|
|
+ .word gdt_end - gdt - 1 /* limit */
|
|
+ .quad 0 /* base - filled in by code above */
|
|
+
|
|
+idt_80:
|
|
+ .word 0 /* limit */
|
|
+ .quad 0 /* base */
|