Changeset 25d7709 in mainline for arch/ia32/src


Ignore:
Timestamp:
2006-03-13T20:08:16Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
631ca4d
Parents:
45d6add
Message:

Nicer ia32 interrupt handlers and structures holding interrupted context data.
Unify the name holding interrupted context data on all architectures to be istate.

Location:
arch/ia32/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/asm.S

    r45d6add r25d7709  
    7979#
    8080.macro handler i n
    81         push %ebp
    82         movl %esp,%ebp
     81        push %eax
     82
     83        # Test if this is interrupt with error word or not
     84        movl $(1<<\i), %eax
     85        andl $ERROR_WORD_INTERRUPT_LIST,%eax
     86
     87        /*
     88         * If this interrupt/exception  stores error word,
     89         * we need to pop EAX.
     90         * If this interrupt doesn't store error word, we emulate it
     91         * for the sake of consistent pstate structure. In that case
     92         * we merely leave the EAX on the stack.
     93         */
     94        jz 0f
     95
     96        /*
     97         * This exception stores error word.
     98         */
     99        pop %eax
     100        jmp 1f
     101
     1020:
     103        /*
     104         * This interrupt doesn't store error word.
     105         * Just restore EAX without doing POP.
     106         */
     107        movl (%esp), %eax
     108
     1091:
    83110        pusha
    84 
     111        movl %esp, %ebp
    85112        push %ds
    86113        push %es
     
    93120        movl $(\i),%edi
    94121        pushl %ebp
    95         addl $4,(%esp)
    96122        pushl %edi
    97123        call exc_dispatch
     
    101127        pop %ds
    102128
    103 
    104 # CLNT
     129# Clear Nested Task flag.
    105130        pushfl
    106131        pop %eax
     
    109134        popfl
    110135       
    111 
    112 
    113 # Test if this is interrupt with error word or not
    114         mov $\i,%cl
    115         movl $1,%eax
    116         test $0xe0,%cl
    117         jnz 0f
    118         and $0x1f,%cl
    119         shl %cl,%eax
    120         and $ERROR_WORD_INTERRUPT_LIST,%eax
    121         jz 0f
    122 
    123 
    124 # Return with error word
    125136        popa
    126         pop %ebp
    127         add $4,%esp     # Skip error word
    128         iret
    129 
    130 0:
    131 # Return with no error word
    132         popa
    133         pop %ebp
     137        add $4,%esp     # Skip error word, whether real or fake.
    134138        iret
    135139
  • arch/ia32/src/drivers/i8254.c

    r45d6add r25d7709  
    5454#define MAGIC_NUMBER    1194
    5555
    56 static void i8254_interrupt(int n, void *stack);
     56static void i8254_interrupt(int n, istate_t *istate);
    5757
    5858void i8254_init(void)
     
    6868        outb(CLK_PORT1, (CLK_CONST/HZ) >> 8);
    6969        pic_enable_irqs(1<<IRQ_CLK);
    70         exc_register(VECTOR_CLK, "i8254_clock", i8254_interrupt);
     70        exc_register(VECTOR_CLK, "i8254_clock", (iroutine) i8254_interrupt);
    7171}
    7272
     
    126126}
    127127
    128 void i8254_interrupt(int n, void *stack)
     128void i8254_interrupt(int n, istate_t *istate)
    129129{
    130130        trap_virtual_eoi();
  • arch/ia32/src/drivers/i8259.c

    r45d6add r25d7709  
    4040 */
    4141
    42 static void pic_spurious(int n, void *stack);
     42static void pic_spurious(int n, istate_t *istate);
    4343
    4444void i8259_init(void)
     
    7171         * Register interrupt handler for the PIC spurious interrupt.
    7272         */
    73         exc_register(VECTOR_PIC_SPUR, "pic_spurious", pic_spurious);   
     73        exc_register(VECTOR_PIC_SPUR, "pic_spurious", (iroutine) pic_spurious);
    7474
    7575        /*
     
    119119}
    120120
    121 void pic_spurious(int n, void *stack)
     121void pic_spurious(int n, istate_t *istate)
    122122{
    123123        printf("cpu%d: PIC spurious interrupt\n", CPU->id);
  • arch/ia32/src/ia32.c

    r45d6add r25d7709  
    6161                i8254_init();   /* hard clock */
    6262               
    63                 exc_register(VECTOR_SYSCALL, "syscall", syscall);
     63                exc_register(VECTOR_SYSCALL, "syscall", (iroutine) syscall);
    6464               
    6565                #ifdef CONFIG_SMP
    6666                exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown",
    67                              tlb_shootdown_ipi);
     67                             (iroutine) tlb_shootdown_ipi);
    6868                #endif /* CONFIG_SMP */
    6969        }
  • arch/ia32/src/interrupt.c

    r45d6add r25d7709  
    5050void (* eoi_function)(void) = NULL;
    5151
    52 #define PRINT_INFO_ERRCODE(st) { \
    53         __native *x = (__native *) st; \
    54         char *symbol = get_symtab_entry(x[1]); \
     52#define PRINT_INFO_ERRCODE(istate) do { \
     53        char *symbol = get_symtab_entry(istate->eip); \
    5554        if (!symbol) \
    5655                symbol = ""; \
    5756        printf("----------------EXCEPTION OCCURED----------------\n"); \
    58         printf("%%eip: %X (%s)\n",x[1],symbol); \
    59         printf("ERROR_WORD=%X\n", x[0]); \
    60         printf("%%cs=%X,flags=%X\n", x[2], x[3]); \
     57        printf("%%eip: %X (%s)\n",istate->eip,symbol); \
     58        printf("ERROR_WORD=%X\n", istate->error_word); \
     59        printf("%%cs=%X,flags=%X\n", istate->cs, istate->eflags); \
    6160        printf("%%eax=%X, %%ebx=%X, %%ecx=%X, %%edx=%X\n",\
    62                x[-2],x[-5],x[-3],x[-4]); \
     61               istate->eax,istate->ebx,istate->ecx,istate->edx); \
    6362        printf("%%esi=%X, %%edi=%X, %%ebp=%X, %%esp=%X\n",\
    64                x[-8],x[-9],x[-1],x); \
    65         printf("stack: %X, %X, %X, %X\n", x[4], x[5], x[6], x[7]); \
    66         printf("       %X, %X, %X, %X\n", x[8], x[9], x[10], x[11]); \
    67         }
     63               istate->esi,istate->edi,istate->ebp,istate->esp); \
     64        printf("stack: %X, %X, %X, %X\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]); \
     65        printf("       %X, %X, %X, %X\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]); \
     66} while(0)
    6867
    69 void null_interrupt(int n, void *st)
     68void null_interrupt(int n, istate_t *istate)
    7069{
    71         __native *stack = (__native *) st;
    72 
    73         printf("int %d: null_interrupt\n", n);
    74         printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
    75         panic("unserviced interrupt\n");
     70        PRINT_INFO_ERRCODE(istate);
     71        panic("unserviced interrupt: %d\n", n);
    7672}
    7773
    78 void gp_fault(int n, void *stack)
     74void gp_fault(int n, istate_t *istate)
    7975{
    80         PRINT_INFO_ERRCODE(stack);
     76        PRINT_INFO_ERRCODE(istate);
    8177        panic("general protection fault\n");
    8278}
    8379
    84 void ss_fault(int n, void *stack)
     80void ss_fault(int n, istate_t *istate)
    8581{
    86         PRINT_INFO_ERRCODE(stack);
     82        PRINT_INFO_ERRCODE(istate);
    8783        panic("stack fault\n");
    8884}
    8985
    90 
    91 void nm_fault(int n, void *stack)
     86void nm_fault(int n, istate_t *istate)
    9287{
    9388#ifdef CONFIG_FPU_LAZY     
     
    9893}
    9994
    100 
    101 
    102 void page_fault(int n, void *stack)
     95void page_fault(int n, istate_t *istate)
    10396{
    10497        __address page;
     
    10699        page = read_cr2();
    107100        if (!as_page_fault(page)) {
    108                 PRINT_INFO_ERRCODE(stack);
     101                PRINT_INFO_ERRCODE(istate);
    109102                printf("page fault address: %X\n", page);
    110103                panic("page fault\n");
     
    112105}
    113106
    114 void syscall(int n, void *st)
     107void syscall(int n, istate_t *istate)
    115108{
    116         __native *stack = (__native *) st;
    117 
    118109        interrupts_enable();
    119         if (stack[-2] < SYSCALL_END)
    120                 stack[-2] = syscall_table[stack[-2]](stack[-5], stack[-3], stack[-4]);
     110        if (istate->edx < SYSCALL_END)
     111                istate->eax = syscall_table[istate->edx](istate->eax, istate->ebx, istate->ecx);
    121112        else
    122                 panic("Undefined syscall %d", stack[-2]);
     113                panic("Undefined syscall %d", istate->edx);
    123114        interrupts_disable();
    124115}
    125116
    126 void tlb_shootdown_ipi(int n, void *stack)
     117void tlb_shootdown_ipi(int n, istate_t *istate)
    127118{
    128119        trap_virtual_eoi();
  • arch/ia32/src/mm/page.c

    r45d6add r25d7709  
    6161                }
    6262
    63                 exc_register(14, "page_fault", page_fault);
     63                exc_register(14, "page_fault", (iroutine) page_fault);
    6464                write_cr3((__address) AS_KERNEL->page_table);
    6565        }
  • arch/ia32/src/pm.c

    r45d6add r25d7709  
    126126               
    127127                idt_setoffset(d, ((__address) interrupt_handlers) + i*interrupt_handler_size);
    128                 exc_register(i, "undef", null_interrupt);
     128                exc_register(i, "undef", (iroutine) null_interrupt);
    129129        }
    130         exc_register(13, "gp_fault", gp_fault);
    131         exc_register( 7, "nm_fault", nm_fault);
    132         exc_register(12, "ss_fault", ss_fault);
     130        exc_register(13, "gp_fault", (iroutine) gp_fault);
     131        exc_register( 7, "nm_fault", (iroutine) nm_fault);
     132        exc_register(12, "ss_fault", (iroutine) ss_fault);
    133133}
    134134
  • arch/ia32/src/smp/apic.c

    r45d6add r25d7709  
    113113
    114114
    115 static void apic_spurious(int n, void *stack);
    116 static void l_apic_timer_interrupt(int n, void *stack);
     115static void apic_spurious(int n, istate_t *istate);
     116static void l_apic_timer_interrupt(int n, istate_t *istate);
    117117
    118118/** Initialize APIC on BSP. */
     
    122122        int i;
    123123
    124         exc_register(VECTOR_APIC_SPUR, "apic_spurious", apic_spurious);
     124        exc_register(VECTOR_APIC_SPUR, "apic_spurious", (iroutine) apic_spurious);
    125125
    126126        enable_irqs_function = io_apic_enable_irqs;
     
    134134         */
    135135        io_apic_disable_irqs(0xffff);
    136         exc_register(VECTOR_CLK, "l_apic_timer", l_apic_timer_interrupt);
     136        exc_register(VECTOR_CLK, "l_apic_timer", (iroutine) l_apic_timer_interrupt);
    137137        for (i = 0; i < IRQ_COUNT; i++) {
    138138                int pin;
     
    170170 * @param stack Interrupted stack.
    171171 */
    172 void apic_spurious(int n, void *stack)
     172void apic_spurious(int n, istate_t *istate)
    173173{
    174174        printf("cpu%d: APIC spurious interrupt\n", CPU->id);
     
    428428 * @param stack Interrupted stack.
    429429 */
    430 void l_apic_timer_interrupt(int n, void *stack)
     430void l_apic_timer_interrupt(int n, istate_t *istate)
    431431{
    432432        l_apic_eoi();
Note: See TracChangeset for help on using the changeset viewer.