source: rtems/cpukit/score/cpu/sparc/rtems/score/cpuimpl.h @ c11ac2d5

5
Last change on this file since c11ac2d5 was c11ac2d5, checked in by Sebastian Huber <sebastian.huber@…>, on 11/14/16 at 13:42:56

sparc: Use Per_CPU_Control::isr_dispatch_disable

Update #2751.

  • Property mode set to 100644
File size: 4.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief CPU Port Implementation API
5 */
6
7/*
8 * Copyright (c) 1989, 2007 On-Line Applications Research Corporation (OAR)
9 * Copyright (c) 2013, 2016 embedded brains GmbH
10 *
11 * The license and distribution terms for this file may be
12 * found in the file LICENSE in this distribution or at
13 * http://www.rtems.org/license/LICENSE.
14 */
15
16#ifndef _RTEMS_SCORE_CPUIMPL_H
17#define _RTEMS_SCORE_CPUIMPL_H
18
19#include <rtems/score/cpu.h>
20
21/** This defines the size of the minimum stack frame. */
22#define SPARC_MINIMUM_STACK_FRAME_SIZE 0x60
23
24/*
25 *  Offsets of fields with CPU_Interrupt_frame for assembly routines.
26 */
27
28/** This macro defines an offset into the ISF for use in assembly. */
29#define ISF_PSR_OFFSET         SPARC_MINIMUM_STACK_FRAME_SIZE + 0x00
30/** This macro defines an offset into the ISF for use in assembly. */
31#define ISF_PC_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x04
32/** This macro defines an offset into the ISF for use in assembly. */
33#define ISF_NPC_OFFSET         SPARC_MINIMUM_STACK_FRAME_SIZE + 0x08
34/** This macro defines an offset into the ISF for use in assembly. */
35#define ISF_G1_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x0c
36/** This macro defines an offset into the ISF for use in assembly. */
37#define ISF_G2_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x10
38/** This macro defines an offset into the ISF for use in assembly. */
39#define ISF_G3_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x14
40/** This macro defines an offset into the ISF for use in assembly. */
41#define ISF_G4_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x18
42/** This macro defines an offset into the ISF for use in assembly. */
43#define ISF_G5_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x1c
44/** This macro defines an offset into the ISF for use in assembly. */
45#define ISF_G7_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x24
46/** This macro defines an offset into the ISF for use in assembly. */
47#define ISF_I0_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x28
48/** This macro defines an offset into the ISF for use in assembly. */
49#define ISF_I1_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x2c
50/** This macro defines an offset into the ISF for use in assembly. */
51#define ISF_I2_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x30
52/** This macro defines an offset into the ISF for use in assembly. */
53#define ISF_I3_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x34
54/** This macro defines an offset into the ISF for use in assembly. */
55#define ISF_I4_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x38
56/** This macro defines an offset into the ISF for use in assembly. */
57#define ISF_I5_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x3c
58/** This macro defines an offset into the ISF for use in assembly. */
59#define ISF_I6_FP_OFFSET       SPARC_MINIMUM_STACK_FRAME_SIZE + 0x40
60/** This macro defines an offset into the ISF for use in assembly. */
61#define ISF_I7_OFFSET          SPARC_MINIMUM_STACK_FRAME_SIZE + 0x44
62/** This macro defines an offset into the ISF for use in assembly. */
63#define ISF_Y_OFFSET           SPARC_MINIMUM_STACK_FRAME_SIZE + 0x48
64/** This macro defines an offset into the ISF for use in assembly. */
65#define ISF_TPC_OFFSET         SPARC_MINIMUM_STACK_FRAME_SIZE + 0x4c
66
67/** This defines the size of the ISF area for use in assembly. */
68#define CPU_INTERRUPT_FRAME_SIZE SPARC_MINIMUM_STACK_FRAME_SIZE + 0x50
69
70#if ( SPARC_HAS_FPU == 1 )
71  #define CPU_PER_CPU_CONTROL_SIZE 8
72#else
73  #define CPU_PER_CPU_CONTROL_SIZE 0
74#endif
75
76#if ( SPARC_HAS_FPU == 1 )
77  /**
78   * @brief Offset of the CPU_Per_CPU_control::fsr field relative to the
79   * Per_CPU_Control begin.
80   */
81  #define SPARC_PER_CPU_FSR_OFFSET 0
82#endif
83
84#ifndef ASM
85
86#ifdef __cplusplus
87extern "C" {
88#endif
89
90typedef struct {
91#if ( SPARC_HAS_FPU == 1 )
92  /**
93   * @brief Memory location to store the FSR register during interrupt
94   * processing.
95   *
96   * This is a write-only field.  The FSR is written to force a completion of
97   * floating point operations in progress.
98   */
99  uint32_t fsr;
100
101  /* See Per_CPU_Control::Interrupt_frame */
102  uint32_t reserved_for_alignment_of_interrupt_frame;
103#endif
104} CPU_Per_CPU_control;
105
106/**
107 * @brief The pointer to the current per-CPU control is available via register
108 * g6.
109 */
110register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__( "g6" );
111
112#define _CPU_Get_current_per_CPU_control() _SPARC_Per_CPU_current
113
114#define _CPU_Get_thread_executing() ( _SPARC_Per_CPU_current->executing )
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* ASM */
121
122#endif /* _RTEMS_SCORE_CPUIMPL_H */
Note: See TracBrowser for help on using the repository browser.