What effect is the instruction CLI?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Locked
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

What effect is the instruction CLI?

Post 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
     ......
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: What effect is the instruction CLI?

Post by TylerH »

What is the name of it? That should answer your question.
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Re: What effect is the instruction CLI?

Post by leetow2003 »

TylerH wrote:What is the name of it? That should answer your question.
Name?what name do you say?
Yargh
Member
Member
Posts: 56
Joined: Sat Jun 12, 2010 9:04 pm
Location: Somewhere else.

Re: What effect is the instruction CLI?

Post by Yargh »

"Clear interrupt flag"

Based on that you could very easily guess what it does.
Wait... What?
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Re: What effect is the instruction CLI?

Post 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?
thomasloven
Member
Member
Posts: 89
Joined: Tue Feb 26, 2008 10:47 am
Location: Sweden

Re: What effect is the instruction CLI?

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: What effect is the instruction CLI?

Post 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.
Every good solution is obvious once you've found it.
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Re: What effect is the instruction CLI?

Post 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.
thomasloven
Member
Member
Posts: 89
Joined: Tue Feb 26, 2008 10:47 am
Location: Sweden

Re: What effect is the instruction CLI?

Post 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?
leetow2003
Member
Member
Posts: 70
Joined: Fri Nov 19, 2010 6:54 pm

Re: What effect is the instruction CLI?

Post by leetow2003 »

code_sel expresses this code segment selector,virtual expresses label next line
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: What effect is the instruction CLI?

Post by Love4Boobies »

Someone lock this thread.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: What effect is the instruction CLI?

Post by JamesM »

Done. haven't even read it.

Hope there was a good reason... ;)
Locked