Signed-off-by: Kevin O'Connor kevin@koconnor.net --- src/biosvar.h | 6 ------ src/clock.c | 32 +++++++++++++++++--------------- 2 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/src/biosvar.h b/src/biosvar.h index 88b3257..45561d9 100644 --- a/src/biosvar.h +++ b/src/biosvar.h @@ -226,8 +226,6 @@ struct extended_bios_data_area_s { u8 ps2ctr; struct usbkeyinfo usbkey_last;
- int RTCusers; - // El Torito Emulation data struct cdemu_s cdemu;
@@ -238,10 +236,6 @@ struct extended_bios_data_area_s { u8 cdrom_locks[CONFIG_MAX_EXTDRIVE];
u16 boot_sequence; - - /* TSC emulation timekeepers */ - u64 tsc_8254; - int last_tsc_8254; } PACKED;
// The initial size and location of EBDA diff --git a/src/clock.c b/src/clock.c index e8a48a1..c66c3f0 100644 --- a/src/clock.c +++ b/src/clock.c @@ -108,22 +108,24 @@ calibrate_tsc(void) 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; }
@@ -545,12 +547,13 @@ handle_08(void) * 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 @@ -561,9 +564,8 @@ useRTC(void) 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.