> > On Thu, Nov 01, 2001 at 02:54:37PM -0700, John Regehr wrote:
> > > > Don't forget to make sure it's __volatile__, elsewise this is the very
> > > > epitome of what would produce dodgy results...
> > > 
> > > Right.  So method2 and method2A seem to be broken in multiple ways -
> > > forget you ever saw them.  Rather, look at this page:
> 
> in what way is method2 brocken ??
> 
> if you compile method1 and method2A and look at the assembler coee they are
> absolutly the same - the only difference on the source level is that its easier
> to read "mov" than "0x31" thats all.
> 
> ---method1---
> __inline__ unsigned long long int rdtsc(void)
> {
>       unsigned long long int x;
>       __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
>       return x;
> }
> 
> 
> ---method2A---
> __inline__ unsigned long long int hwtime(void)
> {
>       unsigned long long int x;
>       __asm__("rdtsc\n\t"
>               "mov %%edx, %%ecx\n\t"
>               :"=A" (x));
>       return x;
> }
>

forgot to put in objdump output in the last post


08048430 <rdtsc>:
 8048430:       55                      push   %ebp
 8048431:       89 e5                   mov    %esp,%ebp
 8048433:       83 ec 14                sub    $0x14,%esp
 8048436:       53                      push   %ebx
 8048437:       0f 31                   rdtsc  
 8048439:       89 c1                   mov    %eax,%ecx
 804843b:       89 d3                   mov    %edx,%ebx
 804843d:       89 4d f8                mov    %ecx,0xfffffff8(%ebp)
 8048440:       89 5d fc                mov    %ebx,0xfffffffc(%ebp)
 8048443:       8b 4d f8                mov    0xfffffff8(%ebp),%ecx
 8048446:       8b 5d fc                mov    0xfffffffc(%ebp),%ebx
 8048449:       89 c8                   mov    %ecx,%eax
 804844b:       89 da                   mov    %ebx,%edx
 804844d:       eb 01                   jmp    8048450 <rdtsc+0x20>
 804844f:       90                      nop    
 8048450:       8b 5d e8                mov    0xffffffe8(%ebp),%ebx
 8048453:       89 ec                   mov    %ebp,%esp
 8048455:       5d                      pop    %ebp
 8048456:       c3                      ret    
 8048457:       89 f6                   mov    %esi,%esi
 8048459:       8d bc 27 00 00 00 00    lea    0x0(%edi,1),%edi

08048460 <hwtime>:
 8048460:       55                      push   %ebp
 8048461:       89 e5                   mov    %esp,%ebp
 8048463:       83 ec 14                sub    $0x14,%esp
 8048466:       53                      push   %ebx
 8048467:       0f 31                   rdtsc  
 8048469:       89 d1                   mov    %edx,%ecx
 804846b:       89 c1                   mov    %eax,%ecx
 804846d:       89 d3                   mov    %edx,%ebx
 804846f:       89 4d f8                mov    %ecx,0xfffffff8(%ebp)
 8048472:       89 5d fc                mov    %ebx,0xfffffffc(%ebp)
 8048475:       8b 4d f8                mov    0xfffffff8(%ebp),%ecx
 8048478:       8b 5d fc                mov    0xfffffffc(%ebp),%ebx
 804847b:       89 c8                   mov    %ecx,%eax
 804847d:       89 da                   mov    %ebx,%edx
 804847f:       eb 00                   jmp    8048481 <hwtime+0x21>
 8048481:       8b 5d e8                mov    0xffffffe8(%ebp),%ebx
 8048484:       89 ec                   mov    %ebp,%esp
 8048486:       5d                      pop    %ebp
 8048487:       c3                      ret    
 8048488:       90                      nop    
 8048489:       8d b4 26 00 00 00 00    lea    0x0(%esi,1),%esi

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to