Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a043e39 in mainline


Ignore:
Timestamp:
2010-06-25T04:23:47Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
8e374ea7
Parents:
06737a0
Message:

Switch amd64 to use the unified panic architecture.

Location:
kernel/arch/amd64
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/interrupt.h

    r06737a0 ra043e39  
    112112extern void (* eoi_function)(void);
    113113
    114 extern void decode_istate(int n, istate_t *istate);
     114extern void decode_istate(istate_t *istate);
    115115extern void interrupt_init(void);
    116116extern void trap_virtual_enable_irqs(uint16_t irqmask);
  • kernel/arch/amd64/src/asm_utils.S

    r06737a0 ra043e39  
    5050.global interrupt_handlers
    5151.global syscall_entry
    52 .global panic_printf
    53 
    54 panic_printf:
    55         movq $halt, (%rsp)
    56         jmp printf
    5752
    5853.global cpuid
     
    232227        cld
    233228
    234         # Stop stack traces here
    235         xorq %rbp, %rbp
     229        #
     230        # Stop stack traces here if we came from userspace.
     231        #
     232        movq %cs, %rax
     233        xorq %rdx, %rdx
     234        cmpq %rax, IREGISTER_SPACE+16(%rsp)
     235        cmovneq %rdx, %rbp
    236236
    237237        movq $(\i), %rdi        # %rdi - first parameter
     
    287287        pushq %rcx
    288288        pushq %r11
     289        pushq %rbp
     290
     291        xorq %rbp, %rbp         # stop the stack traces here
    289292
    290293        movq %r10, %rcx         # Copy the 4th argument where it is expected
     
    293296        addq $8, %rsp
    294297               
     298        popq %rbp
    295299        popq %r11
    296300        popq %rcx
  • kernel/arch/amd64/src/interrupt.c

    r06737a0 ra043e39  
    6363void (* eoi_function)(void) = NULL;
    6464
    65 void decode_istate(int n, istate_t *istate)
    66 {
    67         const char *symbol = symtab_fmt_name_lookup(istate->rip);
    68        
    69         printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n", n, __func__);
    70         printf("%%rip: %#llx (%s)\n", istate->rip, symbol);
    71         printf("ERROR_WORD=%#llx\n", istate->error_word);
    72         printf("%%cs=%#llx, rflags=%#llx, %%cr0=%#llx\n", istate->cs,
    73             istate->rflags, read_cr0());
    74         printf("%%rax=%#llx, %%rcx=%#llx, %%rdx=%#llx\n", istate->rax,
     65void decode_istate(istate_t *istate)
     66{
     67        printf("error_word=%#llx\n", istate->error_word);
     68        printf("cs =%#0.16llx\trflags=%#0.16llx\n", istate->cs,
     69            istate->rflags);
     70        printf("rax=%#0.16llx\trbx=%#0.16llx\trcx=%#0.16llx\n", istate->rax,
    7571            istate->rcx, istate->rdx);
    76         printf("%%rsi=%#llx, %%rdi=%#llx, %%r8=%#llx\n", istate->rsi,
     72        printf("rsi=%#0.16llx\trdi=%#0.16llx\tr8 =%#0.16llx\n", istate->rsi,
    7773            istate->rdi, istate->r8);
    78         printf("%%r9=%#llx, %%r10=%#llx, %%r11=%#llx\n", istate->r9,
     74        printf("r9 =%#0.16llx\tr10=%#0.16llx\tr11=%#0.16llx\n", istate->r9,
    7975            istate->r10, istate->r11);
    80         printf("%%rsp=%#llx\n", &istate->stack[0]);
    81        
    82         stack_trace_istate(istate);
    8376}
    8477
     
    9588{
    9689        fault_if_from_uspace(istate, "Unserviced interrupt: %u.", n);
    97         decode_istate(n, istate);
    98         panic("Unserviced interrupt.");
     90        panic_badtrap(istate, n, "Unserviced interrupt.");
    9991}
    10092
     
    10294{
    10395        fault_if_from_uspace(istate, "Divide error.");
    104         decode_istate(n, istate);
    105         panic("Divide error.");
     96        panic_badtrap(istate, n, "Divide error.");
    10697}
    10798
     
    129120                fault_if_from_uspace(istate, "General protection fault.");
    130121        }
    131        
    132         decode_istate(n, istate);
    133         panic("General protection fault.");
     122        panic_badtrap(istate, n, "General protection fault.");
    134123}
    135124
     
    137126{
    138127        fault_if_from_uspace(istate, "Stack fault.");
    139         decode_istate(n, istate);
    140         panic("Stack fault.");
     128        panic_badtrap(istate, n, "Stack fault.");
    141129}
    142130
  • kernel/arch/amd64/src/mm/page.c

    r06737a0 ra043e39  
    196196        if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
    197197                fault_if_from_uspace(istate, "Page fault: %#x.", page);
    198 
    199                 decode_istate(n, istate);
    200                 printf("Page fault address: %llx.\n", page);
    201                 panic("Page fault.");
     198                panic_memtrap(istate, access, page, "Page fault.");
    202199        }
    203200}
Note: See TracChangeset for help on using the changeset viewer.