Clock, Timer & Locking updates

git-svn-id: file:///home/jj/hercules.svn/trunk@3560 956126f8-22a0-4046-8f4a-272fa8102e63
This commit is contained in:
Jan Jaeger
2006-01-02 21:36:39 +00:00
parent c53f5f4c26
commit e9cac75e22
8 changed files with 65 additions and 45 deletions

11
clock.h
View File

@@ -31,6 +31,7 @@ void set_tod_epoch(S64); /* Set TOD epoch */
void ajust_tod_epoch(S64); /* Adjust TOD epoch */
S64 get_tod_epoch(void); /* Get TOD epoch */
U64 hw_clock(void); /* Get hardware clock */
U64 tod_clock(REGS *); /* Get TOD clock */
void set_cpu_timer(REGS *, S64); /* Set CPU timer */
S64 get_cpu_timer(REGS *); /* Retrieve CPU timer */
@@ -48,7 +49,7 @@ void ARCH_DEP(query_tod_offset) (REGS *);
void ARCH_DEP(query_available_functions) (REGS *);
_CLOCK_EXTERN U64 tod_clock; /* Bits 0-7 TOD clock epoch */
_CLOCK_EXTERN U64 tod_value; /* Bits 0-7 TOD clock epoch */
/* Bits b-63 TOD bits 0-55 */
_CLOCK_EXTERN S64 tod_epoch; /* Bits 0-7 TOD clock epoch */
@@ -60,10 +61,16 @@ _CLOCK_EXTERN U64 hw_tod; /* Hardware clock */
#define SECONDS_IN_SEVENTY_YEARS ((70*365 + 17) * 86400ULL)
#define TOD_CLOCK(_regs) \
(tod_clock + (_regs)->tod_epoch)
(tod_value + (_regs)->tod_epoch)
#define CPU_TIMER(_regs) \
((S64)((_regs)->cpu_timer - hw_tod))
#define ITIMER_TO_TOD(_units) \
(625*(_units)/3)
#define TOD_TO_ITIMER(_units) \
(3*(_units)/625)
#define ITIMER_ACCESS(_addr) \
(unlikely(unlikely(_addr) < 84) && ((_addr) >= 80))