Page 1 of 1
Exception Handler
Posted: Fri Jul 14, 2006 3:03 am
by origin of
Hi, how can i write my own exception handler ??
I preput that in my bootloader i create a GDT...
now i have a kernel, with my own cout....and now i want to implement a Exception handler before continuing to write my kernel...
sorry for my english ;D
Re:Exception Handler
Posted: Fri Jul 14, 2006 3:30 am
by Combuster
Basically, all you need to do is:
- create and IDT
- point it to your handler function (ints 0-31)
- make sure your exception handler pops any error code
- write the rest of the handler
- have it return (if the thread is not being terminated) using IRET
Re:Exception Handler
Posted: Fri Jul 14, 2006 3:34 am
by origin of
i found this
http://www.eastcoastgames.com/articles/cppexception.html, the article doesn't say anything about IDT, pointer and IRET....
is another thing ?
Re:Exception Handler
Posted: Fri Jul 14, 2006 4:02 am
by Kemp
Yup, C++ exceptions are different to machine exceptions. The first deal with the C++ code messing up, are usually entirely a software construction, and handle the exception within the program code (unless it's not caught), while the latter deal with things like protection faults and suchlike and usually involve a hardware mechanism and are usually handled by the OS.
Re:Exception Handler
Posted: Fri Jul 14, 2006 5:19 am
by origin of
ok....i make the IDT, and now how can i make handler ?
any guide ?
i also read the third manual, chapter 5 (intel manual)...
Re:Exception Handler
Posted: Fri Jul 14, 2006 9:12 am
by Kemp
Check out the OSFAQ (click the banner at the top of any forum page) for more info, including info on the various different ways to do it and why they should be avoided