Changeset 154049e in mainline


Ignore:
Timestamp:
2005-11-05T21:11:34Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cabc62d
Parents:
dd118f0
Message:

ia64 work.
Begin implemention of heavyweight interrupt handler.
Finish implementation of interval timer.
Add some PAL macros.

Location:
arch/ia64
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • arch/ia64/Makefile.inc

    rdd118f0 r154049e  
    3535        generic/src/arch/interrupt_handler.c \
    3636        generic/src/arch/fmath.c \
    37         generic/src/arch/mm/frame.c
     37        generic/src/arch/mm/frame.c \
     38        generic/src/arch/drivers/it.c
  • arch/ia64/include/interrupt.h

    rdd118f0 r154049e  
    3333#define INTERRUPT_SPURIOUS      15
    3434
     35#define EOI     0               /**< The actual value doesn't matter. */
     36
    3537extern void external_interrupt(void);
    3638
  • arch/ia64/src/context.S

    rdd118f0 r154049e  
    5151         * So that ar.rnat can be read.
    5252         */
    53         movl loc5 = ~3
    54         and loc5 = loc3, loc5
     53        and loc5 = ~3, loc3
    5554        mov ar.rsc = loc5
    5655        mov loc5 = ar.rnat
  • arch/ia64/src/ia64.c

    rdd118f0 r154049e  
    2929#include <arch.h>
    3030#include <arch/ski/ski.h>
    31 #include <arch/asm.h>
    32 #include <arch/register.h>
    33 #include <arch/barrier.h>
    34 #include <arch/interrupt.h>
    35 
    36 /** TODO: read ticks per second from firmware */
    37 #define IT_DELTA        50000000
     31#include <arch/drivers/it.h>
    3832
    3933void arch_pre_mm_init(void)
    4034{
    4135        ski_init_console();
     36        it_init();
    4237}
    4338
    4439void arch_post_mm_init(void)
    4540{
    46         cr_itv_t itv;
    47 
    48         /* initialize Interval Timer external interrupt vector */
    49         itv.value = itv_read();
    50         itv.vector = INTERRUPT_TIMER;
    51         itv.m = 0;
    52         itv_write(itv.value);
    53         srlz_d();
    54 
    55         /* set Interval Timer Counter to zero */
    56         itc_write(0);
    57         srlz_d();
    58        
    59         /* generate first Interval Timer interrupt in IT_DELTA ticks */
    60         itm_write(IT_DELTA);
    61         srlz_d();
    6241}
  • arch/ia64/src/interrupt.c

    rdd118f0 r154049e  
    3535#include <arch/barrier.h>
    3636#include <arch/register.h>
     37#include <arch/drivers/it.h>
    3738#include <arch.h>
    3839
     
    4647        switch(ivr.vector) {
    4748            case INTERRUPT_TIMER:
     49                it_interrupt();
    4850                panic("cpu%d: timer interrupt\n", CPU->id);
    4951                break;
  • arch/ia64/src/ivt.S

    rdd118f0 r154049e  
    2828
    2929
    30 
     30/*
     31 * This macro roughly follows steps from 1 to 19 described in
     32 * Intel Itanium Architecture Software Developer's Manual, Chapter 3.4.2.
     33 *
     34 * Some steps are skipped (enabling and disabling interrupts).
     35 * Some steps are not fully supported yet (e.g. interruptions
     36 * from user space and floating-point context).
     37 */
     38.macro HEAVYWEIGHT_HANDLER offs handler
     39    .org IVT + \offs
     40        SAVE_INTERRUPTED_CONTEXT                /* steps 1 - 9 */
     41        br.call.sptk.many rp = \handler         /* steps 10 - 11 */
     42        br restore_interrupted_context          /* steps 12 - 19 */
     43.endm
     44
     45.macro SAVE_INTERRUPTED_CONTEXT
     46    /* 1. copy interrupt registers into bank 0 */
     47        mov r24 = cr.iip
     48        mov r25 = cr.ipsr
     49        mov r26 = cr.iipa
     50        mov r27 = cr.isr
     51        mov r28 = cr.ifa
     52       
     53    /* 2. preserve predicate register into bank 0 */
     54        mov r29 = pr ;;
     55       
     56        /* 3. switch to kernel memory stack */
     57        /* TODO: support interruptions from userspace */
     58        /* assume kernel stack */
     59       
     60    /* 4. allocate memory stack for registers saved in bank 0 */
     61        st8 [r12] = r29, -8 ;;  /* save predicate registers */
     62        st8 [r12] = r28, -8 ;;  /* save cr.ifa */
     63        st8 [r12] = r27, -8 ;;  /* save cr.isr */
     64        st8 [r12] = r26, -8 ;;  /* save cr.iipa */
     65        st8 [r12] = r25, -8 ;;  /* save cr.ipsr */
     66        st8 [r12] = r24, -8 ;;  /* save cr.iip */
     67       
     68    /* 5. RSE switch */
     69        .auto
     70        mov r24 = ar.rsc
     71        mov r25 = ar.pfs
     72        cover
     73        mov r26 = cr.ifs
     74       
     75        st8 [r12] = r24, -8     /* save ar.rsc */
     76        st8 [r12] = r25, -8     /* save ar.pfs */
     77        st8 [r12] = r26, -8     /* save ar.ifs */
     78       
     79        and r30 = ~3, r24
     80        mov ar.rsc = r30        /* place RSE in enforced lazy mode */
     81       
     82        mov r27 = ar.rnat
     83        mov r28 = ar.bspstore
     84       
     85        /* assume kernel backing store */
     86        mov ar.bspstore = r28
     87       
     88        mov r29 = ar.bsp
     89       
     90        st8 [r12] = r27, -8     /* save ar.rnat */
     91        st8 [r12] = r28, -8     /* save ar.bspstore */
     92        st8 [r12] = r29, -8     /* save ar.bsp */
     93       
     94        mov ar.rsc = r24        /* restore RSE's setting */
     95        .explicit
     96       
     97    /* 6. switch to bank 1 and reenable PSR.ic */
     98        ssm 0x2000
     99        bsw.1 ;;
     100        srlz.d
     101       
     102    /* 7. preserve branch and application registers */
     103       
     104    /* 8. preserve general and floating-point registers */
     105        /* TODO: save floating-point context */
     106       
     107    /* 9. skipped (will not enable interrupts) */
     108.endm
     109
     110.macro RESTORE_INTERRUPTED_CONTEXT
     111    /* 12. skipped (will not disable interrupts) */
     112       
     113    /* 13. restore general and floating-point registers */
     114        /* TODO: restore floating-point context */
     115       
     116    /* 14. restore branch and application registers */
     117       
     118    /* 15. disable PSR.ic and switch to bank 0 */
     119        rsm 0x2000
     120        bsw.0 ;;
     121        srlz.d
     122       
     123    /* 16. RSE switch */
     124       
     125    /* 17. restore interruption state from memory stack */
     126       
     127    /* 18. restore predicate registers from memory stack */
     128       
     129    /* 19. return from interruption */
     130        rfi
     131.endm
     132
     133.global restore_interrupted_context
     134restore_interrupted_context:
     135        RESTORE_INTERRUPTED_CONTEXT
     136        /* not reached */
    31137
    32138dump_gregs:
     
    386492Handler2 0x2800
    387493Handler 0x2c00 break_instruction
    388 Handler 0x3000 external_interrupt
     494HEAVYWEIGHT_HANDLER 0x3000 external_interrupt   /* For external interrupt, heavyweight handler is used. */
    389495Handler2 0x3400
    390496Handler2 0x3800
Note: See TracChangeset for help on using the changeset viewer.