ASM CLI causes reboot

Programming, for all ages and all languages.
Post Reply
SebastianWe
Posts: 1
Joined: Wed May 12, 2010 10:16 am

ASM CLI causes reboot

Post by SebastianWe »

Hello!

I have a common question about the Assembler CLI command.
When and why can it cause a system reboot while the system is in protected mode?

I am working on an Interrupt Description Table for a x86 machine and this information would really help me for debugging.

Thank you
User avatar
Neolander
Member
Member
Posts: 228
Joined: Tue Mar 23, 2010 3:01 pm
Location: Uppsala, Sweden
Contact:

Re: ASM CLI causes reboot

Post by Neolander »

System reboot is a typical symptom of triple fault. This means that some kind of interrupt or exception occurred while no routine was ready to handle it, and that you have no handler for the double fault exception. That's normal, if you have no interrupt handler at the moment, it just means that an interrupt or exception occurred. Probably an exception. Likely of the GP or invalid opcode kind, ie you asked for something that the processor cannot do or that is forbidden to your code (ex : desactivating interrupts in user mode).

First, are you perfectly sure that it's the CLI instruction which causes errors ? Try using some kind of breakpoints if you're unsure (if you use bochs, try the bochs debugger and its handy "magic breakpoints", if not try putting an infinite loop at various places in the ASM code). In protected mode, according to AMD manuals, the sole case in which CLI could cause an exception is when CPL>IOPL, and I don't think that you're coding things at CPL!=0 at the moment, do you ?
Post Reply