GCC and asm()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Spike

    #1

    GCC and asm()

    What's wrong with this:

    ULONG CPUID_Result=0;
    asm ("movl $1,%%eax;cpuid; "
    :"=a"(CPUID_Res ult)
    : //Ingen input!
    :"%eax","%ebx", "%ecx","%ed x");

    All I want to do is call CPUID with EAX=1 and have to result stored in
    CPUID_Result!

    Once again TIA!



  • Emmanuel Delahaye

    #2
    Re: GCC and asm()

    Spike wrote on 22/12/04 :[color=blue]
    > What's wrong with this:
    >
    > ULONG CPUID_Result=0;
    > asm ("movl $1,%%eax;cpuid; "
    > :"=a"(CPUID_Res ult)
    > : //Ingen input!
    > :"%eax","%ebx", "%ecx","%ed x");
    >
    > All I want to do is call CPUID with EAX=1 and have to result stored in
    > CPUID_Result![/color]

    You are off-topic on clc.

    Are you aware that asm in gcc is AT&T style (destination and source are
    reversed and other twisted things...)

    Details on a gcc forum where you question belongs to.

    news:gnu.gcc.he lp

    --
    Emmanuel
    The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
    The C-library: http://www.dinkumware.com/refxc.html

    "Clearly your code does not meet the original spec."
    "You are sentenced to 30 lashes with a wet noodle."
    -- Jerry Coffin in a.l.c.c++

    Comment

    • Default User

      #3
      Re: GCC and asm()

      Spike wrote:
      [color=blue]
      > Once again TIA![/color]

      Once again, gnu.gcc.help





      Brian

      Comment

      • Michael Mair

        #4
        Re: GCC and asm()


        Spike wrote:[color=blue]
        > What's wrong with this:
        >
        > ULONG CPUID_Result=0;
        > asm ("movl $1,%%eax;cpuid; "
        > :"=a"(CPUID_Res ult)
        > : //Ingen input!
        > :"%eax","%ebx", "%ecx","%ed x");[/color]

        You did not ask this question in gnu.gcc.* (if in doubt, use
        gnu.gcc.help)

        -Michael
        --
        E-Mail: Mine is a gmx dot de address.

        Comment

        Working...