Urg,ent, keyboard buffer overflow 
Author Message
 Urg,ent, keyboard buffer overflow

Hi, folks:

I wrote a DOS program in Borland C++, because my interrupt service routine
block OS for 3 millisecond of every 5 millisecond, I think this cause
bios no time to serve and check keyboard buffer, which cause keybord buffer
overflow.

Two questions:
1. related to process of bios handler keyboard buffer, when IRQ1 generate
a interrupt, but has not finished its ISR, can other IRQ, such as IRQ7
generate a interrupt in between ? How can keyboard buffer overflow happen ?

2. cli and sti will disable and enable all IRQ, is there a instruction which
will only disable and enable one specific IRQ, like IRQ7.

structure of my program

int main(void)
{
        InstallExternalTimingIRQ7ISR()

        while( waitkey() )
        {
                doKeyboardInput_ScrOutout();
        }

        ReinstallOldIRQ7ISR();

Quote:
}

My interrupt happens every 5 ms and program need 3 ms to finish its ISR,
during this time, I use cli and sti to protect its service, how will this
affect keyboard interrupt ? The interrupt I used is external circuit
generate 5 ms interrupt connect to IRQ7.

Thanks folks, this is urgent for me, please send me a mail.

Bin  



Thu, 13 Aug 1998 03:00:00 GMT  
 Urg,ent, keyboard buffer overflow

Quote:
>Hi, folks:
>I wrote a DOS program in Borland C++, because my interrupt service routine
>block OS for 3 millisecond of every 5 millisecond, I think this cause
>bios no time to serve and check keyboard buffer, which cause keybord buffer
>overflow.
>Two questions:
>1. related to process of bios handler keyboard buffer, when IRQ1 generate
>a interrupt, but has not finished its ISR, can other IRQ, such as IRQ7
>generate a interrupt in between ? How can keyboard buffer overflow happen ?

If you have to have an ISR that takes so long, it is good to issue the EOI
(out 20h, 20h) early in the interrupt so higher interrupts can interrupt you.
In general though if processing takes so long you defer it from the ISR to
a task and just get out of the ISR.

Quote:
>2. cli and sti will disable and enable all IRQ, is there a instruction which
>will only disable and enable one specific IRQ, like IRQ7.

For the lower 8 IRQs, you can access port 21h.  IRQ 7 corresponds to bit 7;
to enable IRQ7 you would do:

in al,21h
and al,07fh
out 21h,al

and to disalbe it you would do:

in al,21h
or al,80h
out 21h,al

This is a PC hardware thing, not something that is built into the x86
processor series.

David

Quote:
>structure of my program
>int main(void)
>{
>    InstallExternalTimingIRQ7ISR()
>        while( waitkey() )
>    {
>            doKeyboardInput_ScrOutout();
>    }

>        ReinstallOldIRQ7ISR();
>}
>My interrupt happens every 5 ms and program need 3 ms to finish its ISR,
>during this time, I use cli and sti to protect its service, how will this
>affect keyboard interrupt ? The interrupt I used is external circuit
>generate 5 ms interrupt connect to IRQ7.
>Thanks folks, this is urgent for me, please send me a mail.
>Bin  



Fri, 14 Aug 1998 03:00:00 GMT  
 Urg,ent, keyboard buffer overflow

Quote:

>Hi, folks:

>I wrote a DOS program in Borland C++, because my interrupt service routine
>block OS for 3 millisecond of every 5 millisecond, I think this cause
>bios no time to serve and check keyboard buffer, which cause keybord buffer
>overflow.

>Two questions:
>1. related to process of bios handler keyboard buffer, when IRQ1 generate
>a interrupt, but has not finished its ISR, can other IRQ, such as IRQ7
>generate a interrupt in between ? How can keyboard buffer overflow happen ?

>2. cli and sti will disable and enable all IRQ, is there a instruction which
>will only disable and enable one specific IRQ, like IRQ7.

>structure of my program

>int main(void)
>{
>        InstallExternalTimingIRQ7ISR()

>        while( waitkey() )
>        {
>                doKeyboardInput_ScrOutout();
>        }

>        ReinstallOldIRQ7ISR();
>}
>My interrupt happens every 5 ms and program need 3 ms to finish its ISR,
>during this time, I use cli and sti to protect its service, how will this
>affect keyboard interrupt ? The interrupt I used is external circuit
>generate 5 ms interrupt connect to IRQ7.

>Thanks folks, this is urgent for me, please send me a mail.

Hardware interrupts are first fielded by the PIC (Intel 8259A Progammable
Interrupt Controller). This thing acts as a sort of receptionist for the
CPU. It accepts up to eight distinct interrupts and can mask (ignore)
interrupts individually. It responds to each unmasked interrupt and
forwards it to the CPU, provided no other interrupt of higher priority
is being serviced at that moment, Basically, the lower the IRQ number,
the higher the priority.Timer - IRQ0, Keyboard - IRQ2, etc...
To answer your question, you can mask individual interrupts on the PIC.
This isn't the correct thing to do. The CPU automatically disables all
interrupts when it transfers control to the service routine for the current
interrupt. During the servicing of the interrupt, the PIC inhibits further
interrupts of the same or lower priority, but higher priority interrupts
are still acknowledged if the interrupt flag is set. To allow this to
function correctly, your ISR *MUST* reenable interrupts with an STI
immediately, before it begins servicing your interrupt.  This allows the
other devices to function properly.


Sat, 15 Aug 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CD 3.1 "Buffer Overflow" in report

2. Clipper 5.01 C3002 Input Buffer Overflow error

3. VO1.c output buffer overflow

4. Serial-Buffer overflow without too much incoming data or bursts on the line

5. VO: output buffer overflow:52600 ??

6. VO 1.0c Output buffer overflow error?

7. serial port buffer receive overflow????

8. Q: overflow error at AI Buffer Read

9. buffer overflows

10. want to understand code for buffer overflows

11. Buffer overflow issues with NAGware f95 v 4.1

12. Help! Buffer overflow on output

 

 
Powered by phpBB® Forum Software