lkml.org 
[lkml]   [2005]   [Nov]   [18]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
    /
    FromBlaisorblade <>
    SubjectRe: [uml-devel] Re: [PATCH 3/4] UML - Properly invoke x86_64 system calls
    DateFri, 18 Nov 2005 07:41:37 +0100
    On Thursday 17 November 2005 21:37, linux-os (Dick Johnson) wrote:
    > On Thu, 17 Nov 2005, Jeff Dike wrote:
    > > This patch makes stub_segv use the stub_syscall macros.  This was
    > > needed anyway, but the bug that prompted this was the discovery that
    > > gcc was storing stuff in RCX, which is trashed across a system
    > > call.
    
    > But the C-calling convention used by gcc for 32-bit systems
    > is supposed to allow the called-function to destroy general-
    > purpose registers but not index registers. In other words,
    > ECX, EDX are supposed to be available and EAX is used for
    > return-values. The register size isn't supposed to have
    > anything to do with it (longword/quadword)!
    
    > In 64-bit world, the same is supposed to apply as well.
    > If RCX is now precious, it's a GCC bug that should be fixed.
    
    It's not _normally_ precious, for function calling conventions, but syscalls 
    are different.
    
    Read include/asm-x86_64/unistd.h and see that the _syscallX macros contain 
    various register clobber. I.e. they explicitly tell GCC "don't use that". We 
    (UML code) were missing that. Simple.
    -- 
    Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
    Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
    http://www.user-mode-linux.org/~blaisorblade
    
    
    ___________________________________ 
    Yahoo! Messenger: chiamate gratuite in tutto il mondo 
    http://it.messenger.yahoo.com
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    
    
    \
     
     \ /
      Last update: 2005-11-18 07:36    [from the cache]
    ©2003-2008