forked from Imagelibrary/rtems
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.
This commit is contained in:
committed by
Sebastian Huber
parent
98f2d5c505
commit
8df1f408fd
@@ -46,6 +46,7 @@ libbsp_a_SOURCES += startup/bspidle.c
|
||||
libbsp_a_SOURCES += startup/bspdelay.c
|
||||
libbsp_a_SOURCES += ../../sparc/shared/startup/early_malloc.c
|
||||
# ISR Handler
|
||||
libbsp_a_SOURCES += ../../sparc/shared/cpu.c
|
||||
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
||||
# gnatsupp
|
||||
libbsp_a_SOURCES += gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c
|
||||
|
||||
@@ -62,6 +62,7 @@ libbsp_a_SOURCES += startup/bspdelay.c
|
||||
libbsp_a_SOURCES += ../../sparc/shared/startup/early_malloc.c
|
||||
|
||||
# ISR Handler
|
||||
libbsp_a_SOURCES += ../../sparc/shared/cpu.c
|
||||
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
||||
# gnatsupp
|
||||
libbsp_a_SOURCES += gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c
|
||||
|
||||
@@ -43,6 +43,7 @@ libbsp_a_SOURCES += startup/bspreset.c
|
||||
libbsp_a_SOURCES += startup/cpucounter.c
|
||||
|
||||
# ISR Handler
|
||||
libbsp_a_SOURCES += ../../sparc/shared/cpu.c
|
||||
libbsp_a_SOURCES += ../../sparc/shared/irq_asm.S
|
||||
# gnatsupp
|
||||
libbsp_a_SOURCES += gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <rtems/score/smpimpl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if !defined(__leon__)
|
||||
#if !defined(__leon__) || defined(RTEMS_PARAVIRT)
|
||||
uint32_t _CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
return _LEON3_Get_current_processor();
|
||||
|
||||
36
c/src/lib/libbsp/sparc/shared/cpu.c
Normal file
36
c/src/lib/libbsp/sparc/shared/cpu.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief SPARC CPU Dependent Source
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <rtems/score/cpu.h>
|
||||
|
||||
/*
|
||||
* This initializes the set of opcodes placed in each trap
|
||||
* table entry. The routine which installs a handler is responsible
|
||||
* for filling in the fields for the _handler address and the _vector
|
||||
* trap type.
|
||||
*
|
||||
* The constants following this structure are masks for the fields which
|
||||
* must be filled in when the handler is installed.
|
||||
*
|
||||
* This table is defined here to allow BSP specific versions, e.g. for guest
|
||||
* systems under paravirtualization.
|
||||
*/
|
||||
|
||||
const CPU_Trap_table_entry _CPU_Trap_slot_template = {
|
||||
0xa1480000, /* mov %psr, %l0 */
|
||||
0x29000000, /* sethi %hi(_handler), %l4 */
|
||||
0x81c52000, /* jmp %l4 + %lo(_handler) */
|
||||
0xa6102000 /* mov _vector, %l3 */
|
||||
};
|
||||
@@ -83,4 +83,40 @@ SYM(sparc_syscall_exit):
|
||||
mov %o1, %g3 ! Additional exit code 2
|
||||
ta 0
|
||||
|
||||
#if defined(RTEMS_PARAVIRT)
|
||||
|
||||
PUBLIC(_SPARC_Get_PSR)
|
||||
|
||||
SYM(_SPARC_Get_PSR):
|
||||
|
||||
retl
|
||||
rd %psr, %o0
|
||||
|
||||
PUBLIC(_SPARC_Set_PSR)
|
||||
|
||||
SYM(_SPARC_Set_PSR):
|
||||
|
||||
mov %o0, %psr
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
retl
|
||||
nop
|
||||
|
||||
PUBLIC(_SPARC_Get_TBR)
|
||||
|
||||
SYM(_SPARC_Get_TBR):
|
||||
|
||||
retl
|
||||
rd %tbr, %o0
|
||||
|
||||
PUBLIC(_SPARC_Set_TBR)
|
||||
|
||||
SYM(_SPARC_Set_TBR):
|
||||
|
||||
retl
|
||||
wr %o0, 0, %tbr
|
||||
|
||||
#endif /* defined(RTEMS_PARAVIRT) */
|
||||
|
||||
/* end of file */
|
||||
|
||||
Reference in New Issue
Block a user