Error handlers in your OS

Programming, for all ages and all languages.
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Error handlers in your OS

Post by inflater »

Hi all,
what kind of critical error-handling do you have in your OS?

Well, I have good old BSOD from Win98. :D Just modified to suit the needs. ;)

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

I have a BSOD: Black Screen of Death. It switches to text mode, displays the error, disables all interrupts, and places the system a loop. All exceptions, including divide by 0 are caught by this, which gets annoying annoying when I move the mouse to the top line or left of the screen, because my video driver divides the screensize by their position.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

My OS has not come very far yet, but at the moment, it dumps a physical ram map, virtual ram map and the CPU state to COM1 (and optionally, the screen too).

I have VPC set up to dump it's COM port to a file, and therefore have a nice history of what went wrong :? .

Cheers,
Adam
Ready4Dis
Member
Member
Posts: 571
Joined: Sat Nov 18, 2006 9:11 am

Post by Ready4Dis »

I haven't gotten any sort of exception handling for much, just displays what happened and keeps on chugging if it wasn't critical, if it was, it pretty much just resets ;). I'll work on that more when I get my new memory management stuff done. I will probably implement something that kills the offending process and just display an error message saying what exception it caused and why it was closed.
User avatar
Steve the Pirate
Member
Member
Posts: 152
Joined: Fri Dec 15, 2006 7:01 am
Location: Brisbane, Australia
Contact:

Post by Steve the Pirate »

My OS has a Red screen of death. It just prints what the error was and tells the user to restart the PC.

-Stephen
My Site | My Blog
Symmetry - My operating system.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

AJ wrote: I have VPC set up to dump it's COM port to a file, and therefore have a nice history of what went wrong :? .
You just inspired me to get a similar thing running under QEMU. Outputting to a COM port may help me to dump kernel messages while working under VESA.
User avatar
spix
Member
Member
Posts: 128
Joined: Mon Jun 26, 2006 8:41 am
Location: Millicent, South Australia
Contact:

Post by spix »

I have this interactive debugger type thing, it doesn't work very well, but the idea is it lets you analyze the stack, contents of memory and so on.

I haven't been motivated to fix it as most of my crashes these days are either in userspace, or some error that doesn't fiire an exception.
User avatar
JoeKayzA
Member
Member
Posts: 79
Joined: Wed Aug 24, 2005 11:00 pm
Location: Graz/Austria

Post by JoeKayzA »

ATM my OS just displays a message in textmode and a register dump, this is for all unhandled exceptions (including unhandled pagefaults), but I do most error analysis using bochs' debugger. (currently my OS has not yet left the bochs)

I'm planning to implement a simple gdb stub as soon as possible, however, using a com port as transport. I hope this isn't getting too difficult... :oops:

cheers
Joe
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

MessiahAndrw wrote:
AJ wrote: I have VPC set up to dump it's COM port to a file, and therefore have a nice history of what went wrong :? .
You just inspired me to get a similar thing running under QEMU. Outputting to a COM port may help me to dump kernel messages while working under VESA.
I'm glad I inspired someone - and so soon in to my own os's dev process too :)

I would strongly recommend anyone setting up a similar system though - if DEBUG is defined, my printf function also outputs to the com port. You can register and memory dump at any time you like. I implemented this when I got fed up of the screen scrolling all the time and was pleasantly surprised to find that COM output is even easier than screen output!

Adam
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

I can dump debug info to com port etc.
But in the last 4 years of of Dev a OS, i have not found a error, that can not be found with a simple :

Code: Select all

mov   byte [es:0xB809E], "1"
;some code
mov   byte [es:0xB809E], "2"
;some code
mov   byte [es:0xB809E], "3"
;some code
mov   byte [es:0xB809E], "4"
;some code
mov   byte [es:0xB809E], "5"
;some code
But it maybe differant with other OS designs.
Tyler
Member
Member
Posts: 514
Joined: Tue Nov 07, 2006 7:37 am
Location: York, England

Post by Tyler »

Dex wrote:I can dump debug info to com port etc.
But in the last 4 years of of Dev a OS, i have not found a error, that can not be found with a simple :

Code: Select all

mov   byte [es:0xB809E], "1"
;some code
mov   byte [es:0xB809E], "2"
;some code
mov   byte [es:0xB809E], "3"
;some code
mov   byte [es:0xB809E], "4"
;some code
mov   byte [es:0xB809E], "5"
;some code
But it maybe differant with other OS designs.
Not very useful when the system double faults and your not there to understand it though is it :-P

I still print dots to see which bits of my code get executed before dieing... but i do have a kernel debugging console if i need to check something specific.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

Currently in my old OS(I'm restarting it and only at gdt) I just do a printf saying what the interrupt is..
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Post by JackScott »

COM1 provides transport to a host computer (running Hyperterminal :shock:). Debug messages get output constantly (everytime ANYTHING happens), as well as the CPU state for an exception.

Later on I'm hoping to implement an interactive debugging shell via an ANSI serial terminal, so I can get memory maps, request kernel memory dumps, etc. Note that COM1 isn't used for anything other debugging. The design of my OS means the user can't see COM1 (or any other hardware, directly).
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Wow, I am confused why everyone is using serial port for exception-handling or debugging... Maybe that is the easier solution to handle these things?

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
urxae
Member
Member
Posts: 149
Joined: Sun Jul 30, 2006 8:16 am
Location: The Netherlands

Post by urxae »

inflater wrote:Wow, I am confused why everyone is using serial port for exception-handling or debugging... Maybe that is the easier solution to handle these things?
Well, it has a pretty simple interface, doesn't require any other drivers to work, and is easily written to file or viewed from most emulators...
And it works for real computers as well, of course. All you should need is a null modem and an extra computer to connect it to.
Post Reply