Changeset 3396f59 in mainline for arch/amd64/src/interrupt.c


Ignore:
Timestamp:
2005-09-04T08:28:55Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8ff2f3f
Parents:
005384ad
Message:

Fixed gdtr naming issues after ia32 changes.
Fixed stack alignment on new thread to by multiple of 16,
we are now ABI-correct and we do not #GP on va_arg to boot.
Fixed bad exception register names reporting.
Fixed bad _hardcoded_load_addr, which caused allocation of kernel text
frames.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/interrupt.c

    r005384ad r3396f59  
    3838#include <arch.h>
    3939#include <symtab.h>
     40#include <arch/asm.h>
    4041
    41 #define PRINT_INFO_ERRCODE(x) { \
     42#define PRINT_INFO_ERRCODE(n,x) { \
    4243        char *symbol = get_symtab_entry(stack[1]); \
    4344        if (!symbol) \
    4445                symbol = ""; \
    45         printf("----------------EXCEPTION OCCURED----------------\n"); \
     46        printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \
    4647        printf("%%rip: %Q (%s)\n",x[1],symbol); \
    4748        printf("ERROR_WORD=%Q\n", x[0]); \
    48         printf("%%rcs=%Q,flags=%Q\n", x[2], x[3]); \
    49         printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",x[-1],x[-2],x[-3]); \
    50         printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",x[-4],x[-5],x[-6]); \
    51         printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",x[-7],x[-8],x[-9]); \
    52         printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",x[-10],x[-11],x[-12]); \
    53         printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",x[-13],x[-14],x); \
     49        printf("%%rcs=%Q,flags=%Q, %%cr0=%Q\n", x[2], x[3],read_cr0()); \
     50        printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",x[-2],x[-3],x[-4]); \
     51        printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",x[-5],x[-6],x[-7]); \
     52        printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",x[-8],x[-9],x[-10]); \
     53        printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",x[-11],x[-12],x[-13]); \
     54        printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",x[-14],x[-15],x); \
     55        printf("%%rbp=%Q\n",x[-1]); \
    5456        printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]); \
    5557        printf("       %Q, %Q, %Q\n", x[8], x[9], x[10]); \
     58        printf("       %Q, %Q, %Q\n", x[11], x[12], x[13]); \
     59        printf("       %Q, %Q, %Q\n", x[14], x[15], x[16]); \
     60        printf("       %Q, %Q, %Q\n", x[17], x[18], x[19]); \
     61        printf("       %Q, %Q, %Q\n", x[20], x[21], x[22]); \
     62        printf("       %Q, %Q, %Q\n", x[23], x[24], x[25]); \
    5663        }
    5764
     
    9198void null_interrupt(__u8 n, __native stack[])
    9299{
    93         printf("----------------EXCEPTION OCCURED----------------\n");
    94         printf("int %d: null_interrupt\n", n);
     100        printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \
    95101        printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
    96102        panic("unserviced interrupt\n");
     
    99105void gp_fault(__u8 n, __native stack[])
    100106{
    101         PRINT_INFO_ERRCODE(stack);
     107        PRINT_INFO_ERRCODE(n,stack);
    102108        panic("general protection fault\n");
    103109}
     
    105111void ss_fault(__u8 n, __native stack[])
    106112{
    107         PRINT_INFO_ERRCODE(stack);
     113        PRINT_INFO_ERRCODE(n,stack);
    108114        panic("stack fault\n");
    109115}
     
    113119{
    114120        reset_TS_flag();
    115         if ((CPU->fpu_owner)!=NULL) { 
    116                 fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context));
    117                 (CPU->fpu_owner)->fpu_context_engaged=0; /* don't prevent migration */
     121        if (CPU->fpu_owner != NULL) { 
     122                fpu_lazy_context_save(&CPU->fpu_owner->saved_fpu_context);
     123                /* don't prevent migration */
     124                CPU->fpu_owner->fpu_context_engaged=0;
    118125        }
    119         if(THREAD->fpu_context_exists) fpu_lazy_context_restore(&(THREAD->saved_fpu_context));
    120         else {fpu_init();THREAD->fpu_context_exists=1;}
     126        if (THREAD->fpu_context_exists)
     127                fpu_lazy_context_restore(&THREAD->saved_fpu_context);
     128        else {
     129                fpu_init();
     130                THREAD->fpu_context_exists=1;
     131        }
    121132        CPU->fpu_owner=THREAD;
    122133}
     
    126137void page_fault(__u8 n, __native stack[])
    127138{
    128         PRINT_INFO_ERRCODE(stack);
     139        PRINT_INFO_ERRCODE(n,stack);
    129140        printf("Page fault address: %Q\n", read_cr2());
    130141        panic("page fault\n");
Note: See TracChangeset for help on using the changeset viewer.