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
ASM CLI causes reboot
Re: ASM CLI causes reboot
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 ?
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 ?