[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Eliminate hard coded items from x86_64 __xen_guest section
# HG changeset patch # User cl349@xxxxxxxxxxxxxxxxxxxx # Node ID 012e133941fc08c1e7078ee3d49d6b0833e96d34 # Parent c93c6b392ce54e1f6e6b95529a90741b6b8b41e1 Eliminate hard coded items from x86_64 __xen_guest section to avoid problems when the position of the hypercall page changes. Further, clean up many things to avoid needless differences to native code, while also adding a couple of adjustments that only will be submitted for native code inclusion, that simplify code, or that remove unused elements. From: Jan Beulich <JBeulich@xxxxxxxxxx> Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx> diff -r c93c6b392ce5 -r 012e133941fc linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Mon Feb 20 16:08:27 2006 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Mon Feb 20 16:42:54 2006 @@ -14,15 +14,6 @@ #include <linux/linkage.h> - -.section __xen_guest - .ascii "GUEST_OS=linux,GUEST_VER=2.6" - .ascii ",XEN_VER=xen-3.0" - .ascii ",VIRT_BASE=0xffffffff80000000" - .ascii ",HYPERCALL_PAGE=0x10a" /* __pa(hypercall_page) >> 12 */ - .ascii ",LOADER=generic" - .byte 0 - #include <linux/threads.h> #include <linux/init.h> #include <asm/desc.h> @@ -30,64 +21,21 @@ #include <asm/page.h> #include <asm/msr.h> #include <asm/cache.h> - -/* we are not able to switch in one step to the final KERNEL ADRESS SPACE - * because we need identity-mapped pages on setup so define __START_KERNEL to - * 0x100000 for this stage - * - */ .text .code64 .globl startup_64 startup_64: ENTRY(_start) - movq %rsi,xen_start_info(%rip) - -#ifdef CONFIG_SMP -ENTRY(startup_64_smp) -#endif /* CONFIG_SMP */ - - cld - - movq init_rsp(%rip),%rsp + movq $(init_thread_union+THREAD_SIZE-8),%rsp /* zero EFLAGS after setting rsp */ pushq $0 popfq - movq initial_code(%rip),%rax - jmp *%rax - /* SMP bootup changes these two */ - .globl initial_code -initial_code: - .quad x86_64_start_kernel - .globl init_rsp -init_rsp: - .quad init_thread_union+THREAD_SIZE-8 - -ENTRY(early_idt_handler) - xorl %eax,%eax - movq 8(%rsp),%rsi # get rip - movq (%rsp),%rdx - leaq early_idt_msg(%rip),%rdi -1: hlt # generate #GP - jmp 1b - -early_idt_msg: - .asciz "PANIC: early exception rip %lx error %lx cr2 %lx\n" - -#if 0 -ENTRY(lgdt_finish) - movl $(__USER_DS),%eax # DS/ES contains default USER segment - movw %ax,%ds - movw %ax,%es - movl $(__KERNEL_DS),%eax - movw %ax,%ss # after changing gdt. - popq %rax # get the retrun address - pushq $(__KERNEL_CS) - pushq %rax - lretq -#endif + /* rsi is pointer to startup info structure. + pass it to C */ + movq %rsi,%rdi + jmp x86_64_start_kernel ENTRY(stext) ENTRY(_stext) @@ -113,39 +61,9 @@ NEXT_PAGE(init_level4_user_pgt) .fill 512,8,0 - /* - * In Xen the following pre-initialized pgt entries are re-initialized. - */ NEXT_PAGE(level3_kernel_pgt) - .fill 510,8,0 - /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */ - .quad phys_level2_kernel_pgt | 0x007 - .fill 1,8,0 + .fill 512,8,0 -NEXT_PAGE(level2_ident_pgt) - /* 40MB for bootup. */ - i = 0 - .rept 20 - .quad i << 21 | 0x083 - i = i + 1 - .endr - /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */ - .globl temp_boot_pmds -temp_boot_pmds: - .fill 492,8,0 - -NEXT_PAGE(level2_kernel_pgt) - /* 40MB kernel mapping. The kernel code cannot be bigger than that. - When you change this change KERNEL_TEXT_SIZE in page.h too. */ - /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ - i = 0 - .rept 20 - .quad i << 21 | 0x183 - i = i + 1 - .endr - /* Module mapping starts here */ - .fill 492,8,0 - /* * This is used for vsyscall area mapping as we have a different * level4 page table for user. @@ -153,78 +71,16 @@ NEXT_PAGE(level3_user_pgt) .fill 512,8,0 -NEXT_PAGE(cpu_gdt_table) -/* The TLS descriptors are currently at a different place compared to i386. - Hopefully nobody expects them at a fixed place (Wine?) */ - .quad 0x0000000000000000 /* NULL descriptor */ - .quad 0x0 /* unused */ - .quad 0x00affa000000ffff /* __KERNEL_CS */ - .quad 0x00cff2000000ffff /* __KERNEL_DS */ - .quad 0x00cffa000000ffff /* __USER32_CS */ - .quad 0x00cff2000000ffff /* __USER_DS, __USER32_DS */ - .quad 0x00affa000000ffff /* __USER_CS */ - .quad 0x00cffa000000ffff /* __KERNEL32_CS */ - .quad 0,0 /* TSS */ - .quad 0,0 /* LDT */ - .quad 0,0,0 /* three TLS descriptors */ - .quad 0 /* unused */ -gdt_end: -#if 0 - /* asm/segment.h:GDT_ENTRIES must match this */ - /* This should be a multiple of the cache line size */ - /* GDTs of other CPUs are now dynamically allocated */ - - /* zero the remaining page */ - .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0 -#endif +NEXT_PAGE(level2_kernel_pgt) + .fill 512,8,0 NEXT_PAGE(empty_zero_page) - -NEXT_PAGE(level3_physmem_pgt) - .quad phys_level2_kernel_pgt | 0x007 /* so that __va works even before pagetable_init */ + .skip PAGE_SIZE NEXT_PAGE(hypercall_page) -.if (phys_hypercall_page - 0x10a000) - /* cause compiler error if the hypercall_page is at a - * different address than expected. */ - .quad __adjust_hypercall_page_in_header -.endif .fill 512,8,0 #undef NEXT_PAGE - - .data - -#ifndef CONFIG_XEN -#ifdef CONFIG_ACPI_SLEEP - .align PAGE_SIZE -ENTRY(wakeup_level4_pgt) - .quad phys_level3_ident_pgt | 0x007 - .fill 255,8,0 - .quad phys_level3_physmem_pgt | 0x007 - .fill 254,8,0 - /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ - .quad phys_level3_kernel_pgt | 0x007 -#endif - -#ifndef CONFIG_HOTPLUG_CPU - __INITDATA -#endif - /* - * This default setting generates an ident mapping at address 0x100000 - * and a mapping for the kernel that precisely maps virtual address - * 0xffffffff80000000 to physical address 0x000000. (always using - * 2Mbyte large pages provided by PAE mode) - */ - .align PAGE_SIZE -ENTRY(boot_level4_pgt) - .quad phys_level3_ident_pgt | 0x007 - .fill 255,8,0 - .quad phys_level3_physmem_pgt | 0x007 - .fill 254,8,0 - /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ - .quad phys_level3_kernel_pgt | 0x007 -#endif .data @@ -246,11 +102,59 @@ * Also sysret mandates a special GDT layout */ -.align PAGE_SIZE + .section .data.page_aligned, "aw" + .align PAGE_SIZE +/* The TLS descriptors are currently at a different place compared to i386. + Hopefully nobody expects them at a fixed place (Wine?) */ + +ENTRY(cpu_gdt_table) + .quad 0x0000000000000000 /* NULL descriptor */ + .quad 0x0 /* unused */ + .quad 0x00affa000000ffff /* __KERNEL_CS */ + .quad 0x00cff2000000ffff /* __KERNEL_DS */ + .quad 0x00cffa000000ffff /* __USER32_CS */ + .quad 0x00cff2000000ffff /* __USER_DS, __USER32_DS */ + .quad 0x00affa000000ffff /* __USER_CS */ + .quad 0x00cffa000000ffff /* __KERNEL32_CS */ + .quad 0,0 /* TSS */ + .quad 0,0 /* LDT */ + .quad 0,0,0 /* three TLS descriptors */ + .quad 0 /* unused */ +gdt_end: + /* asm/segment.h:GDT_ENTRIES must match this */ + /* This should be a multiple of the cache line size */ + /* GDTs of other CPUs are now dynamically allocated */ + + /* zero the remaining page */ + .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0 + + .section .bss, "aw", @nobits + .align L1_CACHE_BYTES ENTRY(idt_table) .rept 256 .quad 0 .quad 0 .endr +/* + * __xen_guest information + */ +.macro utoh value + .if (\value) < 0 || (\value) >= 0x10 + utoh (((\value)>>4)&0x0fffffffffffffff) + .endif + .if ((\value) & 0xf) < 10 + .byte '0' + ((\value) & 0xf) + .else + .byte 'A' + ((\value) & 0xf) - 10 + .endif +.endm + +.section __xen_guest + .ascii "GUEST_OS=linux,GUEST_VER=2.6" + .ascii ",XEN_VER=xen-3.0" + .ascii ",VIRT_BASE=0x"; utoh __START_KERNEL_map + .ascii ",HYPERCALL_PAGE=0x"; utoh (phys_hypercall_page >> PAGE_SHIFT) + .ascii ",LOADER=generic" + .byte 0 diff -r c93c6b392ce5 -r 012e133941fc linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c Mon Feb 20 16:08:27 2006 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c Mon Feb 20 16:42:54 2006 @@ -47,7 +47,7 @@ static void __init copy_bootdata(char *real_mode_data) { -#if 0 +#ifndef CONFIG_XEN int new_data; char * command_line; @@ -63,7 +63,6 @@ } command_line = (char *) ((u64)(new_data)); memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); - printk("Bootdata ok (command line is %s)\n", saved_command_line); #else int max_cmdline; @@ -71,8 +70,8 @@ max_cmdline = COMMAND_LINE_SIZE; memcpy(saved_command_line, xen_start_info->cmd_line, max_cmdline); saved_command_line[max_cmdline-1] = '\0'; +#endif printk("Bootdata ok (command line is %s)\n", saved_command_line); -#endif } static void __init setup_boot_cpu_data(void) @@ -98,6 +97,7 @@ char *s; int i; + xen_start_info = (struct start_info *)real_mode_data; if (!xen_feature(XENFEAT_auto_translated_physmap)) { phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list; @@ -105,9 +105,9 @@ xen_start_info->nr_pt_frames; } +#if 0 for (i = 0; i < 256; i++) set_intr_gate(i, early_idt_handler); -#if 0 asm volatile("lidt %0" :: "m" (idt_descr)); #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |