I heard there's "always-right" bios-clock? Or something like that. If that's true, anyone knows the address of that data? and how to access it.
Posted on 2002-01-26 18:43:59 by gregd
Hi,

possible, but protect mode does not support direct use in/out/insw/outsb or dos like int mnomics. possible ring0 but i dont try.

this text copy from old pchelp hardware topic:


HelpPC 2.10- Quick Reference Utility Copyright 1991 David Jurgens

CMOS RTC - Real Time Clock and Memory (ports 70h & 71h)

Reg# Description

00 RTC seconds
01 RTC seconds alarm
02 RTC minutes
03 RTC minutes alarm
04 RTC hours
05 RTC hours alarm
06 RTC day of week
07 RTC day of month
08 RTC month
09 RTC year
0A RTC Status register A:

?7?6?5?4?3?2?1?0? RTC Status Register A
? ? ? ? +---------- rate selection Bits for divider output
? ? ? ? frequency (set to 0110 = 1.024kHz, 976.562?s)
? +-------------- 22 stage divider, time base being used;
? (initialized to 010 = 32.768kHz)
+-------------- 1=time update in progress, 0=time/date available
0B RTC Status register B:

?7?6?5?4?3?2?1?0? RTC Status Register B
? ? ? ? ? ? ? +---- 1=enable daylight savings, 0=disable (default)
? ? ? ? ? ? +----- 1=24 hour mode, 0=12 hour mode (24 default)
? ? ? ? ? +------ 1=time/date in binary, 0=BCD (BCD default)
? ? ? ? +------- 1=enable square wave frequency, 0=disable
? ? ? +-------- 1=enable update ended interrupt, 0=disable
? ? +--------- 1=enable alarm interrupt, 0=disable
? +---------- 1=enable periodic interrupt, 0=disable
+----------- 1=disable clock update, 0=update count normally

0C RTC Status register C (read only):

?7?6?5?4?3?2?1?0? RTC Status Register C (read only)
? ? ? ? +---------- reserved (set to 0)
? ? ? +---------- update ended interrupt enabled
? ? +---------- alarm interrupt enabled
? +---------- periodic interrupt enabled
+---------- IRQF flag


0D RTC Status register D (read only):

?7?6-0? RTC Status Register D (read only)
? +----- reserved (set to 0)
+------ 1=CMOS RAM has power, 0=CMOS RAM has lost power

0E Diagnostic status byte:

?7?6?5?4?3?2?1?0? Diagnostic Status Byte
? ? ? ? ? ? +------ reserved
? ? ? ? ? +------- 1=time is invalid, 0=ok (POST validity check)
? ? ? ? +-------- 1=fixed disk 0 failed initialization, 0=ok
? ? ? +--------- 1=memory size doesn't match config info, 0=ok
? ? +---------- 1=invalid config info found, 0=ok (see below)
? +----------- 1=config record checksum is bad, 0=ok
+------------ 1=RTC lost power, 0=power state stable
Posted on 2002-01-26 18:57:57 by CYDONIA
hello hello :)
actually you can access any ports you like from any ring you like,
it only depends on the iopl bitmap which is part of the task segment thing.
If the bits of the corresponding port is set to protect then you cant use it but...
provided that the ports are not protected from user code you can read write to them as you wish.
in win 9x some ports are write protected and in NT the same and then some :)
So your choice is either write a little driver to do it for you, or possibly use some by windows provided API function to do it for you...
you could of course create a ring 1 segment call this through a call gate then modify the iopl bitmap then retf back to ring 3 read bios thingy then callgate again to ring 1 or 0 and set back protect bits in iopl bitmap and go on as if it all never happened :)
I would have done (and have done) the ring 1 thing but good coding practice would be winapi or driver
Posted on 2002-01-26 19:14:32 by Noodle
Thanks Noodle ,

I read intel's x86 refs and for example 'in' mnomisc :

;-----------------------------------------------------------------------------------
Protected Mode Exceptions

#GP(0) If the CPL is greater than (has less privilege) the I/O privilege level (IOPL) and any of the corresponding I/O permission bits in TSS for the I/O port being accessed is 1.

Real-Address Mode Exceptions

None.

Virtual-8086 Mode Exceptions

#GP(0) If any of the I/O permission bits in the TSS for the I/O port being accessed is 1.

;-----------------------------------------------------------------------------------

right!
Posted on 2002-01-26 19:33:42 by CYDONIA