kern

annotate src/panic.c @ 79:2dda077c1d38

silenced a warning about a missing prototype in panic.c
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 06 Dec 2011 12:59:38 +0200
parents 437360696883
children
rev   line source
nuclear@11 1 #include <stdio.h>
nuclear@13 2 #include <string.h>
nuclear@11 3 #include <stdarg.h>
nuclear@11 4 #include "asmops.h"
nuclear@79 5 #include "proc.h"
nuclear@11 6
nuclear@43 7 struct all_registers {
nuclear@13 8 uint32_t eax, ebx, ecx, edx;
nuclear@13 9 uint32_t esp, ebp, esi, edi;
nuclear@13 10 uint32_t eflags;
nuclear@13 11 uint32_t cs, ss, ds, es, fs, gs;
nuclear@13 12 uint32_t cr0, cr1, cr2, cr3;
nuclear@13 13 };
nuclear@13 14
nuclear@13 15 /* defined in regs.S */
nuclear@43 16 void get_regs(struct all_registers *regs);
nuclear@13 17
nuclear@11 18 void panic(const char *fmt, ...)
nuclear@11 19 {
nuclear@11 20 va_list ap;
nuclear@43 21 struct all_registers regs;
nuclear@57 22 uint32_t eip;
nuclear@13 23
nuclear@13 24 disable_intr();
nuclear@13 25
nuclear@13 26 memset(&regs, 0, sizeof regs);
nuclear@13 27 get_regs(&regs);
nuclear@11 28
nuclear@57 29 eip = get_caller_instr_ptr();
nuclear@57 30
nuclear@11 31 printf("~~~~~ kernel panic ~~~~~\n");
nuclear@11 32 va_start(ap, fmt);
nuclear@11 33 vprintf(fmt, ap);
nuclear@11 34 va_end(ap);
nuclear@11 35
nuclear@13 36 printf("\nRegisters:\n");
nuclear@13 37 printf("eax: %x, ebx: %x, ecx: %x, edx: %x\n", regs.eax, regs.ebx, regs.ecx, regs.edx);
nuclear@13 38 printf("esp: %x, ebp: %x, esi: %x, edi: %x\n", regs.esp, regs.ebp, regs.esi, regs.edi);
nuclear@57 39 printf("eip: %x, eflags: %x\n", eip, regs.eflags);
nuclear@13 40 printf("cr0: %x, cr1: %x, cr2: %x, cr3: %x\n", regs.cr0, regs.cr1, regs.cr2, regs.cr3);
nuclear@13 41 printf("cs: %x (%d|%d)\n", regs.cs, regs.cs >> 3, regs.cs & 3);
nuclear@13 42 printf("ss: %x (%d|%d)\n", regs.ss, regs.ss >> 3, regs.ss & 3);
nuclear@13 43 printf("ds: %x (%d|%d)\n", regs.ds, regs.ds >> 3, regs.ds & 3);
nuclear@13 44 printf("es: %x (%d|%d)\n", regs.es, regs.es >> 3, regs.es & 3);
nuclear@13 45 printf("fs: %x (%d|%d)\n", regs.fs, regs.fs >> 3, regs.fs & 3);
nuclear@13 46 printf("gs: %x (%d|%d)\n", regs.gs, regs.gs >> 3, regs.gs & 3);
nuclear@13 47
nuclear@11 48 halt_cpu();
nuclear@11 49 }