85 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #include <system.h>
 | |
| #include <conio.h>
 | |
| 
 | |
| char *exception_messages[] = {
 | |
|       "Division By Zero Exception",
 | |
|  	"Debug Exception",
 | |
|  	"Non Maskable Interrupt Exception",
 | |
|   	"Breakpoint Exception",
 | |
|  	"Into Detected Overflow Exception",
 | |
|  	"Out of Bounds Exception",
 | |
|  	"Invalid Opcode Exception",
 | |
|  	"No Coprocessor",
 | |
|  	"Double Fault Exception",
 | |
|  	"Coprocessor Segment Overrun Exception",
 | |
|  	"Bad TSS Exception",
 | |
|  	"Segment Not Present Exception",
 | |
|  	"Stack Fault Exception",
 | |
|  	"General Protection Fault Exception",
 | |
|  	"Page Fault Exception",
 | |
|  	"Unknown Interrupt Exception",
 | |
|  	"Coprocessor Fault Exception",
 | |
|  	"Alignment Check Exception",
 | |
|  	"Machine Check Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception",
 | |
| 	"Reserved Exception"
 | |
| };
 | |
| 
 | |
| 
 | |
| //void _STOP_ERROR_SCREEN (ISR_stack_regs *r)
 | |
| //{
 | |
|         //set_default_colors (0x01, 0x0F); clrscr();
 | |
|         /*puts_pos (0, 0, "                              Blue Screen Of Death\n");
 | |
|         int i; for (i = 79; i>=0; i--) putc('=');
 | |
|         puts_pos_font (15, 2, "A fatal error has occured, CTA OS has been halted.", 0x01, 0x0C);
 | |
|         puts_pos_font (10, 4, "gs", 0x01, 0x0B); put_hex_pos(15, 4, r->gs);
 | |
|         puts_pos_font (10, 5, "fs", 0x01, 0x0B); put_hex_pos(15, 5, r->fs);
 | |
|         puts_pos_font (10, 6, "es", 0x01, 0x0B); put_hex_pos(15, 6, r->es);
 | |
|         puts_pos_font (10, 7, "ds", 0x01, 0x0B); put_hex_pos(15, 7, r->ds);
 | |
|         
 | |
|         puts_pos_font (40, 4, "edi", 0x01, 0x0B); put_hex_pos(45, 4, r->edi);
 | |
|         puts_pos_font (40, 5, "esi", 0x01, 0x0B); put_hex_pos(45, 5, r->esi);
 | |
|         puts_pos_font (40, 6, "ebp", 0x01, 0x0B); put_hex_pos(45, 6, r->ebp);
 | |
|         puts_pos_font (40, 7, "esp", 0x01, 0x0B); put_hex_pos(45, 7, r->esp);
 | |
|         
 | |
|         puts_pos_font (10, 9, "eax", 0x01, 0x0B); put_hex_pos(15, 9, r->eax);
 | |
|         puts_pos_font (10, 10, "ebx", 0x01, 0x0B); put_hex_pos(15, 10, r->ebx);
 | |
|         puts_pos_font (40, 9, "ecx", 0x01, 0x0B); put_hex_pos(45, 9, r->ecx);
 | |
|         puts_pos_font (40, 10, "edx", 0x01, 0x0B); put_hex_pos(45, 10, r->edx);
 | |
| 
 | |
|         puts_pos_font (10, 12, "int_no", 0x01, 0x0B); put_hex_pos(17, 12, r->int_no);
 | |
|         puts_pos_font (10, 14, "Error code:", 0x01, 0x0B); put_hex_pos(24, 14, r->err_code);
 | |
|         puts_pos_font (10, 15, "Error msg: ", 0x01, 0x0B); puts_pos(24, 15, exception_messages[r->int_no]);
 | |
|         
 | |
|         puts_pos_font (10, 17, "eip", 0x01, 0x0B); put_hex_pos(17, 17, r->eip);
 | |
|         puts_pos_font (10, 18, "cs", 0x01, 0x0B); put_hex_pos(17, 18, r->cs);
 | |
|         puts_pos_font (10, 19, "eflags", 0x01, 0x0B); put_hex_pos(17, 19, r->eflags);
 | |
|         puts_pos_font (10, 20, "useresp", 0x01, 0x0B); put_hex_pos(17, 20, r->useresp);
 | |
|         puts_pos_font (10, 21, "ss", 0x01, 0x0B); put_hex_pos(17, 21, r->ss);
 | |
|         
 | |
|         puts_pos_font (29, 24, "!!! System  Halted !!!", 0x01, 0x0C);*/
 | |
| //}
 | |
| 
 | |
| /*void _STOP_ERROR_SCREEN (ISR_stack_regs *r)
 | |
| {
 | |
|         puts_pos_font (30, 24, "Stop error 0x", 0x01, 0x0B); put_hex_pos(37, 24, r->int_no);
 | |
|         puts_pos(50, 24, exception_messages[r->int_no]);
 | |
|         
 | |
|         puts_pos_font (5, 24, "!!! System  Halted !!!", 0x01, 0x0C);
 | |
| }*/
 | |
| 
 | |
| void _STOP_ERROR_SCREEN (ISR_stack_regs *r)
 | |
| {
 | |
|     cprintf ("%#0C** Fatal Error: "); cprintf("%#0E %s \n\r", exception_messages[r->int_no]);
 | |
|     for (;;);
 | |
| } |