Changeset d8ada5b in rtems


Ignore:
Timestamp:
Dec 2, 2005, 2:47:23 AM (14 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
0ed348f
Parents:
5b8eb3f0
Message:

2005-12-01 Till Straumann <strauman@…>

  • shared/vectors/vectors.h, shared/vectors/vectors.S, shared/vectors/vectors_init.c: Reduced size of default prologue (some exceptions, e.g., altivec unavail.) are only 0x20 bytes apart. Also introduced a modified prologue that switches r0..r3 shadowing off (r0..r3 undefined on certain 603e variants when incurring a TLB miss).
Location:
c/src/lib/libbsp/powerpc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/ChangeLog

    r5b8eb3f0 rd8ada5b  
     12005-12-01      Till Straumann <strauman@slac.stanford.edu>
     2        * shared/vectors/vectors.h, shared/vectors/vectors.S,
     3        shared/vectors/vectors_init.c: Reduced size of default
     4        prologue (some exceptions, e.g., altivec unavail.) are only
     5        0x20 bytes apart. Also introduced a modified prologue
     6        that switches r0..r3 shadowing off (r0..r3 undefined
     7        on certain 603e variants when incurring a TLB miss).
     8
    192005-11-29      Till Straumann <strauman@slac.stanford.edu>
    210        * shared/irq/irq_asm.S, shared/vectors/vectors.S: Clear
  • c/src/lib/libbsp/powerpc/shared/vectors/vectors.S

    r5b8eb3f0 rd8ada5b  
    1212#include <rtems/score/cpu.h>
    1313#include <bsp/vectors.h>
     14#include <libcpu/raw_exception.h>
    1415
    1516#define SYNC \
     
    2930         */
    3031        .text
    31         .p2align 5
    32 
     32        /* 603e shadows GPR0..GPR3 for certain exceptions. We must switch
     33         * that off before we can use the stack pointer. Note that this is
     34         * ONLY safe if the shadowing is actually active -- otherwise, r1
     35         * is destroyed. We deliberately use r1 so problems become obvious
     36         * if this is abused!
     37         */
     38PUBLIC_VAR(tgpr_clr_exception_vector_code_prolog)
     39SYM (tgpr_clr_exception_vector_code_prolog):
     40        mfmsr   r1
     41        rlwinm  r1,r1,0,15,13
     42        mtmsr   r1
     43        isync
     44        /* fall thru */
    3345PUBLIC_VAR(default_exception_vector_code_prolog)
    3446SYM (default_exception_vector_code_prolog):
     
    3648         * let room for exception frame
    3749         */
     50        stw     r3, GPR3_OFFSET-EXCEPTION_FRAME_END(r1)
     51        mflr    r3
     52        stw     r3, EXC_LR_OFFSET-EXCEPTION_FRAME_END(r1)
     53        bla     push_normalized_frame
     54
     55        /* IMPORTANT: prologue size MUST be < 32 bytes; 'altivec unavailable' exception
     56         *            is already at 0xf20 :-(
     57         */
     58
     59        PUBLIC_VAR (default_exception_vector_code_prolog_size)
     60        PUBLIC_VAR (tgpr_clr_exception_vector_code_prolog_size)
     61
     62        default_exception_vector_code_prolog_size = . - default_exception_vector_code_prolog
     63        tgpr_clr_exception_vector_code_prolog_size= . - tgpr_clr_exception_vector_code_prolog
     64
     65        .p2align 5
     66PUBLIC_VAR (push_normalized_frame)
     67SYM (push_normalized_frame):
    3868        stwu    r1, - (EXCEPTION_FRAME_END)(r1)
    39         stw     r3, GPR3_OFFSET(r1)
    40         /* R2 should never change (EABI: pointer to .sdata2) - we
    41      * save it nevertheless..
    42          */
    43         stw     r2, GPR2_OFFSET(r1)
    44         mflr    r3
    45         stw     r3, EXC_LR_OFFSET(r1)
    46         bl      0f
    47 0:      /*
     69        mfcr    r3
     70        stw     r3,  EXC_CR_OFFSET(r1)
     71        /*
    4872         * r3 = exception vector entry point
    4973         * (256 * vector number) + few instructions
     
    5478         */
    5579        srwi    r3,r3,8
    56         ba      push_normalized_frame
    57 
    58         PUBLIC_VAR (default_exception_vector_code_prolog_size)
    59 
    60         default_exception_vector_code_prolog_size= . - default_exception_vector_code_prolog
    61 
    62         .p2align 5
    63 PUBLIC_VAR (push_normalized_frame)
    64 SYM (push_normalized_frame):
    6580        stw     r3, EXCEPTION_NUMBER_OFFSET(r1)
    6681        stw     r0, GPR0_OFFSET(r1)
     82        /* R2 should never change (EABI: pointer to .sdata2) - we
     83         * save it nevertheless..
     84         */
     85        stw     r2, GPR2_OFFSET(r1)
    6786        mfsrr0  r3
    6887        stw     r3, SRR0_FRAME_OFFSET(r1)
     
    7190        /*
    7291         * Save general purpose registers
    73          * Already saved in prolog : R1, R2, R3, LR.
    74          * Saved a few line above  : R0
     92         * Already saved in prolog : R1, R3, LR.
     93         * Saved a few line above  : R0, R2
    7594         *
    7695         * Manual says that "stmw" instruction may be slower than
     
    8099        stmw    r4, GPR4_OFFSET(r1)     /* save R4->R31 */
    81100
    82         mfcr    r31
    83         stw     r31,  EXC_CR_OFFSET(r1)
    84101        mfctr   r30
    85102        stw     r30,  EXC_CTR_OFFSET(r1)
  • c/src/lib/libbsp/powerpc/shared/vectors/vectors.h

    r5b8eb3f0 rd8ada5b  
    7676
    7777extern  void default_exception_vector_code_prolog();
     78extern  void tgpr_clr_exception_vector_code_prolog();
    7879/* This symbol is generated by the linker; prevent it from
    7980 * being accessed in one of the short data areas by declaring
     
    8182 */
    8283extern  int  default_exception_vector_code_prolog_size[];
     84extern  int  tgpr_clr_exception_vector_code_prolog_size[];
    8385
    8486/* codemove is like memmove, but it also gets the cache line size
  • c/src/lib/libbsp/powerpc/shared/vectors/vectors_init.c

    r5b8eb3f0 rd8ada5b  
    1313 *  $Id$
    1414 */
     15#include <rtems.h>
     16#include <bsp.h>
     17
    1518#include <rtems/bspIo.h>
    1619
     
    1821#include <libcpu/raw_exception.h>
    1922#include <libcpu/spr.h>
    20 #include <bsp.h>
     23#include <libcpu/cpuIdent.h>
    2124
    2225static rtems_raw_except_global_settings exception_config;
     
    144147{
    145148  int i;
     149  int has_shadowed_gprs = 0;
    146150
    147151  /*
     
    163167   */
    164168  exception_config.defaultRawEntry.hdl.raw_hdl_size = (unsigned) default_exception_vector_code_prolog_size;
     169
     170  switch ( get_ppc_cpu_type() ) {
     171    case PPC_603e:
     172    case PPC_8240:
     173      has_shadowed_gprs = 1; 
     174    default: break;
     175  }
    165176  for (i=0; i <= exception_config.exceptSize; i++) {
    166177    if (!mpc60x_vector_is_valid (i)) {
     
    168179    }
    169180    exception_table[i].exceptIndex      = i;
    170     exception_table[i].hdl              = exception_config.defaultRawEntry.hdl;
     181    if ( has_shadowed_gprs
     182         && (   ASM_IMISS_VECTOR  == i
     183             || ASM_DLMISS_VECTOR == i
     184             || ASM_DSMISS_VECTOR == i ) ) {
     185      exception_table[i].hdl.raw_hdl      = tgpr_clr_exception_vector_code_prolog;
     186      exception_table[i].hdl.raw_hdl_size = (unsigned)tgpr_clr_exception_vector_code_prolog_size;
     187    } else {
     188      exception_table[i].hdl              = exception_config.defaultRawEntry.hdl;
     189    }
    171190    exception_table[i].hdl.vector       = i;
    172191    exception_table[i].on               = nop_except_enable;
Note: See TracChangeset for help on using the changeset viewer.