ia64/xen-unstable

changeset 3697:0156bb4ae3d7

bitkeeper revision 1.1159.212.112 (4207b382VvZgSA3Pg79SQESssYJbHQ)

More x86_64 fixes.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Mon Feb 07 18:29:22 2005 +0000 (2005-02-07)
parents aa3214cefa34
children 2ff0a18e605f
files xen/arch/x86/domain.c xen/arch/x86/x86_64/entry.S xen/include/public/xen.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Mon Feb 07 17:20:50 2005 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Mon Feb 07 18:29:22 2005 +0000
     1.3 @@ -633,7 +633,6 @@ unsigned long hypercall_create_continuat
     1.4  {
     1.5      struct mc_state *mcs = &mc_state[smp_processor_id()];
     1.6      execution_context_t *ec;
     1.7 -    unsigned long *preg;
     1.8      unsigned int i;
     1.9      va_list args;
    1.10  
    1.11 @@ -653,10 +652,34 @@ unsigned long hypercall_create_continuat
    1.12          ec->eax  = op;
    1.13          ec->eip -= 2;  /* re-execute 'int 0x82' */
    1.14          
    1.15 -        for ( i = 0, preg = &ec->ebx; i < nr_args; i++, preg++ )
    1.16 -            *preg = va_arg(args, unsigned long);
    1.17 -#else
    1.18 -        preg = NULL; /* XXX x86/64 */
    1.19 +        for ( i = 0; i < nr_args; i++ )
    1.20 +        {
    1.21 +            switch ( i )
    1.22 +            {
    1.23 +            case 0: ec->ebx = va_arg(args, unsigned long); break;
    1.24 +            case 1: ec->ecx = va_arg(args, unsigned long); break;
    1.25 +            case 2: ec->edx = va_arg(args, unsigned long); break;
    1.26 +            case 3: ec->esi = va_arg(args, unsigned long); break;
    1.27 +            case 4: ec->edi = va_arg(args, unsigned long); break;
    1.28 +            case 5: ec->ebp = va_arg(args, unsigned long); break;
    1.29 +            }
    1.30 +        }
    1.31 +#elif defined(__x86_64__)
    1.32 +        ec->rax  = op;
    1.33 +        ec->rip -= 2;  /* re-execute 'syscall' */
    1.34 +        
    1.35 +        for ( i = 0; i < nr_args; i++ )
    1.36 +        {
    1.37 +            switch ( i )
    1.38 +            {
    1.39 +            case 0: ec->rdi = va_arg(args, unsigned long); break;
    1.40 +            case 1: ec->rsi = va_arg(args, unsigned long); break;
    1.41 +            case 2: ec->rdx = va_arg(args, unsigned long); break;
    1.42 +            case 3: ec->r10 = va_arg(args, unsigned long); break;
    1.43 +            case 4: ec->r8  = va_arg(args, unsigned long); break;
    1.44 +            case 5: ec->r9  = va_arg(args, unsigned long); break;
    1.45 +            }
    1.46 +        }
    1.47  #endif
    1.48      }
    1.49  
     2.1 --- a/xen/arch/x86/x86_64/entry.S	Mon Feb 07 17:20:50 2005 +0000
     2.2 +++ b/xen/arch/x86/x86_64/entry.S	Mon Feb 07 18:29:22 2005 +0000
     2.3 @@ -11,6 +11,13 @@
     2.4  #include <asm/apicdef.h>
     2.5  #include <public/xen.h>
     2.6  
     2.7 +
     2.8 +/*
     2.9 + * %rax                            = hypercall vector
    2.10 + * %rdi, %rsi, %rdx, %r10, %r8, %9 = hypercall arguments
    2.11 + * %r11, %rcx                      = SYSCALL-saved %rflags and %rip
    2.12 + * NB. We must move %r10 to %rcx for C function-calling ABI.
    2.13 + */
    2.14  ENTRY(hypercall)
    2.15          sti
    2.16          movl  $__GUEST_SS,8(%rsp)
    2.17 @@ -19,6 +26,7 @@ ENTRY(hypercall)
    2.18          pushq %rcx
    2.19          pushq $0
    2.20          SAVE_ALL
    2.21 +        movq  %r10,%rcx
    2.22          andq  $(NR_hypercalls-1),%rax
    2.23          leaq  SYMBOL_NAME(hypercall_table)(%rip),%rcx
    2.24          callq *(%rcx,%rax,8)
    2.25 @@ -39,6 +47,7 @@ restore_all_xen:
    2.26  
    2.27  error_code:
    2.28          SAVE_ALL
    2.29 +        sti
    2.30          movq  %rsp,%rdi
    2.31          movl  XREGS_entry_vector(%rsp),%eax
    2.32          leaq  SYMBOL_NAME(exception_table)(%rip),%rdx
     3.1 --- a/xen/include/public/xen.h	Mon Feb 07 17:20:50 2005 +0000
     3.2 +++ b/xen/include/public/xen.h	Mon Feb 07 18:29:22 2005 +0000
     3.3 @@ -23,7 +23,14 @@
     3.4   * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
     3.5   */
     3.6  
     3.7 -/* EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5. */
     3.8 +/*
     3.9 + * x86_32: EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5.
    3.10 + *         EAX = return value
    3.11 + *         (argument registers may be clobbered on return)
    3.12 + * x86_64: RAX = vector; RDI, RSI, RDX, R10, R8, R9 = args 1, 2, 3, 4, 5, 6. 
    3.13 + *         RAX = return value
    3.14 + *         (argument registers not clobbered on return; RCX, R11 are)
    3.15 + */
    3.16  #define __HYPERVISOR_set_trap_table        0
    3.17  #define __HYPERVISOR_mmu_update            1
    3.18  #define __HYPERVISOR_set_gdt               2