TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Gabriel Verdejo Alvarez
from: Mike Bilow
date: 1996-03-29 22:33:50
subject: About the real time clock and PIT

Gabriel Verdejo Alvarez wrote in a message to All:

 GVA> To detect the cache size and computer's speed I program the
 GVA> PIT, I use it as a clock (I use counter 0 of 8253 chip to
 GVA> get a real-time clock). 

 GVA>         Program timer (=0)
 GVA>         time_begin
 GVA>                 do_test
 GVA>         time_end

 GVA> But under OS/2 I get "strange results" I think is because
 GVA> the kernel switch the process in the CPU (execute more than
 GVA> a program), so the results are not the expected.

You get "strange" results because, under OS/2, your program is
not talking directly to any hardware.  Rather, OS/2 is using a protected
mode handler located in a virtual device driver (VDD) to trap your attempts
to access the timer hardware, and the timer is actually emulated or
"virtualized" in software by the VDD.  As you can imagine, this
would more than explain why you are getting results which you think are
"strange."

 GVA> My question is if there is a way or function (better in ASM,
 GVA> so I keep the portability) to get the time that a process is
 GVA> running, so instead get the real time I get the time that
 GVA> uses my process at execution.

In fact, there is no way for an OS/2 application program -- native or DOS
-- to be guaranteed an uninterrupted run without possibility of preemption.
 This can be done from inside an OS/2 device driver, but that is
essentially a ridiculous approach for your purposes.

 GVA> Other question, with the HD I also have troubles with OS/2.
 GVA> To detect SCSI I have no problem but to detect IDE drives, I
 GVA> use the HD's ROM BIOS (making inport() from the IDE port
 GVA> 0x1F) but sometimes the computer hangs :-? OS/2 gets all
 GVA> ports or let the programmer use it like he want? 

OS/2 completely bypasses the ROM BIOS execept in certain very specific
cases.  Generally, the IBM1S506.ADD protected mode driver will own the IDE
controllers and their ports.  Depending upon the particular machine
configuration and the version of IBM1S506.ADD loaded, it can happen that
poking around on the ports will crash the machine.

You are trying to do hardware diagnostic tests that degrade to meaningless
operations under any protected mode operating system.  OS/2 is specifically
designed to intercept the kinds of things your program does, and it is
working as designed.  There is no realistic way to make invasive hardware
diagnostic programs work under OS/2, nor is there any reason to do so.
 
-- Mike


--- 
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 323/107 170/400 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.