Hello,
What are the reserved exceptions and/or interrupts (number 15, 17, ..., 32)? Do I have to put something there or I just can leave them empty?
Thanks for any help.
Reserved exceptions and/or interrupts
Re:Reserved exceptions and/or interrupts
Hi,
You can do what-ever you like with the reserved exceptions. I normally treat them the same as other exceptions, so if one is generated the user gets an "Unknown exception #??" critical error (just in case future CPUs use them).
Also, exception 17 is "Alignment Check Exception (#AC)".
Cheers,
Brendan
You can do what-ever you like with the reserved exceptions. I normally treat them the same as other exceptions, so if one is generated the user gets an "Unknown exception #??" critical error (just in case future CPUs use them).
Also, exception 17 is "Alignment Check Exception (#AC)".
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Reserved exceptions and/or interrupts
Hello, and thank you for your help.
I still have a question about the format of the exception handler.
Would it be like this?! 'cause I had some trouble: when I tried to print the name of the exception using my default protected mode print routine, it printed a weird message and/or crashed Bochs.
I still have a question about the format of the exception handler.
Would it be like this?! 'cause I had some trouble: when I tried to print the name of the exception using my default protected mode print routine, it printed a weird message and/or crashed Bochs.
Code: Select all
DivByZeroEx:
pusha
; mov word [0B8000h],'e '
;instead of the above I call my print routine
mov al,20h
out 20h,al
popa
jmp $
iret
Re:Reserved exceptions and/or interrupts
Hello,
I found what was the problem (bad memory address) but I still want to know some things about the format of the handler.
Are "pusha" and "popa" necessary? Do I have to put the EOI code (mov al,20h / out 20h,al)? Since a lot of exceptions can't be undone, do I have to include the "iret" instruction?
Thanks.
I found what was the problem (bad memory address) but I still want to know some things about the format of the handler.
Are "pusha" and "popa" necessary? Do I have to put the EOI code (mov al,20h / out 20h,al)? Since a lot of exceptions can't be undone, do I have to include the "iret" instruction?
Thanks.
Re:Reserved exceptions and/or interrupts
As far as I know... you don't need the EOI code with exceptions. I never. If i remember correctly EOI means End Of Interrupt... and this is a code sent to the PIC to tell it that the interrupt has been handled so it can trigger the next interrupt. My handler looks like this :
This pushes wich interrupts it is then call a c procedure to displays the error and panic (halt the cpu ans show registers and stack).
When I handle an Interrupt I send the EOI, because without this no other interrupt will be triggered and since the architecture is interrupt driven... interrupts that will be handled once are not going to make things work properlly.
Code: Select all
DivideError:
push %ds
push %es
push %fs
push %gs
pusha
pushl $0x0
call exceptions
popl %eax
popa
pop %gs
pop %fs
pop %es
pop %ds
iret
Code: Select all
pushl $0x0
call exceptions
popl %eax
Re:Reserved exceptions and/or interrupts
Only if you intend to return to the application. Since you don't know what the problem is and how to fix it, you're probably just going to kill the process that caused it, in which case, no, you don't really need to preserve any of its registers.ManOfSteel wrote:Are "pusha" and "popa" necessary?
Absolutely not. That goes for any processor exception. You ONLY use that code when dealing with interrupts from the PIC.ManOfSteel wrote:Do I have to put the EOI code (mov al,20h / out 20h,al)?
Since you don't know how to deal with an exception that was reserved at the time you wrote your code, returning would be a bad idea. So, no, don't iret.ManOfSteel wrote:Since a lot of exceptions can't be undone, do I have to include the "iret" instruction?