dprintf(1, "CPU Mhz=%u\n", hz / 1000000);
}
+/* TSC emulation timekeepers */
+u64 TSC_8254 VARLOW;
+int Last_TSC_8254 VARLOW;
+
static u64
emulate_tsc(void)
{
- int cnt, d;
- u16 ebda_seg = get_ebda_seg();
- u64 ret;
/* read timer 0 current count */
- ret = GET_EBDA2(ebda_seg, tsc_8254);
- /* readback mode has slightly shifted registers, works on all 8254, readback PIT0 latch */
+ u64 ret = GET_LOW(TSC_8254);
+ /* readback mode has slightly shifted registers, works on all
+ * 8254, readback PIT0 latch */
outb(PM_SEL_READBACK | PM_READ_VALUE | PM_READ_COUNTER0, PORT_PIT_MODE);
- cnt = (inb(PORT_PIT_COUNTER0) | (inb(PORT_PIT_COUNTER0) << 8));
- d = GET_EBDA2(ebda_seg, last_tsc_8254) - cnt;
+ int cnt = (inb(PORT_PIT_COUNTER0) | (inb(PORT_PIT_COUNTER0) << 8));
+ int d = GET_LOW(Last_TSC_8254) - cnt;
/* Determine the ticks count from last invocation of this function */
ret += (d > 0) ? d : (PIT_TICK_INTERVAL + d);
- SET_EBDA2(ebda_seg, last_tsc_8254, cnt);
- SET_EBDA2(ebda_seg, tsc_8254, ret);
+ SET_LOW(Last_TSC_8254, cnt);
+ SET_LOW(TSC_8254, ret);
return ret;
}
* Periodic timer
****************************************************************/
+int RTCusers VARLOW;
+
void
useRTC(void)
{
- u16 ebda_seg = get_ebda_seg();
- int count = GET_EBDA2(ebda_seg, RTCusers);
- SET_EBDA2(ebda_seg, RTCusers, count+1);
+ int count = GET_LOW(RTCusers);
+ SET_LOW(RTCusers, count+1);
if (count)
return;
// Turn on the Periodic Interrupt timer
void
releaseRTC(void)
{
- u16 ebda_seg = get_ebda_seg();
- int count = GET_EBDA2(ebda_seg, RTCusers);
- SET_EBDA2(ebda_seg, RTCusers, count-1);
+ int count = GET_LOW(RTCusers);
+ SET_LOW(RTCusers, count-1);
if (count != 1)
return;
// Clear the Periodic Interrupt.