mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 23:14:53 +00:00
[FREELDR]: Commit a temporary "hackfix" for (Pc)GetTime: on VBox when booting with PXE, for some mysterious reason, Int386(0x1A) call with AH = 0x02 (Get CMOS Time) *never ever* returns!! (however without PXE everything works). So... is it some kind of stack overflow or whatever that makes the Int386 function stack messy? Or something else? So in the meantime we use direct CMOS port reads. Timo, Hervé (and others), can you please review? And in particular why does it happen only with PXE?
svn path=/trunk/; revision=66022
This commit is contained in:
parent
35b0d2e7ed
commit
6117764150
|
@ -20,10 +20,50 @@
|
|||
|
||||
#define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
|
||||
|
||||
#ifndef INT386_WITH_INT_1A_AH_02_04__IS__FIXED
|
||||
|
||||
/* CMOS Registers and Ports */
|
||||
#define CMOS_CONTROL_PORT (PUCHAR)0x70
|
||||
#define CMOS_DATA_PORT (PUCHAR)0x71
|
||||
|
||||
#define RTC_REGISTER_A 0x0A
|
||||
#define RTC_REG_A_UIP 0x80
|
||||
|
||||
static UCHAR
|
||||
HalpReadCmos(IN UCHAR Reg)
|
||||
{
|
||||
/* Select the register */
|
||||
WRITE_PORT_UCHAR(CMOS_CONTROL_PORT, Reg);
|
||||
|
||||
/* Query the value */
|
||||
return READ_PORT_UCHAR(CMOS_DATA_PORT);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TIMEINFO*
|
||||
PcGetTime(VOID)
|
||||
{
|
||||
static TIMEINFO TimeInfo;
|
||||
|
||||
#ifndef INT386_WITH_INT_1A_AH_02_04__IS__FIXED
|
||||
|
||||
/* Loop while update is in progress */
|
||||
while ((HalpReadCmos(RTC_REGISTER_A)) & RTC_REG_A_UIP);
|
||||
|
||||
/* Set the time data */
|
||||
TimeInfo.Second = BCD_INT(HalpReadCmos(0));
|
||||
TimeInfo.Minute = BCD_INT(HalpReadCmos(2));
|
||||
TimeInfo.Hour = BCD_INT(HalpReadCmos(4));
|
||||
TimeInfo.Day = BCD_INT(HalpReadCmos(7));
|
||||
TimeInfo.Month = BCD_INT(HalpReadCmos(8));
|
||||
TimeInfo.Year = BCD_INT(HalpReadCmos(9));
|
||||
|
||||
/* Compensate for the century field */
|
||||
TimeInfo.Year += (TimeInfo.Year > 80) ? 1900: 2000;
|
||||
|
||||
#else
|
||||
|
||||
REGS Regs;
|
||||
|
||||
for (;;)
|
||||
|
@ -86,6 +126,9 @@ PcGetTime(VOID)
|
|||
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return &TimeInfo;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue