Changeset 1d6c497 in mainline


Ignore:
Timestamp:
2010-06-12T09:37:54Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
510bc07
Parents:
fd3a631f
Message:

amd64: fix wrong usage of rdtsc

Location:
kernel/arch/amd64
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/cycle.h

    rfd3a631f r1d6c497  
    3636#define KERN_amd64_CYCLE_H_
    3737
    38 extern uint64_t get_cycle(void);
     38static inline uint64_t get_cycle(void)
     39{
     40        uint32_t lower;
     41        uint32_t upper;
     42       
     43        asm volatile (
     44                "rdtsc\n"
     45                : "=a" (lower),
     46                  "=d" (upper)
     47        );
     48       
     49        return ((uint64_t) lower) | (((uint64_t) upper) << 32);
     50}
    3951
    4052#endif
  • kernel/arch/amd64/src/asm_utils.S

    rfd3a631f r1d6c497  
    5858.global cpuid
    5959.global has_cpuid
    60 .global get_cycle
    6160.global read_efer_flag
    6261.global set_efer_flag
     
    152151        ret
    153152
    154 get_cycle:
    155         xorq %rax,%rax
    156         rdtsc
    157         ret
    158 
    159153set_efer_flag:
    160154        movq $0xc0000080, %rcx
Note: See TracChangeset for help on using the changeset viewer.