ia64/xen-unstable

changeset 1670:136fbd9e41af

bitkeeper revision 1.1041.6.5 (40e6bc28spUzzcq9522VffBvuZcbag)

setup.c, x86_64.S:
More x86_64.
author kaf24@scramble.cl.cam.ac.uk
date Sat Jul 03 14:01:12 2004 +0000 (2004-07-03)
parents b7c52d517a26
children 025e093088ad 138e97a36173
files xen/arch/x86/boot/x86_64.S xen/arch/x86/setup.c
line diff
     1.1 --- a/xen/arch/x86/boot/x86_64.S	Fri Jul 02 10:14:27 2004 +0000
     1.2 +++ b/xen/arch/x86/boot/x86_64.S	Sat Jul 03 14:01:12 2004 +0000
     1.3 @@ -20,20 +20,27 @@ ENTRY(start)
     1.4  	/* Checksum: must be the negated sum of the first two fields. */
     1.5  	.long	-0x1BADB004
     1.6          
     1.7 +bad_cpu_msg:
     1.8 +        .asciz "Bad CPU: does not support 64-bit (long) mode."
     1.9  bad_cpu:
    1.10 -        jmp     bad_cpu
    1.11 +        mov     $SYMBOL_NAME(bad_cpu_msg)-__PAGE_OFFSET,%esi
    1.12 +        mov     $0xB8000,%edi  # VGA framebuffer
    1.13 +1:      mov     (%esi),%bl
    1.14 +        test    %bl,%bl        # Terminate on '\0' sentinel
    1.15 +2:      je      2b
    1.16 +        mov     $0x3f8+5,%dx   # UART Line Status Register
    1.17 +3:      in      %dx,%al
    1.18 +        test    $0x20,%al      # Test THR Empty flag
    1.19 +        je      3b
    1.20 +        mov     $0x3f8+0,%dx   # UART Transmit Holding Register
    1.21 +        mov     %bl,%al
    1.22 +        out     %al,%dx        # Send a character over the serial line
    1.23 +        movsb                  # Write a character to the VGA framebuffer
    1.24 +        mov     $7,%al
    1.25 +        stosb                  # Write an attribute to the VGA framebuffer
    1.26 +        jmp     1b
    1.27          
    1.28  __start:
    1.29 -        /* We begin by interrogating the CPU for the presence of long mode. */
    1.30 -        mov     $0x80000000,%eax
    1.31 -        cpuid
    1.32 -        cmp     $0x80000000,%eax    # any function > 0x80000000?
    1.33 -        jbe     bad_cpu
    1.34 -        mov     $0x80000001,%eax
    1.35 -        cpuid
    1.36 -        bt      $29,%edx            # Long mode feature?
    1.37 -        jnc     bad_cpu
    1.38 -        
    1.39          /* Set up a few descriptors: on entry only CS is guaranteed good. */
    1.40          lgdt    %cs:nopaging_gdt_descr-__PAGE_OFFSET
    1.41          mov     $(__HYPERVISOR_DS),%ecx
    1.42 @@ -48,6 +55,16 @@ 1:      lss     stack_start-__PAGE_OFFSE
    1.43  	pushl	$0
    1.44  	popf
    1.45  
    1.46 +        /* We begin by interrogating the CPU for the presence of long mode. */
    1.47 +        mov     $0x80000000,%eax
    1.48 +        cpuid
    1.49 +        cmp     $0x80000000,%eax    # any function > 0x80000000?
    1.50 +        jbe     bad_cpu
    1.51 +        mov     $0x80000001,%eax
    1.52 +        cpuid
    1.53 +        bt      $29,%edx            # Long mode feature?
    1.54 +        jnc     bad_cpu
    1.55 +        
    1.56          /* Set up FPU. */
    1.57          fninit
    1.58          
    1.59 @@ -82,7 +99,7 @@ 1:      mov     %eax,__PAGE_OFFSET>>20(%
    1.60  
    1.61          /* Initialise IDT with simple error defaults. */
    1.62          lea     ignore_int,%edx
    1.63 -        mov     $(__HYPERVISOR_CS << 16),%eax
    1.64 +        mov     $(__HYPERVISOR_CS64 << 16),%eax
    1.65          mov     %dx,%ax            /* selector = 0x0010 = cs */
    1.66          mov     $0x8E00,%dx        /* interrupt gate - dpl=0, present */
    1.67          lea     SYMBOL_NAME(idt_table)-__PAGE_OFFSET,%edi
    1.68 @@ -98,16 +115,19 @@ start_paging:
    1.69          mov     $0x80050033,%eax /* hi-to-lo: PG,AM,WP,NE,ET,MP,PE */
    1.70          mov     %eax,%cr0
    1.71          jmp     1f
    1.72 +1:      /* Now in compatibility mode. Long-jump into 64-bit mode. */
    1.73 +        ljmp    $(__HYPERVISOR_CS64),$1f
    1.74 +
    1.75 +        .code64
    1.76  1:      /* Install relocated selectors (FS/GS unused). */
    1.77          lgdt    gdt_descr
    1.78          mov     $(__HYPERVISOR_DS),%ecx
    1.79          mov     %ecx,%ds
    1.80          mov     %ecx,%es
    1.81          mov     %ecx,%ss
    1.82 -        ljmp    $(__HYPERVISOR_CS),$1f
    1.83  1:      /* Paging enabled, so we can now enable GLOBAL mappings in CR4. */
    1.84 -        mov     mmu_cr4_features,%ecx
    1.85 -        mov     %ecx,%cr4
    1.86 +        mov     mmu_cr4_features,%rcx
    1.87 +        mov     %rcx,%cr4
    1.88          /* Relocate ESP */
    1.89          add     $__PAGE_OFFSET,%esp
    1.90  
    1.91 @@ -123,16 +143,18 @@ 1:      /* Paging enabled, so we can now
    1.92  /* This is the default interrupt handler. */
    1.93  int_msg:
    1.94          .asciz "Unknown interrupt\n"
    1.95 -        ALIGN
    1.96  ignore_int:
    1.97          cld
    1.98          mov     $(__HYPERVISOR_DS),%eax
    1.99          mov     %eax,%ds
   1.100          mov     %eax,%es
   1.101 -        pushl   $int_msg
   1.102 +        pushq   $int_msg
   1.103          call    SYMBOL_NAME(printf)
   1.104  1:      jmp     1b
   1.105  
   1.106 +        .code32
   1.107 +        .align 8
   1.108 +                
   1.109  /*** STACK LOCATION ***/
   1.110          
   1.111  ENTRY(stack_start)
   1.112 @@ -144,8 +166,6 @@ ENTRY(stack_start)
   1.113  .globl SYMBOL_NAME(idt)
   1.114  .globl SYMBOL_NAME(gdt)        
   1.115  
   1.116 -        ALIGN
   1.117 -        
   1.118          .word   0    
   1.119  idt_descr:
   1.120  	.word	256*8-1
     2.1 --- a/xen/arch/x86/setup.c	Fri Jul 02 10:14:27 2004 +0000
     2.2 +++ b/xen/arch/x86/setup.c	Sat Jul 03 14:01:12 2004 +0000
     2.3 @@ -28,7 +28,11 @@ extern int do_timer_lists_from_pit;
     2.4  char ignore_irq13;		/* set if exception 16 works */
     2.5  struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 };
     2.6  
     2.7 +#if defined(__x86_64__)
     2.8 +unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE;
     2.9 +#else
    2.10  unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE;
    2.11 +#endif
    2.12  EXPORT_SYMBOL(mmu_cr4_features);
    2.13  
    2.14  unsigned long wait_init_idle;