Changeset aed1db6c in rtems for cpukit/score/cpu/arm/cpu.c


Ignore:
Timestamp:
Jun 2, 2006, 9:49:36 PM (15 years ago)
Author:
Jay Monkman <jtm@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
0eede05
Parents:
7a4b5cb4
Message:

2006-06-02 Jay Monkman <jtm@…>

  • cpu.c, cpu_asm.S: Fixed ARM Data Abort handling.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/arm/cpu.c

    r7a4b5cb4 raed1db6c  
    125125    printk("\n\r");
    126126    printk("----------------------------------------------------------\n\r");
    127 #if 0
     127#if 1
    128128    printk("Exception 0x%x caught at PC 0x%x by thread %d\n",
    129            ctx->register_pc, ctx->register_lr - 4,
     129           ctx->register_ip, ctx->register_lr - 4,
    130130           _Thread_Executing->Object.id);
    131131#endif
     
    222222#define GET_OFFSET(insn)     (insn & 0xfff)
    223223
     224char *_print_full_context_mode2txt[0x20]={
     225        [0x10]="user",  /* User */
     226        [0x11]="fiq",   /* FIQ - Fast Interrupt Request */
     227        [0x12]="irq",   /* IRQ - Interrupt Request */
     228        [0x13]="super", /* Supervisor */
     229        [0x17]="abort", /* Abort */
     230        [0x1b]="undef", /* Undefined */
     231        [0x1f]="system" /* System */
     232    };
     233
     234void _print_full_context(uint32_t spsr)
     235{
     236    char *mode;
     237    uint32_t prev_sp,prev_lr,cpsr,tmp;
     238    int i;
     239
     240    printk("active thread thread 0x%08x\n", _Thread_Executing->Object.id);
     241
     242    mode=_print_full_context_mode2txt[spsr&0x1f];
     243    if(!mode) mode="unknown";
     244
     245    asm volatile ("     MRS  %[cpsr], cpsr \n"
     246              " ORR  %[tmp], %[spsr], #0xc0 \n"
     247              " MSR  cpsr_c, %[tmp] \n"
     248              " MOV  %[prev_sp], sp \n"
     249              " MOV  %[prev_lr], lr \n"
     250              " MSR  cpsr_c, %[cpsr] \n"
     251              : [prev_sp] "=&r" (prev_sp), [prev_lr] "=&r" (prev_lr),
     252                [cpsr] "=&r" (cpsr), [tmp] "=&r" (tmp)
     253              : [spsr] "r" (spsr)
     254              : "cc");
     255
     256    printk("Previous sp=0x%08x lr=0x%08x and actual cpsr=%08x\n", prev_sp, prev_lr, cpsr);
     257
     258    for(i=0;i<48;){
     259        printk(" 0x%08x",((uint32_t*)prev_sp)[i++]);
     260        if((i%6) == 0)
     261            printk("\n");
     262    }
     263
     264}
    224265
    225266/* This function is supposed to figure out what caused the
     
    230271
    231272void do_data_abort(uint32_t   insn, uint32_t   spsr,
    232                    CPU_Exception_frame *ctx)
    233 {
     273                    Context_Control *ctx)
     274{
     275    /* Clarify, which type is correct, CPU_Exception_frame or Context_Control */
     276
    234277    uint8_t    decode;
    235278    uint8_t    insn_type;
     
    269312        printk("\n\nINSN_LDR\n");
    270313
     314#if 0
    271315        rn = GET_RN(insn);
    272316        rd = GET_RD(insn);
     
    300344            }
    301345        }
     346#endif
     347
    302348        break;
    303349    case INSN_LDRB:
     
    311357    printk("data_abort at address 0x%x, instruction: 0x%x,   spsr = 0x%x\n",
    312358           ctx->register_lr - 8, insn, spsr);
     359
     360    _print_full_context(spsr);
    313361
    314362    /* disable interrupts, wait forever */
Note: See TracChangeset for help on using the changeset viewer.