Changeset 8df1f408 in rtems


Ignore:
Timestamp:
Jun 2, 2014, 2:31:51 PM (5 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
4.11, master
Children:
1d799ad
Parents:
98f2d5c
git-author:
Christian Mauderer <Christian.Mauderer@…> (06/02/14 14:31:51)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/03/14 06:35:47)
Message:

score/sparc: Add support for paravirtualization

Guest systems in paravirtualization environments run usually in user
mode. Thus it is not possible to directly access the PSR and TBR
registers. Use functions instead of inline assembler to access these
registers if RTEMS_PARAVIRT is defined.

Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/erc32/Makefile.am

    r98f2d5c r8df1f408  
    4747libbsp_a_SOURCES += ../../sparc/shared/startup/early_malloc.c
    4848# ISR Handler
     49libbsp_a_SOURCES += ../../sparc/shared/cpu.c
    4950libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
    5051# gnatsupp
  • c/src/lib/libbsp/sparc/leon2/Makefile.am

    r98f2d5c r8df1f408  
    6363
    6464# ISR Handler
     65libbsp_a_SOURCES += ../../sparc/shared/cpu.c
    6566libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
    6667# gnatsupp
  • c/src/lib/libbsp/sparc/leon3/Makefile.am

    r98f2d5c r8df1f408  
    4444
    4545# ISR Handler
     46libbsp_a_SOURCES += ../../sparc/shared/cpu.c
    4647libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
    4748# gnatsupp
  • c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c

    r98f2d5c r8df1f408  
    2121#include <stdlib.h>
    2222
    23 #if !defined(__leon__)
     23#if !defined(__leon__) || defined(RTEMS_PARAVIRT)
    2424uint32_t _CPU_SMP_Get_current_processor( void )
    2525{
  • c/src/lib/libcpu/sparc/syscall/syscall.S

    r98f2d5c r8df1f408  
    8484        ta      0
    8585
     86#if defined(RTEMS_PARAVIRT)
     87
     88        PUBLIC(_SPARC_Get_PSR)
     89
     90SYM(_SPARC_Get_PSR):
     91
     92        retl
     93         rd     %psr, %o0
     94
     95        PUBLIC(_SPARC_Set_PSR)
     96
     97SYM(_SPARC_Set_PSR):
     98
     99        mov     %o0, %psr
     100        nop
     101        nop
     102        nop
     103        retl
     104         nop
     105
     106        PUBLIC(_SPARC_Get_TBR)
     107
     108SYM(_SPARC_Get_TBR):
     109
     110        retl
     111         rd    %tbr, %o0
     112
     113        PUBLIC(_SPARC_Set_TBR)
     114
     115SYM(_SPARC_Set_TBR):
     116
     117        retl
     118         wr    %o0, 0, %tbr
     119
     120#endif /* defined(RTEMS_PARAVIRT) */
     121
    86122/* end of file */
  • cpukit/score/cpu/sparc/cpu.c

    r98f2d5c r8df1f408  
    7373
    7474/*
    75  *  This initializes the set of opcodes placed in each trap
    76  *  table entry.  The routine which installs a handler is responsible
    77  *  for filling in the fields for the _handler address and the _vector
    78  *  trap type.
    79  *
    80  *  The constants following this structure are masks for the fields which
    81  *  must be filled in when the handler is installed.
    82  */
    83 
    84 const CPU_Trap_table_entry _CPU_Trap_slot_template = {
    85   0xa1480000,      /* mov   %psr, %l0           */
    86   0x29000000,      /* sethi %hi(_handler), %l4  */
    87   0x81c52000,      /* jmp   %l4 + %lo(_handler) */
    88   0xa6102000       /* mov   _vector, %l3        */
    89 };
    90 
    91 /*
    9275 *  _CPU_Initialize
    9376 *
  • cpukit/score/cpu/sparc/rtems/score/cpu.h

    r98f2d5c r8df1f408  
    11931193  void _CPU_SMP_Finalize_initialization( uint32_t cpu_count );
    11941194
    1195   #if defined(__leon__)
     1195  #if defined(__leon__) && !defined(RTEMS_PARAVIRT)
    11961196    static inline uint32_t _CPU_SMP_Get_current_processor( void )
    11971197    {
  • cpukit/score/cpu/sparc/rtems/score/sparc.h

    r98f2d5c r8df1f408  
    165165 * This macro returns the current contents of the PSR register in @a _psr.
    166166 */
     167#if defined(RTEMS_PARAVIRT)
     168
     169uint32_t _SPARC_Get_PSR( void );
     170
     171#define sparc_get_psr( _psr ) \
     172  (_psr) = _SPARC_Get_PSR()
     173
     174#else /* RTEMS_PARAVIRT */
     175
    167176#define sparc_get_psr( _psr ) \
    168177  do { \
     
    171180  } while ( 0 )
    172181
     182#endif /* RTEMS_PARAVIRT */
     183
    173184/**
    174185 * @brief Macro to set the PSR.
     
    176187 * This macro sets the PSR register to the value in @a _psr.
    177188 */
     189#if defined(RTEMS_PARAVIRT)
     190
     191void _SPARC_Set_PSR( uint32_t new_psr );
     192
    178193#define sparc_set_psr( _psr ) \
     194  _SPARC_Set_PSR( _psr )
     195
     196#else /* RTEMS_PARAVIRT */
     197
     198#define sparc_set_psr( _psr ) \
    179199  do { \
    180200    __asm__ volatile ( "mov  %0, %%psr " : "=r" ((_psr)) : "0" ((_psr)) ); \
     
    184204  } while ( 0 )
    185205
     206#endif /* RTEMS_PARAVIRT */
     207
    186208/**
    187209 * @brief Macro to obtain the TBR.
     
    189211 * This macro returns the current contents of the TBR register in @a _tbr.
    190212 */
     213#if defined(RTEMS_PARAVIRT)
     214
     215uint32_t _SPARC_Get_TBR( void );
     216
     217#define sparc_get_tbr( _tbr ) \
     218  (_tbr) = _SPARC_Get_TBR()
     219
     220#else /* RTEMS_PARAVIRT */
     221
    191222#define sparc_get_tbr( _tbr ) \
    192223  do { \
     
    195226  } while ( 0 )
    196227
     228#endif /* RTEMS_PARAVIRT */
     229
    197230/**
    198231 * @brief Macro to set the TBR.
     
    200233 * This macro sets the TBR register to the value in @a _tbr.
    201234 */
     235#if defined(RTEMS_PARAVIRT)
     236
     237void _SPARC_Set_TBR( uint32_t new_tbr );
     238
    202239#define sparc_set_tbr( _tbr ) \
     240  _SPARC_Set_TBR((_tbr))
     241
     242#else /* RTEMS_PARAVIRT */
     243
     244#define sparc_set_tbr( _tbr ) \
    203245  do { \
    204246     __asm__ volatile( "wr %0, 0, %%tbr" :  "=r" (_tbr) : "0" (_tbr) ); \
    205247  } while ( 0 )
     248
     249#endif /* RTEMS_PARAVIRT */
    206250
    207251/**
Note: See TracChangeset for help on using the changeset viewer.