X86 Asm - CLI, STI

Started by
22 comments, last by markr 19 years, 8 months ago
Quote:How would the state of the interrupt flag affect what the interrupt handler could do? It affects only whether or not the handler is entered.

Yes, but *does* the handler get entered from a "int xx" when interrupts are disabled?
char a[99999],*p=a;int main(int c,char**V){char*v=c>0?1[V]:(char*)V;if(c>=0)for(;*v&&93!=*v;){62==*v&&++p||60==*v&&--p||43==*v&&++*p||45==*v&&--*p||44==*v&&(*p=getchar())||46==*v&&putchar(*p)||91==*v&&(*p&&main(0,(char**)(--v+2))||(v=(char*)main(-1,(char**)++v)-1));++v;}else for(c=1;c;c+=(91==*v)-(93==*v),++v);return(int)v;}  /*** drpizza@battleaxe.net ***/
Advertisement
Quote:I can't see how CLI / STI are useful even in kernel-mode programming, because on a multiprocessor system (or hyperthread), they don't actually stop interrupts from interrupting the other processor.

But do they have to? The point of disabling interrupts is to make sure the processor doesn't get interrupted when it's dealing with an interrupt, not to protect shared resources.
char a[99999],*p=a;int main(int c,char**V){char*v=c>0?1[V]:(char*)V;if(c>=0)for(;*v&&93!=*v;){62==*v&&++p||60==*v&&--p||43==*v&&++*p||45==*v&&--*p||44==*v&&(*p=getchar())||46==*v&&putchar(*p)||91==*v&&(*p&&main(0,(char**)(--v+2))||(v=(char*)main(-1,(char**)++v)-1));++v;}else for(c=1;c;c+=(91==*v)-(93==*v),++v);return(int)v;}  /*** drpizza@battleaxe.net ***/
Quote:Original post by DrPizza
Quote:How would the state of the interrupt flag affect what the interrupt handler could do? It affects only whether or not the handler is entered.

Yes, but *does* the handler get entered from a "int xx" when interrupts are disabled?


Yes.
Quote:Original post by DrPizza
But do they have to? The point of disabling interrupts is to make sure the processor doesn't get interrupted when it's dealing with an interrupt, not to protect shared resources.


I disagree. Being interrupted from an interrupt is just a special case of protecting shared resources.

In fact it's fine if you get interrupted from an interrupt, as long as it's not the same one and doesn't share any resources (and the stack doesn't overflow of coure).

It's just a special case.

Mark

This topic is closed to new replies.

Advertisement