Changeset fcfac420 in mainline


Ignore:
Timestamp:
2005-12-10T01:02:31Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6095342
Parents:
973be64e
Message:

Changed ia32 & amd64 to use exc_register instead of trap_register.

Fixed dependency list building. I hope you all have 'makedepend' installed,
if you don't it's time to install it, as CC -M builds the dependency
list without directory names..and it just does not work.

Files:
20 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r973be64e rfcfac420  
    164164
    165165clean:
    166         -rm -f kernel.bin kernel.raw kernel.map kernel.map.pre kernel.objdump kernel.disasm generic/src/debug/real_map.bin Makefile.depend generic/include/arch generic/include/genarch arch/$(ARCH)/_link.ld
     166        -rm -f kernel.bin kernel.raw kernel.map kernel.map.pre kernel.objdump kernel.disasm generic/src/debug/real_map.bin Makefile.depend* generic/include/arch generic/include/genarch arch/$(ARCH)/_link.ld
    167167        find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
    168168        for arch in arch/*; do \
     
    175175        ln -sfn ../../genarch/include/ generic/include/genarch
    176176
    177 depend: archlinks
    178         $(CC) $(DEFS) $(CFLAGS) -M $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend
     177depend: archlinks Makefile.depend
     178
     179Makefile.depend:
     180        -makedepend $(DEFS) $(CFLAGS) -f - $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) >Makefile.depend 2>/dev/null
     181        #$(CC) $(DEFS) $(CFLAGS) -M $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend
    179182
    180183arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
  • arch/amd64/src/amd64.c

    r973be64e rfcfac420  
    4545#include <genarch/acpi/acpi.h>
    4646#include <panic.h>
     47#include <interrupt.h>
    4748
    4849void arch_pre_mm_init(void)
     
    7374                i8254_init();   /* hard clock */
    7475
    75                 trap_register(VECTOR_SYSCALL, syscall);
     76                exc_register(VECTOR_SYSCALL, "syscall", syscall);
    7677               
    7778                #ifdef CONFIG_SMP
    78                 trap_register(VECTOR_TLB_SHOOTDOWN_IPI, tlb_shootdown_ipi);
    79                 trap_register(VECTOR_WAKEUP_IPI, wakeup_ipi);
     79                exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown",
     80                             tlb_shootdown_ipi);
     81                exc_register(VECTOR_WAKEUP_IPI, "wakeup_ipi", wakeup_ipi);
    8082                #endif /* CONFIG_SMP */
    8183        }
  • arch/amd64/src/asm_utils.S

    r973be64e rfcfac420  
    160160#
    161161# The handlers setup data segment registers
    162 # and call trap_dispatcher().
     162# and call exc_dispatch().
    163163#
    164164.macro handler i n
     
    171171        movq %rbp, %rsi
    172172        addq $8, %rsi     # %rsi - second parameter - original stack
    173         call trap_dispatcher    # trap_dispatcher(i, stack)
     173        call exc_dispatch       # exc_dispatch(i, stack)
    174174
    175175# Test if this is interrupt with error word or not
  • arch/amd64/src/interrupt.c

    r973be64e rfcfac420  
    5858}
    5959
    60 static void print_info_errcode(__u8 n, __native x[])
     60static void print_info_errcode(int n, void *st)
    6161{
    6262        char *symbol;
     63        __native *x = (__native *) st;
    6364
    6465        if (!(symbol=get_symtab_entry(x[1])))
     
    8990 */
    9091
    91 static iroutine ivt[IVT_ITEMS];
    92 
    9392void (* disable_irqs_function)(__u16 irqmask) = NULL;
    9493void (* enable_irqs_function)(__u16 irqmask) = NULL;
    9594void (* eoi_function)(void) = NULL;
    9695
    97 iroutine trap_register(__u8 n, iroutine f)
     96void null_interrupt(int n, void *st)
    9897{
    99         ASSERT(n < IVT_ITEMS);
    100        
    101         iroutine old;
    102        
    103         old = ivt[n];
    104         ivt[n] = f;
    105        
    106         return old;
    107 }
     98        __native *stack = (__native *) st;
    10899
    109 /*
    110  * Called directly from the assembler code.
    111  * CPU is interrupts_disable()'d.
    112  */
    113 void trap_dispatcher(__u8 n, __native stack[])
    114 {
    115         ASSERT(n < IVT_ITEMS);
    116        
    117         ivt[n](n, stack);
    118 }
    119 
    120 void null_interrupt(__u8 n, __native stack[])
    121 {
    122100        printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n,__FUNCTION__); \
    123101        printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
     
    125103}
    126104
    127 void gp_fault(__u8 n, __native stack[])
     105void gp_fault(int n, void *stack)
    128106{
    129107        print_info_errcode(n,stack);
     
    131109}
    132110
    133 void ss_fault(__u8 n, __native stack[])
     111void ss_fault(int n, void *stack)
    134112{
    135113        print_info_errcode(n,stack);
     
    138116
    139117
    140 void nm_fault(__u8 n, __native stack[])
     118void nm_fault(int n, void *stack)
    141119{
    142120#ifdef CONFIG_FPU_LAZY     
     
    149127
    150128
    151 void page_fault(__u8 n, __native stack[])
     129void page_fault(int n, void *stack)
    152130{
    153131        print_info_errcode(n,stack);
     
    156134}
    157135
    158 void syscall(__u8 n, __native stack[])
     136void syscall(int n, void *stack)
    159137{
    160138        printf("cpu%d: syscall\n", CPU->id);
     
    162140}
    163141
    164 void tlb_shootdown_ipi(__u8 n, __native stack[])
     142void tlb_shootdown_ipi(int n, void *stack)
    165143{
    166144        trap_virtual_eoi();
     
    168146}
    169147
    170 void wakeup_ipi(__u8 n, __native stack[])
     148void wakeup_ipi(int n, void *stack)
    171149{
    172150        trap_virtual_eoi();
  • arch/amd64/src/mm/page.c

    r973be64e rfcfac420  
    3535#include <config.h>
    3636#include <memstr.h>
     37#include <interrupt.h>
    3738
    3839static __address bootstrap_dba;
     
    5657                }
    5758
    58                 trap_register(14, page_fault);
     59                exc_register(14, "page_fault", page_fault);
    5960                write_cr3(KA2PA(dba));
    6061        }
  • arch/amd64/src/pm.c

    r973be64e rfcfac420  
    3232#include <arch/interrupt.h>
    3333#include <arch/asm.h>
     34#include <interrupt.h>
    3435
    3536#include <config.h>
     
    175176               
    176177                idt_setoffset(d, ((__address) interrupt_handlers) + i*interrupt_handler_size);
    177                 trap_register(i, null_interrupt);
     178                exc_register(i, "undef", null_interrupt);
    178179        }
    179         trap_register(13, gp_fault);
    180         trap_register( 7, nm_fault);
    181         trap_register(12, ss_fault);   
     180        exc_register(13, "gp_fault", gp_fault);
     181        exc_register( 7, "nm_fault", nm_fault);
     182        exc_register(12, "ss_fault", ss_fault);
    182183}
    183184
  • arch/ia32/include/i8042.h

    r973be64e rfcfac420  
    4040
    4141extern void i8042_init(void);
    42 extern void i8042_interrupt(__u8 n, __native stack[]);
    4342
    4443#endif
  • arch/ia32/include/i8254.h

    r973be64e rfcfac420  
    3333
    3434extern void i8254_init(void);
    35 extern void i8254_interrupt(__u8 n, __native stack[]);
    3635extern void i8254_calibrate_delay_loop(void);
    3736extern void i8254_normal_operation(void);
  • arch/ia32/include/i8259.h

    r973be64e rfcfac420  
    4545extern void pic_disable_irqs(__u16 irqmask);
    4646extern void pic_eoi(void);
    47 extern void pic_spurious(__u8 n, __native stack[]);
    4847
    4948#endif
  • arch/ia32/include/interrupt.h

    r973be64e rfcfac420  
    2727 */
    2828
    29 #ifndef __INTERRUPT_H__
    30 #define __INTERRUPT_H__
     29#ifndef __ia32_INTERRUPT_H__
     30#define __ia32_INTERRUPT_H__
    3131
    3232#include <arch/types.h>
     
    6262#define VECTOR_WAKEUP_IPI               (IVT_FREEBASE+2)
    6363
    64 typedef void (* iroutine)(__u8 n, __native stack[]);
    65 
    6664extern void (* disable_irqs_function)(__u16 irqmask);
    6765extern void (* enable_irqs_function)(__u16 irqmask);
    6866extern void (* eoi_function)(void);
    6967
    70 extern iroutine trap_register(__u8 n, iroutine f);
    71 
    72 extern void trap_dispatcher(__u8 n, __native stack[]);
    73 
    74 extern void null_interrupt(__u8 n, __native stack[]);
    75 extern void gp_fault(__u8 n, __native stack[]);
    76 extern void nm_fault(__u8 n, __native stack[]);
    77 extern void ss_fault(__u8 n, __native stack[]);
    78 extern void page_fault(__u8 n, __native stack[]);
    79 extern void syscall(__u8 n, __native stack[]);
    80 extern void tlb_shootdown_ipi(__u8 n, __native stack[]);
    81 extern void wakeup_ipi(__u8 n, __native stack[]);
     68extern void null_interrupt(int n, void *stack);
     69extern void gp_fault(int n, void *stack);
     70extern void nm_fault(int n, void *stack);
     71extern void ss_fault(int n, void *stack);
     72extern void page_fault(int n, void *stack);
     73extern void syscall(int n, void *stack);
     74extern void tlb_shootdown_ipi(int n, void *stack);
     75extern void wakeup_ipi(int n, void *stack);
    8276
    8377extern void trap_virtual_enable_irqs(__u16 irqmask);
  • arch/ia32/include/smp/apic.h

    r973be64e rfcfac420  
    312312
    313313extern void apic_init(void);
    314 extern void apic_spurious(__u8 n, __native stack[]);
    315314
    316315extern void l_apic_init(void);
     
    319318extern int l_apic_send_init_ipi(__u8 apicid);
    320319extern void l_apic_debug(void);
    321 extern void l_apic_timer_interrupt(__u8 n, __native stack[]);
    322320extern __u8 l_apic_id(void);
    323321
  • arch/ia32/src/asm.S

    r973be64e rfcfac420  
    7676#
    7777# The handlers setup data segment registers
    78 # and call trap_dispatcher().
     78# and call exc_dispatch().
    7979#
    8080.macro handler i n
     
    9595        addl $4,(%esp)
    9696        pushl %edi
    97         call trap_dispatcher
     97        call exc_dispatch
    9898        addl $8,%esp
    9999
  • arch/ia32/src/drivers/i8042.c

    r973be64e rfcfac420  
    3939#include <console/console.h>
    4040#include <macros.h>
     41#include <interrupt.h>
    4142
    4243/**
     
    236237};
    237238
     239static void i8042_interrupt(int n, void *stack);
     240
    238241/** Initialize i8042. */
    239242void i8042_init(void)
    240243{
    241         trap_register(VECTOR_KBD, i8042_interrupt);
     244        exc_register(VECTOR_KBD, "i8042_interrupt", i8042_interrupt);
    242245        trap_virtual_enable_irqs(1<<IRQ_KBD);
    243246        spinlock_initialize(&keylock, "i8042_lock");
     
    251254 * @param stack Interrupted stack.
    252255 */
    253 void i8042_interrupt(__u8 n, __native stack[])
     256void i8042_interrupt(int n, void *stack)
    254257{
    255258        __u8 x;
  • arch/ia32/src/drivers/i8254.c

    r973be64e rfcfac420  
    4040#include <arch.h>
    4141#include <time/delay.h>
     42#include <interrupt.h>
    4243
    4344/*
     
    5354#define MAGIC_NUMBER    1194
    5455
     56static void i8254_interrupt(int n, void *stack);
     57
    5558void i8254_init(void)
    5659{
     
    6568        outb(CLK_PORT1, (CLK_CONST/HZ) >> 8);
    6669        pic_enable_irqs(1<<IRQ_CLK);
    67         trap_register(VECTOR_CLK, i8254_interrupt);
     70        exc_register(VECTOR_CLK, "i8254_clock", i8254_interrupt);
    6871}
    6972
     
    123126}
    124127
    125 void i8254_interrupt(__u8 n, __native stack[])
     128void i8254_interrupt(int n, void *stack)
    126129{
    127130        trap_virtual_eoi();
  • arch/ia32/src/drivers/i8259.c

    r973be64e rfcfac420  
    3333#include <arch.h>
    3434#include <print.h>
     35#include <interrupt.h>
    3536
    3637/*
     
    3839 * Programmable Interrupt Controller for UP systems.
    3940 */
     41
     42static void pic_spurious(int n, void *stack);
    4043
    4144void i8259_init(void)
     
    6871         * Register interrupt handler for the PIC spurious interrupt.
    6972         */
    70         trap_register(VECTOR_PIC_SPUR, pic_spurious);   
     73        exc_register(VECTOR_PIC_SPUR, "pic_spurious", pic_spurious);   
    7174
    7275        /*
     
    116119}
    117120
    118 void pic_spurious(__u8 n, __native stack[])
     121void pic_spurious(int n, void *stack)
    119122{
    120123        printf("cpu%d: PIC spurious interrupt\n", CPU->id);
  • arch/ia32/src/ia32.c

    r973be64e rfcfac420  
    5050
    5151#include <arch/mm/memory_init.h>
     52#include <interrupt.h>
    5253
    5354void arch_pre_mm_init(void)
     
    6061                i8254_init();   /* hard clock */
    6162               
    62                 trap_register(VECTOR_SYSCALL, syscall);
     63                exc_register(VECTOR_SYSCALL, "syscall", syscall);
    6364               
    6465                #ifdef CONFIG_SMP
    65                 trap_register(VECTOR_TLB_SHOOTDOWN_IPI, tlb_shootdown_ipi);
    66                 trap_register(VECTOR_WAKEUP_IPI, wakeup_ipi);
     66                exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown",
     67                             tlb_shootdown_ipi);
     68                exc_register(VECTOR_WAKEUP_IPI, "wakeup_ipi", wakeup_ipi);
    6769                #endif /* CONFIG_SMP */
    6870        }
  • arch/ia32/src/interrupt.c

    r973be64e rfcfac420  
    4444 */
    4545
    46 static iroutine ivt[IVT_ITEMS];
    47 
    4846void (* disable_irqs_function)(__u16 irqmask) = NULL;
    4947void (* enable_irqs_function)(__u16 irqmask) = NULL;
    5048void (* eoi_function)(void) = NULL;
    5149
    52 #define PRINT_INFO_ERRCODE(x) { \
    53         char *symbol = get_symtab_entry(stack[1]); \
     50#define PRINT_INFO_ERRCODE(st) { \
     51        __native *x = (__native *) st; \
     52        char *symbol = get_symtab_entry(x[1]); \
    5453        if (!symbol) \
    5554                symbol = ""; \
     
    6665        }
    6766
    68 iroutine trap_register(__u8 n, iroutine f)
     67void null_interrupt(int n, void *st)
    6968{
    70         ASSERT(n < IVT_ITEMS);
    71        
    72         iroutine old;
    73        
    74         old = ivt[n];
    75         ivt[n] = f;
    76        
    77         return old;
    78 }
     69        __native *stack = (__native *) st;
    7970
    80 /*
    81  * Called directly from the assembler code.
    82  * CPU is interrupts_disable()'d.
    83  */
    84 void trap_dispatcher(__u8 n, __native stack[])
    85 {
    86         ASSERT(n < IVT_ITEMS);
    87        
    88         ivt[n](n, stack);
    89 }
    90 
    91 void null_interrupt(__u8 n, __native stack[])
    92 {
    9371        printf("int %d: null_interrupt\n", n);
    9472        printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
     
    9674}
    9775
    98 void gp_fault(__u8 n, __native stack[])
     76void gp_fault(int n, void *stack)
    9977{
    10078        PRINT_INFO_ERRCODE(stack);
     
    10280}
    10381
    104 void ss_fault(__u8 n, __native stack[])
     82void ss_fault(int n, void *stack)
    10583{
    10684        PRINT_INFO_ERRCODE(stack);
     
    10987
    11088
    111 void nm_fault(__u8 n, __native stack[])
     89void nm_fault(int n, void *stack)
    11290{
    11391#ifdef CONFIG_FPU_LAZY     
     
    12098
    12199
    122 void page_fault(__u8 n, __native stack[])
     100void page_fault(int n, void *stack)
    123101{
    124102        PRINT_INFO_ERRCODE(stack);
     
    127105}
    128106
    129 void syscall(__u8 n, __native stack[])
     107void syscall(int n, void *stack)
    130108{
    131109        printf("cpu%d: syscall\n", CPU->id);
     
    133111}
    134112
    135 void tlb_shootdown_ipi(__u8 n, __native stack[])
     113void tlb_shootdown_ipi(int n, void *stack)
    136114{
    137115        trap_virtual_eoi();
     
    139117}
    140118
    141 void wakeup_ipi(__u8 n, __native stack[])
     119void wakeup_ipi(int n, void *stack)
    142120{
    143121        trap_virtual_eoi();
  • arch/ia32/src/mm/page.c

    r973be64e rfcfac420  
    4040#include <memstr.h>
    4141#include <print.h>
     42#include <interrupt.h>
    4243
    4344static __address bootstrap_dba;
     
    6061                        page_mapping_insert(PA2KA(cur), cur, PAGE_CACHEABLE, KA2PA(dba));
    6162
    62                 trap_register(14, page_fault);
     63                exc_register(14, "page_fault", page_fault);
    6364                write_cr3(KA2PA(dba));
    6465        }
  • arch/ia32/src/pm.c

    r973be64e rfcfac420  
    3939#include <memstr.h>
    4040#include <arch/boot/boot.h>
     41#include <interrupt.h>
    4142
    4243/*
     
    125126               
    126127                idt_setoffset(d, ((__address) interrupt_handlers) + i*interrupt_handler_size);
    127                 trap_register(i, null_interrupt);
     128                exc_register(i, "undef", null_interrupt);
    128129        }
    129         trap_register(13, gp_fault);
    130         trap_register( 7, nm_fault);
    131         trap_register(12, ss_fault);
     130        exc_register(13, "gp_fault", gp_fault);
     131        exc_register( 7, "nm_fault", nm_fault);
     132        exc_register(12, "ss_fault", ss_fault);
    132133}
    133134
  • arch/ia32/src/smp/apic.c

    r973be64e rfcfac420  
    3333#include <mm/page.h>
    3434#include <time/delay.h>
     35#include <interrupt.h>
    3536#include <arch/interrupt.h>
    3637#include <print.h>
     
    109110#endif /* LAPIC_VERBOSE */
    110111
     112
     113static void apic_spurious(int n, void *stack);
     114static void l_apic_timer_interrupt(int n, void *stack);
     115
    111116/** Initialize APIC on BSP. */
    112117void apic_init(void)
     
    115120        int i;
    116121
    117         trap_register(VECTOR_APIC_SPUR, apic_spurious);
     122        exc_register(VECTOR_APIC_SPUR, "apic_spurious", apic_spurious);
    118123
    119124        enable_irqs_function = io_apic_enable_irqs;
     
    127132         */
    128133        io_apic_disable_irqs(0xffff);
    129         trap_register(VECTOR_CLK, l_apic_timer_interrupt);
     134        exc_register(VECTOR_CLK, "l_apic_timer", l_apic_timer_interrupt);
    130135        for (i = 0; i < IRQ_COUNT; i++) {
    131136                int pin;
     
    163168 * @param stack Interrupted stack.
    164169 */
    165 void apic_spurious(__u8 n, __native stack[])
     170void apic_spurious(int n, void *stack)
    166171{
    167172        printf("cpu%d: APIC spurious interrupt\n", CPU->id);
     
    402407 * @param stack Interrupted stack.
    403408 */
    404 void l_apic_timer_interrupt(__u8 n, __native stack[])
     409void l_apic_timer_interrupt(int n, void *stack)
    405410{
    406411        l_apic_eoi();
Note: See TracChangeset for help on using the changeset viewer.