Change a data type internal to the timecounters, and remove the "delta"
function. Reviewed, but not entirely approved by: bde
This commit is contained in:
parent
34fa716eb7
commit
259c840095
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.118 1998/03/30 09:48:47 phk Exp $
|
||||
* $Id: clock.c,v 1.119 1998/04/05 01:04:48 tegge Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -169,15 +169,13 @@ static u_char timer2_state;
|
||||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
static u_int tsc_present;
|
||||
|
||||
static u_int64_t i8254_get_timecount __P((void));
|
||||
static unsigned i8254_get_timecount __P((void));
|
||||
static unsigned tsc_get_timecount __P((void));
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
static u_int64_t tsc_get_timecount __P((void));
|
||||
static u_int32_t tsc_get_timedelta __P((struct timecounter *tc));
|
||||
|
||||
static struct timecounter tsc_timecounter[3] = {
|
||||
tsc_get_timedelta, /* get_timedelta */
|
||||
tsc_get_timecount, /* get_timecount */
|
||||
~0, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"TSC" /* name */
|
||||
};
|
||||
@ -186,9 +184,8 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, tsc_timecounter, CTLFLAG_RD,
|
||||
tsc_timecounter, sizeof(tsc_timecounter), "S,timecounter", "");
|
||||
|
||||
static struct timecounter i8254_timecounter[3] = {
|
||||
0, /* get_timedelta */
|
||||
i8254_get_timecount, /* get_timecount */
|
||||
(1ULL << 32) - 1, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"i8254" /* name */
|
||||
};
|
||||
@ -1132,10 +1129,10 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", "");
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
i8254_get_timecount(void)
|
||||
{
|
||||
u_int32_t count;
|
||||
u_int count;
|
||||
u_long ef;
|
||||
u_int high, low;
|
||||
|
||||
@ -1161,14 +1158,8 @@ i8254_get_timecount(void)
|
||||
return (count);
|
||||
}
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
tsc_get_timecount(void)
|
||||
{
|
||||
return ((u_int64_t)rdtsc());
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
tsc_get_timedelta(struct timecounter *tc)
|
||||
{
|
||||
return ((u_int64_t)rdtsc() - tc->offset_count);
|
||||
return (rdtsc());
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.118 1998/03/30 09:48:47 phk Exp $
|
||||
* $Id: clock.c,v 1.119 1998/04/05 01:04:48 tegge Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -169,15 +169,13 @@ static u_char timer2_state;
|
||||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
static u_int tsc_present;
|
||||
|
||||
static u_int64_t i8254_get_timecount __P((void));
|
||||
static unsigned i8254_get_timecount __P((void));
|
||||
static unsigned tsc_get_timecount __P((void));
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
static u_int64_t tsc_get_timecount __P((void));
|
||||
static u_int32_t tsc_get_timedelta __P((struct timecounter *tc));
|
||||
|
||||
static struct timecounter tsc_timecounter[3] = {
|
||||
tsc_get_timedelta, /* get_timedelta */
|
||||
tsc_get_timecount, /* get_timecount */
|
||||
~0, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"TSC" /* name */
|
||||
};
|
||||
@ -186,9 +184,8 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, tsc_timecounter, CTLFLAG_RD,
|
||||
tsc_timecounter, sizeof(tsc_timecounter), "S,timecounter", "");
|
||||
|
||||
static struct timecounter i8254_timecounter[3] = {
|
||||
0, /* get_timedelta */
|
||||
i8254_get_timecount, /* get_timecount */
|
||||
(1ULL << 32) - 1, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"i8254" /* name */
|
||||
};
|
||||
@ -1132,10 +1129,10 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", "");
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
i8254_get_timecount(void)
|
||||
{
|
||||
u_int32_t count;
|
||||
u_int count;
|
||||
u_long ef;
|
||||
u_int high, low;
|
||||
|
||||
@ -1161,14 +1158,8 @@ i8254_get_timecount(void)
|
||||
return (count);
|
||||
}
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
tsc_get_timecount(void)
|
||||
{
|
||||
return ((u_int64_t)rdtsc());
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
tsc_get_timedelta(struct timecounter *tc)
|
||||
{
|
||||
return ((u_int64_t)rdtsc() - tc->offset_count);
|
||||
return (rdtsc());
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.118 1998/03/30 09:48:47 phk Exp $
|
||||
* $Id: clock.c,v 1.119 1998/04/05 01:04:48 tegge Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -169,15 +169,13 @@ static u_char timer2_state;
|
||||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
static u_int tsc_present;
|
||||
|
||||
static u_int64_t i8254_get_timecount __P((void));
|
||||
static unsigned i8254_get_timecount __P((void));
|
||||
static unsigned tsc_get_timecount __P((void));
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
static u_int64_t tsc_get_timecount __P((void));
|
||||
static u_int32_t tsc_get_timedelta __P((struct timecounter *tc));
|
||||
|
||||
static struct timecounter tsc_timecounter[3] = {
|
||||
tsc_get_timedelta, /* get_timedelta */
|
||||
tsc_get_timecount, /* get_timecount */
|
||||
~0, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"TSC" /* name */
|
||||
};
|
||||
@ -186,9 +184,8 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, tsc_timecounter, CTLFLAG_RD,
|
||||
tsc_timecounter, sizeof(tsc_timecounter), "S,timecounter", "");
|
||||
|
||||
static struct timecounter i8254_timecounter[3] = {
|
||||
0, /* get_timedelta */
|
||||
i8254_get_timecount, /* get_timecount */
|
||||
(1ULL << 32) - 1, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"i8254" /* name */
|
||||
};
|
||||
@ -1132,10 +1129,10 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", "");
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
i8254_get_timecount(void)
|
||||
{
|
||||
u_int32_t count;
|
||||
u_int count;
|
||||
u_long ef;
|
||||
u_int high, low;
|
||||
|
||||
@ -1161,14 +1158,8 @@ i8254_get_timecount(void)
|
||||
return (count);
|
||||
}
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
tsc_get_timecount(void)
|
||||
{
|
||||
return ((u_int64_t)rdtsc());
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
tsc_get_timedelta(struct timecounter *tc)
|
||||
{
|
||||
return ((u_int64_t)rdtsc() - tc->offset_count);
|
||||
return (rdtsc());
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.118 1998/03/30 09:48:47 phk Exp $
|
||||
* $Id: clock.c,v 1.119 1998/04/05 01:04:48 tegge Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -169,15 +169,13 @@ static u_char timer2_state;
|
||||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
static u_int tsc_present;
|
||||
|
||||
static u_int64_t i8254_get_timecount __P((void));
|
||||
static unsigned i8254_get_timecount __P((void));
|
||||
static unsigned tsc_get_timecount __P((void));
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
static u_int64_t tsc_get_timecount __P((void));
|
||||
static u_int32_t tsc_get_timedelta __P((struct timecounter *tc));
|
||||
|
||||
static struct timecounter tsc_timecounter[3] = {
|
||||
tsc_get_timedelta, /* get_timedelta */
|
||||
tsc_get_timecount, /* get_timecount */
|
||||
~0, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"TSC" /* name */
|
||||
};
|
||||
@ -186,9 +184,8 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, tsc_timecounter, CTLFLAG_RD,
|
||||
tsc_timecounter, sizeof(tsc_timecounter), "S,timecounter", "");
|
||||
|
||||
static struct timecounter i8254_timecounter[3] = {
|
||||
0, /* get_timedelta */
|
||||
i8254_get_timecount, /* get_timecount */
|
||||
(1ULL << 32) - 1, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"i8254" /* name */
|
||||
};
|
||||
@ -1132,10 +1129,10 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", "");
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
i8254_get_timecount(void)
|
||||
{
|
||||
u_int32_t count;
|
||||
u_int count;
|
||||
u_long ef;
|
||||
u_int high, low;
|
||||
|
||||
@ -1161,14 +1158,8 @@ i8254_get_timecount(void)
|
||||
return (count);
|
||||
}
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
tsc_get_timecount(void)
|
||||
{
|
||||
return ((u_int64_t)rdtsc());
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
tsc_get_timedelta(struct timecounter *tc)
|
||||
{
|
||||
return ((u_int64_t)rdtsc() - tc->offset_count);
|
||||
return (rdtsc());
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: clock.c,v 1.118 1998/03/30 09:48:47 phk Exp $
|
||||
* $Id: clock.c,v 1.119 1998/04/05 01:04:48 tegge Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -169,15 +169,13 @@ static u_char timer2_state;
|
||||
static void (*timer_func) __P((struct clockframe *frame)) = hardclock;
|
||||
static u_int tsc_present;
|
||||
|
||||
static u_int64_t i8254_get_timecount __P((void));
|
||||
static unsigned i8254_get_timecount __P((void));
|
||||
static unsigned tsc_get_timecount __P((void));
|
||||
static void set_timer_freq(u_int freq, int intr_freq);
|
||||
static u_int64_t tsc_get_timecount __P((void));
|
||||
static u_int32_t tsc_get_timedelta __P((struct timecounter *tc));
|
||||
|
||||
static struct timecounter tsc_timecounter[3] = {
|
||||
tsc_get_timedelta, /* get_timedelta */
|
||||
tsc_get_timecount, /* get_timecount */
|
||||
~0, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"TSC" /* name */
|
||||
};
|
||||
@ -186,9 +184,8 @@ SYSCTL_OPAQUE(_debug, OID_AUTO, tsc_timecounter, CTLFLAG_RD,
|
||||
tsc_timecounter, sizeof(tsc_timecounter), "S,timecounter", "");
|
||||
|
||||
static struct timecounter i8254_timecounter[3] = {
|
||||
0, /* get_timedelta */
|
||||
i8254_get_timecount, /* get_timecount */
|
||||
(1ULL << 32) - 1, /* counter_mask */
|
||||
~0u, /* counter_mask */
|
||||
0, /* frequency */
|
||||
"i8254" /* name */
|
||||
};
|
||||
@ -1132,10 +1129,10 @@ sysctl_machdep_tsc_freq SYSCTL_HANDLER_ARGS
|
||||
SYSCTL_PROC(_machdep, OID_AUTO, tsc_freq, CTLTYPE_INT | CTLFLAG_RW,
|
||||
0, sizeof(u_int), sysctl_machdep_tsc_freq, "I", "");
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
i8254_get_timecount(void)
|
||||
{
|
||||
u_int32_t count;
|
||||
u_int count;
|
||||
u_long ef;
|
||||
u_int high, low;
|
||||
|
||||
@ -1161,14 +1158,8 @@ i8254_get_timecount(void)
|
||||
return (count);
|
||||
}
|
||||
|
||||
static u_int64_t
|
||||
static u_int
|
||||
tsc_get_timecount(void)
|
||||
{
|
||||
return ((u_int64_t)rdtsc());
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
tsc_get_timedelta(struct timecounter *tc)
|
||||
{
|
||||
return ((u_int64_t)rdtsc() - tc->offset_count);
|
||||
return (rdtsc());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user