Revision 338b922e
b/hw/omap_clk.c  

20  20 
*/ 
21  21 
#include "hw.h" 
22  22 
#include "omap.h" 
23 
#include "qemutimer.h" /* for muldiv64() */ 

24  23  
25  24 
struct clk { 
26  25 
const char *name; 
b/qemucommon.h  

309  309 
return ((val >> 4) * 10) + (val & 0x0f); 
310  310 
} 
311  311  
312 
/* compute with 96 bit intermediate result: (a*b)/c */ 

313 
static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) 

314 
{ 

315 
union { 

316 
uint64_t ll; 

317 
struct { 

318 
#ifdef HOST_WORDS_BIGENDIAN 

319 
uint32_t high, low; 

320 
#else 

321 
uint32_t low, high; 

322 
#endif 

323 
} l; 

324 
} u, res; 

325 
uint64_t rl, rh; 

326  
327 
u.ll = a; 

328 
rl = (uint64_t)u.l.low * (uint64_t)b; 

329 
rh = (uint64_t)u.l.high * (uint64_t)b; 

330 
rh += (rl >> 32); 

331 
res.l.high = rh / c; 

332 
res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c; 

333 
return res.ll; 

334 
} 

335  
312  336 
#include "module.h" 
313  337  
314  338 
#endif 
b/qemutimer.h  

59  59 
return 1000000000LL; 
60  60 
} 
61  61  
62 
/* compute with 96 bit intermediate result: (a*b)/c */ 

63 
static inline uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) 

64 
{ 

65 
union { 

66 
uint64_t ll; 

67 
struct { 

68 
#ifdef HOST_WORDS_BIGENDIAN 

69 
uint32_t high, low; 

70 
#else 

71 
uint32_t low, high; 

72 
#endif 

73 
} l; 

74 
} u, res; 

75 
uint64_t rl, rh; 

76  
77 
u.ll = a; 

78 
rl = (uint64_t)u.l.low * (uint64_t)b; 

79 
rh = (uint64_t)u.l.high * (uint64_t)b; 

80 
rh += (rl >> 32); 

81 
res.l.high = rh / c; 

82 
res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c; 

83 
return res.ll; 

84 
} 

85  
86  62 
/* real time host monotonic timer */ 
87  63 
static inline int64_t get_clock_realtime(void) 
88  64 
{ 
Also available in: Unified diff