Message-Id: <199808280928.LAA35736@ieva06.lanet.lv> From: "Andris Pavenis" To: "Alexander S. Aganichev" , djgpp AT delorie DOT com Date: Fri, 28 Aug 1998 11:32:21 +0300 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: uclock () References: <199808271938 DOT VAA21204 AT ieva06 DOT lanet DOT lv> In-reply-to: Precedence: bulk Date sent: Fri, 28 Aug 1998 12:12:10 +0400 (MSD) From: "Alexander S. Aganichev" Subject: Re: uclock () > Hello, Andris! > > On Thu, 27 Aug 1998, Andris Pavenis wrote: > >> During debugging my program i found that in rare conditions return value > >> of second call to uclock is lesser than first. I made patch, that works on > >> all my boards, but I'm still unsure if *ALL* PC with i386 or higher > >> contains RTC8254. Could anyone comment my patch, so i could rebuild all my > >> applications with patched library? > >At first it is NECESSARY to disable interrupts when reading PIC counter. > Oh, you're right, thanks! Probably this bug happens in original code in > case concurency read of RTC by library and int08. I'll try to rebuild > uclock() with disable() and enable(). You must save flags, disable interrupts and restore flags when all is done (not call enable()) as uclock may be called with interrupts disabled) Assembler code looks like: pushf cli .... some code goes here popf > > >Perhaps I should sometimes port to DJGPP my time reading code I wrote > >some years ago for Borland C (used inline assembler). > Would you be so kind to send me this code? > Perhaps I'll do this and send the DJGPP source Andris