mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 00:45:43 +00:00
[freeldr] Don't write twice the delay method and how to read the RTC. Use those in the HAL
svn path=/trunk/; revision=45817
This commit is contained in:
parent
e1e7f82deb
commit
8cbf93f23d
3 changed files with 15 additions and 52 deletions
|
@ -19,63 +19,25 @@
|
||||||
|
|
||||||
#include <freeldr.h>
|
#include <freeldr.h>
|
||||||
|
|
||||||
#define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
HalQueryRealTimeClock(OUT PTIME_FIELDS Time);
|
||||||
|
|
||||||
TIMEINFO*
|
TIMEINFO*
|
||||||
PcGetTime(VOID)
|
PcGetTime(VOID)
|
||||||
{
|
{
|
||||||
static TIMEINFO TimeInfo;
|
static TIMEINFO TimeInfo;
|
||||||
REGS Regs;
|
TIME_FIELDS Time;
|
||||||
|
|
||||||
/* Some BIOSes, such as the 1998/07/25 system ROM
|
if (!HalQueryRealTimeClock(&Time))
|
||||||
* in the Compaq Deskpro EP/SB, leave CF unchanged
|
return NULL;
|
||||||
* if successful, so CF should be cleared before
|
|
||||||
* calling this function. */
|
|
||||||
__writeeflags(__readeflags() & ~EFLAGS_CF);
|
|
||||||
|
|
||||||
/* Int 1Ah AH=04h
|
TimeInfo.Year = Time.Year;
|
||||||
* TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
|
TimeInfo.Month = Time.Month;
|
||||||
*
|
TimeInfo.Day = Time.Day;
|
||||||
* AH = 04h
|
TimeInfo.Hour = Time.Hour;
|
||||||
* CF clear to avoid bug
|
TimeInfo.Minute = Time.Minute;
|
||||||
* Return:
|
TimeInfo.Second = Time.Second;
|
||||||
* CF clear if successful
|
|
||||||
* CH = century (BCD)
|
|
||||||
* CL = year (BCD)
|
|
||||||
* DH = month (BCD)
|
|
||||||
* DL = day (BCD)
|
|
||||||
* CF set on error
|
|
||||||
*/
|
|
||||||
Regs.b.ah = 0x04;
|
|
||||||
Int386(0x1A, &Regs, &Regs);
|
|
||||||
|
|
||||||
TimeInfo.Year = 100 * BCD_INT(Regs.b.ch) + BCD_INT(Regs.b.cl);
|
|
||||||
TimeInfo.Month = BCD_INT(Regs.b.dh);
|
|
||||||
TimeInfo.Day = BCD_INT(Regs.b.dl);
|
|
||||||
|
|
||||||
/* Some BIOSes leave CF unchanged if successful,
|
|
||||||
* so CF should be cleared before calling this function. */
|
|
||||||
__writeeflags(__readeflags() & ~EFLAGS_CF);
|
|
||||||
|
|
||||||
/* Int 1Ah AH=02h
|
|
||||||
* TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
|
|
||||||
*
|
|
||||||
* AH = 02h
|
|
||||||
* CF clear to avoid bug
|
|
||||||
* Return:
|
|
||||||
* CF clear if successful
|
|
||||||
* CH = hour (BCD)
|
|
||||||
* CL = minutes (BCD)
|
|
||||||
* DH = seconds (BCD)
|
|
||||||
* DL = daylight savings flag (00h standard time, 01h daylight time)
|
|
||||||
* CF set on error (i.e. clock not running or in middle of update)
|
|
||||||
*/
|
|
||||||
Regs.b.ah = 0x02;
|
|
||||||
Int386(0x1A, &Regs, &Regs);
|
|
||||||
|
|
||||||
TimeInfo.Hour = BCD_INT(Regs.b.ch);
|
|
||||||
TimeInfo.Minute = BCD_INT(Regs.b.cl);
|
|
||||||
TimeInfo.Second = BCD_INT(Regs.b.dh);
|
|
||||||
|
|
||||||
return &TimeInfo;
|
return &TimeInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <ndk/asm.h>
|
#include <ndk/asm.h>
|
||||||
#include <ndk/rtlfuncs.h>
|
#include <ndk/rtlfuncs.h>
|
||||||
#include <ndk/ldrtypes.h>
|
#include <ndk/ldrtypes.h>
|
||||||
|
#include <ndk/halfuncs.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
|
@ -235,7 +235,6 @@ HalpTrap06()
|
||||||
longjmp(HalpSavedContext, 1);
|
longjmp(HalpSavedContext, 1);
|
||||||
UNREACHABLE;
|
UNREACHABLE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* V8086 ENTER ****************************************************************/
|
/* V8086 ENTER ****************************************************************/
|
||||||
|
|
||||||
|
@ -278,6 +277,7 @@ HalpBiosCall()
|
||||||
/* Exit to V86 mode */
|
/* Exit to V86 mode */
|
||||||
HalpExitToV86((PKTRAP_FRAME)&V86TrapFrame);
|
HalpExitToV86((PKTRAP_FRAME)&V86TrapFrame);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
|
@ -432,6 +432,7 @@ HalpRestoreIopm(VOID)
|
||||||
while (i--) HalpSavedIoMap[HalpSavedIoMapData[i][0]] = HalpSavedIoMapData[i][1];
|
while (i--) HalpSavedIoMap[HalpSavedIoMapData[i][0]] = HalpSavedIoMapData[i][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _MINIHAL_
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpMapRealModeMemory(VOID)
|
HalpMapRealModeMemory(VOID)
|
||||||
|
@ -499,7 +500,6 @@ HalpMapRealModeMemory(VOID)
|
||||||
HalpFlushTLB();
|
HalpFlushTLB();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _MINIHAL_
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
HalpSwitchToRealModeTrapHandlers(VOID)
|
HalpSwitchToRealModeTrapHandlers(VOID)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue