Page 1 of 1

What effect is the instruction CLI?

Posted: Tue Apr 19, 2011 6:59 pm
by leetow2003
I write codes about delaying,I find
the PC always restart without instruction CLI,
I want to why and What effect the instruction CLI is?
Look:

Code: Select all

     cli
     ;     
     mov eax,cr0
     or eax,1
     mov cr0,eax
     ;
     jump <code_sel>,<offset virtual>;This instruction is to jump next instruction
     ;
virtual:    ;Entering P-Mode
     
     mov dx,0fffh
 ok1:mov cx,0ffffh
  ok:loop ok
     dec dx
     cmp dx,0
     jnz ok1
     ......

Re: What effect is the instruction CLI?

Posted: Tue Apr 19, 2011 7:36 pm
by TylerH
What is the name of it? That should answer your question.

Re: What effect is the instruction CLI?

Posted: Tue Apr 19, 2011 10:43 pm
by leetow2003
TylerH wrote:What is the name of it? That should answer your question.
Name?what name do you say?

Re: What effect is the instruction CLI?

Posted: Tue Apr 19, 2011 10:47 pm
by Yargh
"Clear interrupt flag"

Based on that you could very easily guess what it does.

Re: What effect is the instruction CLI?

Posted: Wed Apr 20, 2011 1:04 am
by leetow2003
Yargh wrote:"Clear interrupt flag"

Based on that you could very easily guess what it does.
I ask why the PC always restart when I delete this instruction?

Re: What effect is the instruction CLI?

Posted: Wed Apr 20, 2011 1:19 am
by thomasloven
With interrupts enabled, the timer will fire one pretty soon (~milliseconds probably).
The processor will then check your interrupt descriptor table (IDT) for the correct action to take.
I'm guessing you don't have an IDT at all, which means it won't find the right action and instead cause a double fault.
If the double fault is not handled in the IDT, you get a tripple fault, and the processor restarts.

Re: What effect is the instruction CLI?

Posted: Wed Apr 20, 2011 1:27 am
by Solar
leetow2003 wrote:
TylerH wrote:What is the name of it? That should answer your question.
Name?what name do you say?
You do have the Intel Manuals ready at hand, do you? Volume 2 has a complete reference of instructions and their names. The other two volumes do a good job at explaining how it all works together. Without having these manuals for reference, you're doomed to fail.

Re: What effect is the instruction CLI?

Posted: Wed Apr 20, 2011 7:53 pm
by leetow2003
thomasloven wrote:With interrupts enabled, the timer will fire one pretty soon (~milliseconds probably).
The processor will then check your interrupt descriptor table (IDT) for the correct action to take.
I'm guessing you don't have an IDT at all, which means it won't find the right action and instead cause a double fault.
If the double fault is not handled in the IDT, you get a tripple fault, and the processor restarts.
If I write two instructions in the P-Mode:

Code: Select all

mov dx,0ffffh
mov cx,0ffffh
and I delete the instruction CLI,the codes run well,and the PC doesn't restart .
I want to know:the timer fires one pretty soon all the same(~milliseconds probably),
and I don't have an IDT,just now why doesn't the PC restart?
Thank you.

Re: What effect is the instruction CLI?

Posted: Thu Apr 21, 2011 2:23 am
by thomasloven
thomasloven wrote:With interrupts enabled, the timer will fire one pretty soon (~milliseconds probably).
The processor will then check your interrupt descriptor table (IDT) for the correct action to take.
I'm guessing you don't have an IDT at all, which means it won't find the right action and instead cause a double fault.
If the double fault is not handled in the IDT, you get a tripple fault, and the processor restarts.
Well.. this is why you should think before you reply...

Code: Select all

jump <code_sel>,<offset virtual>;This instruction is to jump next instruction
What do you mean with this row? Are you replacing <code_sel> with the right gdt selector and <offset virtual> with virtual in your actual code?

Re: What effect is the instruction CLI?

Posted: Thu Apr 21, 2011 5:49 am
by leetow2003
code_sel expresses this code segment selector,virtual expresses label next line

Re: What effect is the instruction CLI?

Posted: Thu Apr 21, 2011 6:00 am
by Love4Boobies
Someone lock this thread.

Re: What effect is the instruction CLI?

Posted: Thu Apr 21, 2011 7:30 am
by JamesM
Done. haven't even read it.

Hope there was a good reason... ;)