John Levon
2009-Feb-24  07:24 UTC
[Xen-devel] syscall32 being vectored through syscall handler
I presume this is known-working on Linux?
I''ve verified that we''re setting up two different callback
addresses,
but a 32u/64k/64h syscall is ending up in the 64u handler. From what I
can see, this code:
        /* TB_eip = (32-bit syscall && syscall32_addr) ?
         *          syscall32_addr : syscall_addr */
        xor   %eax,%eax
        cmpw  $FLAT_USER_CS32,UREGS_cs(%rsp)
        /*cmpw $0x43,UREGS_cs(%rsp)*/
        cmoveq VCPU_syscall32_addr(%rbx),%rax
        testq %rax,%rax
        cmovzq VCPU_syscall_addr(%rbx),%rax
is supposed to be noticing the %cs written to the stack via here:
410     /* Trampoline for SYSCALL entry from compatibility mode. */
411     stack = (char *)L1_CACHE_ALIGN((unsigned long)stack);
412     wrmsrl(MSR_CSTAR, (unsigned long)stack);
413     stack += write_stack_trampoline(stack, stack_bottom, FLAT_USER_CS32);
and loading my syscall32 handler''s %rip. Any suggestions on what might
be going
wrong? Here''s the state of the world when dropped into the syscall
handler:
kmdb: stop at sys_syscall
kmdb: target stopped at:
sys_syscall:    popq   %rcx
[9]> ::regs
%rax = 0x0000000000000014                 %r9  = 0x000000000000281f 
%rbx = 0x00000000feffb7b4                 %r10 = 0x0000000000000001 
%rcx = 0xfffffffffb8012f8     sys_syscall %r11 = 0x0000000000000206 
%rdx = 0x0000000000000000                 %r12 = 0x0000000000000001 
%rsi = 0x0000000008047d88                 %r13 = 0x0000000000000000 
%rdi = 0x0000000008047e1c                 %r14 = 0xffffff091c1070f0 
%r8  = 0xffffff091c1070f0                 %r15 = 0x00000000ffff4ff0 
%rip = 0xfffffffffb8012f8 sys_syscall
%rbp = 0x0000000008047d88
%rsp = 0xffffff003c09cfb8
%rflags = 0x00000006
  id=0 vip=0 vif=0 ac=0 vm=0 rf=0 nt=0 iopl=0x0
  status=<of,df,if,tf,sf,zf,af,PF,cf>
                        %cs = 0xe030    %ds = 0x004b    %es = 0x004b
%trapno = 0x3           %fs = 0x0000    %gs = 0x01c3
   %err = 0x0
[9]> 0xffffff003c09cfb8,0x100::dump -g 8 -e
ffffff003c09cfb8:  0000000008050c81 0000000000000306
ffffff003c09cfc8:  0000000008050c81 000000000000e023
ffffff003c09cfd8:  0000000000000306 0000000008047d84
ffffff003c09cfe8:  000000000000e02b 0000000000000000
ffffff003c09cff8:  0000000000000000                 
thanks
john
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
John Levon
2009-Feb-24  17:09 UTC
Re: [Xen-devel] syscall32 being vectored through syscall handler
On Tue, Feb 24, 2009 at 02:24:16AM -0500, John Levon wrote:> I''ve verified that we''re setting up two different callback addresses, > but a 32u/64k/64h syscall is ending up in the 64u handler. From what I > can see, this code:I''d missed the SMP case, completely forgot that the handlers get initialized via vcpu_guest_context_t when bringing up a CPU... regards john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel