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

Changeset 4b0206c in mainline


Ignore:
Timestamp:
2016-05-04T22:35:03Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
0f17bff
Parents:
650cd22
Message:

Use macros instead of magic numbers

Location:
kernel/arch
Files:
6 edited

Legend:

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

    r650cd22 r4b0206c  
    5050#define IVT_FREEBASE  (IVT_IRQBASE + IRQ_COUNT)
    5151
     52#define EXC_DE 0
     53#define EXC_NM 7
     54#define EXC_SS 12
     55#define EXC_GP 13
     56#define EXC_PF 14
     57
    5258#define IRQ_CLK       0
    5359#define IRQ_KBD       1
     
    6571#endif
    6672
    67 #define VECTOR_DEBUG              1
     73#define VECTOR_DE                 (IVT_EXCBASE + EXC_DE)
     74#define VECTOR_NM                 (IVT_EXCBASE + EXC_NM)
     75#define VECTOR_SS                 (IVT_EXCBASE + EXC_SS)
     76#define VECTOR_GP                 (IVT_EXCBASE + EXC_GP)
     77#define VECTOR_PF                 (IVT_EXCBASE + EXC_PF)
    6878#define VECTOR_CLK                (IVT_IRQBASE + IRQ_CLK)
    6979#define VECTOR_PIC_SPUR           (IVT_IRQBASE + IRQ_PIC_SPUR)
  • kernel/arch/amd64/src/interrupt.c

    r650cd22 r4b0206c  
    222222        }
    223223       
    224         exc_register(0, "de_fault", true, (iroutine_t) de_fault);
    225         exc_register(7, "nm_fault", true, (iroutine_t) nm_fault);
    226         exc_register(12, "ss_fault", true, (iroutine_t) ss_fault);
    227         exc_register(13, "gp_fault", true, (iroutine_t) gp_fault);
     224        exc_register(VECTOR_DE, "de_fault", true, (iroutine_t) de_fault);
     225        exc_register(VECTOR_NM, "nm_fault", true, (iroutine_t) nm_fault);
     226        exc_register(VECTOR_SS, "ss_fault", true, (iroutine_t) ss_fault);
     227        exc_register(VECTOR_GP, "gp_fault", true, (iroutine_t) gp_fault);
    228228       
    229229#ifdef CONFIG_SMP
  • kernel/arch/amd64/src/mm/page.c

    r650cd22 r4b0206c  
    7272        page_table_unlock(AS_KERNEL, true);
    7373               
    74         exc_register(14, "page_fault", true, (iroutine_t) page_fault);
     74        exc_register(VECTOR_PF, "page_fault", true, (iroutine_t) page_fault);
    7575        write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
    7676}
  • kernel/arch/ia32/include/arch/interrupt.h

    r650cd22 r4b0206c  
    5050#define IVT_FREEBASE  (IVT_IRQBASE + IRQ_COUNT)
    5151
     52#define EXC_DE 0
     53#define EXC_NM 7
     54#define EXC_SS 12
     55#define EXC_GP 13
     56#define EXC_PF 14
     57#define EXC_XM 19
     58
    5259#define IRQ_CLK       0
    5360#define IRQ_KBD       1
     
    6572#endif
    6673
    67 #define VECTOR_DEBUG              1
     74#define VECTOR_DE                 (IVT_EXCBASE + EXC_DE)
     75#define VECTOR_NM                 (IVT_EXCBASE + EXC_NM)
     76#define VECTOR_SS                 (IVT_EXCBASE + EXC_SS)
     77#define VECTOR_GP                 (IVT_EXCBASE + EXC_GP)
     78#define VECTOR_PF                 (IVT_EXCBASE + EXC_PF)
     79#define VECTOR_XM                 (IVT_EXCBASE + EXC_XM)
    6880#define VECTOR_CLK                (IVT_IRQBASE + IRQ_CLK)
    6981#define VECTOR_PIC_SPUR           (IVT_IRQBASE + IRQ_PIC_SPUR)
  • kernel/arch/ia32/src/interrupt.c

    r650cd22 r4b0206c  
    229229        }
    230230       
    231         exc_register(0, "de_fault", true, (iroutine_t) de_fault);
    232         exc_register(7, "nm_fault", true, (iroutine_t) nm_fault);
    233         exc_register(12, "ss_fault", true, (iroutine_t) ss_fault);
    234         exc_register(13, "gp_fault", true, (iroutine_t) gp_fault);
    235         exc_register(19, "simd_fp", true, (iroutine_t) simd_fp_exception);
     231        exc_register(VECTOR_DE, "de_fault", true, (iroutine_t) de_fault);
     232        exc_register(VECTOR_NM, "nm_fault", true, (iroutine_t) nm_fault);
     233        exc_register(VECTOR_SS, "ss_fault", true, (iroutine_t) ss_fault);
     234        exc_register(VECTOR_GP, "gp_fault", true, (iroutine_t) gp_fault);
     235        exc_register(VECTOR_XM, "simd_fp", true, (iroutine_t) simd_fp_exception);
    236236       
    237237#ifdef CONFIG_SMP
  • kernel/arch/ia32/src/mm/page.c

    r650cd22 r4b0206c  
    7676        page_table_unlock(AS_KERNEL, true);
    7777               
    78         exc_register(14, "page_fault", true, (iroutine_t) page_fault);
     78        exc_register(VECTOR_PF, "page_fault", true, (iroutine_t) page_fault);
    7979        write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
    8080       
Note: See TracChangeset for help on using the changeset viewer.