Annotation of qemu/roms/openbios/arch/x86/exception.c, revision 1.1

1.1     ! root        1: #include "config.h"
        !             2: #include "libopenbios/bindings.h"
        !             3: #include "asm/types.h"
        !             4: 
        !             5: 
        !             6: 
        !             7: /* program counter */
        !             8: extern ucell            PC;
        !             9: 
        !            10: extern unsigned char    *dict;
        !            11: extern cell             dicthead;
        !            12: extern ucell            *last;
        !            13: 
        !            14: 
        !            15: 
        !            16: struct eregs {
        !            17:        uint32_t eax, ecx, edx, ebx, esp, ebp, esi, edi;
        !            18:        uint32_t vector;
        !            19:        uint32_t error_code;
        !            20:        uint32_t eip;
        !            21:        uint32_t cs;
        !            22:        uint32_t eflags;
        !            23: };
        !            24: 
        !            25: static const char * const exception_names[]= {
        !            26:        "division by zero",
        !            27:        "single step",
        !            28:        "NMI",
        !            29:        "breakpoint",
        !            30:        "interrupt overflow",
        !            31:        "bound range exceeded",
        !            32:        "invalid opcode",
        !            33:        "device unavailable",
        !            34:        "double fault",
        !            35:        "FPU segment overrun",
        !            36:        "invalid TSS",
        !            37:        "segment not present",
        !            38:        "stack exception",
        !            39:        "general protection fault",
        !            40:        "page fault",
        !            41:        "reserved",
        !            42:        "floating point exception",
        !            43:        "alignment check",
        !            44:        "machine check exception",
        !            45: };
        !            46: 
        !            47: void do_nothing(void);
        !            48: void do_nothing(void)
        !            49: {
        !            50:        printk("Doing nothing\n");
        !            51: }
        !            52: 
        !            53: void x86_exception(struct eregs *info);
        !            54: void x86_exception(struct eregs *info)
        !            55: {
        !            56:        if(info->vector <= 18) {
        !            57:                printk("\nUnexpected Exception: %s",
        !            58:                                exception_names[info->vector]);
        !            59:        } else {
        !            60:                printk("\nUnexpected Exception: %d", info->vector);
        !            61:        }
        !            62: 
        !            63:        printk(
        !            64:                " @ %02x:%08lx - Halting\n"
        !            65:                "Code: %d eflags: %08lx\n"
        !            66:                "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n"
        !            67:                "edi: %08lx esi: %08lx ebp: %08lx esp: %08lx\n",
        !            68:                info->cs, (unsigned long)info->eip,
        !            69:                info->error_code, (unsigned long)info->eflags,
        !            70:                (unsigned long)info->eax, (unsigned long)info->ebx,
        !            71:                (unsigned long)info->ecx, (unsigned long)info->edx,
        !            72:                (unsigned long)info->edi, (unsigned long)info->esi,
        !            73:                (unsigned long)info->ebp, (unsigned long)info->esp);
        !            74: 
        !            75:         printk("\ndict=0x%x here=0x%x(dict+0x%x) pc=0x%x(dict+0x%x)\n",
        !            76:                (ucell)dict, (ucell)dict + dicthead, dicthead, PC, PC - (ucell) dict);
        !            77:         printk("dstackcnt=%d rstackcnt=%d\n",
        !            78:                dstackcnt, rstackcnt);
        !            79: 
        !            80:        rstackcnt=0;
        !            81:        dstackcnt=0;
        !            82: 
        !            83:        PC=findword("outer-interpreter");
        !            84: 
        !            85:        info->eip=(uint32_t)&do_nothing;
        !            86: 
        !            87: /*
        !            88:        for (;;)
        !            89:                asm("hlt;");
        !            90:                ;
        !            91: */
        !            92: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.