diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-05-05 19:23:11 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-05-05 19:23:11 +0000 |
commit | c4b89d18ba3b494545266970fe8714bc3d7f5917 (patch) | |
tree | 85543844ae6a8c7f7e7b3dd73d804a9c8161c835 /cpu-all.h | |
parent | 26ea091859c76d5e1b8a95148aa60b59dc8ee196 (diff) |
Some bits of Linux/MIPS host support, still segfaulty.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2771 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cpu-all.h')
-rw-r--r-- | cpu-all.h | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -20,7 +20,7 @@ #ifndef CPU_ALL_H #define CPU_ALL_H -#if defined(__arm__) || defined(__sparc__) +#if defined(__arm__) || defined(__sparc__) || defined(__mips__) #define WORDS_ALIGNED #endif @@ -1022,6 +1022,27 @@ static inline int64_t cpu_get_real_ticks (void) return rval.i64; #endif } + +#elif defined(__mips__) + +static inline int64_t cpu_get_real_ticks(void) +{ +#if __mips_isa_rev >= 2 + uint32_t count; + static uint32_t cyc_per_count = 0; + + if (!cyc_per_count) + __asm__ __volatile__("rdhwr %0, $3" : "=r" (cyc_per_count)); + + __asm__ __volatile__("rdhwr %1, $2" : "=r" (count)); + return (int64_t)(count * cyc_per_count); +#else + /* FIXME */ + static int64_t ticks = 0; + return ticks++; +#endif +} + #else /* The host CPU doesn't have an easily accessible cycle counter. Just return a monotonically increasing vlue. This will be totally wrong, |