📄 cpu.h
字号:
/* cpu.h * * This include file contains information pertaining to the port of * the executive to the SPARC processor. * * COPYRIGHT (c) 1989-1999. * 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.com/license/LICENSE. * * $Id: cpu.h,v 1.13.2.2 2005/10/05 19:30:18 joel Exp $ */#ifndef __CPU_h#define __CPU_h#ifdef __cplusplusextern "C" {#endif#include <rtems/score/sparc.h> /* pick up machine definitions */#ifndef ASM#include <rtems/score/types.h>#endif/* conditional compilation parameters *//* * Should the calls to _Thread_Enable_dispatch be inlined? * * If TRUE, then they are inlined. * If FALSE, then a subroutine call is made. */#define CPU_INLINE_ENABLE_DISPATCH TRUE/* * Should the body of the search loops in _Thread_queue_Enqueue_priority * be unrolled one time? In unrolled each iteration of the loop examines * two "nodes" on the chain being searched. Otherwise, only one node * is examined per iteration. * * If TRUE, then the loops are unrolled. * If FALSE, then the loops are not unrolled. * * This parameter could go either way on the SPARC. The interrupt flash * code is relatively lengthy given the requirements for nops following * writes to the psr. But if the clock speed were high enough, this would * not represent a great deal of time. */#define CPU_UNROLL_ENQUEUE_PRIORITY TRUE/* * Does the executive manage a dedicated interrupt stack in software? * * If TRUE, then a stack is allocated in _ISR_Handler_initialization. * If FALSE, nothing is done. * * The SPARC does not have a dedicated HW interrupt stack and one has * been implemented in SW. */#define CPU_HAS_SOFTWARE_INTERRUPT_STACK TRUE/* * Does this CPU have hardware support for a dedicated interrupt stack? * * If TRUE, then it must be installed during initialization. * If FALSE, then no installation is performed. * * The SPARC does not have a dedicated HW interrupt stack. */#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE/* * Do we allocate a dedicated interrupt stack in the Interrupt Manager? * * If TRUE, then the memory is allocated during initialization. * If FALSE, then the memory is allocated during initialization. */#define CPU_ALLOCATE_INTERRUPT_STACK TRUE/* * Does the RTEMS invoke the user's ISR with the vector number and * a pointer to the saved interrupt frame (1) or just the vector * number (0)? */#define CPU_ISR_PASSES_FRAME_POINTER 0/* * Does the CPU have hardware floating point? * * If TRUE, then the FLOATING_POINT task attribute is supported. * If FALSE, then the FLOATING_POINT task attribute is ignored. */#if ( SPARC_HAS_FPU == 1 )#define CPU_HARDWARE_FP TRUE#else#define CPU_HARDWARE_FP FALSE#endif#define CPU_SOFTWARE_FP FALSE/* * Are all tasks FLOATING_POINT tasks implicitly? * * If TRUE, then the FLOATING_POINT task attribute is assumed. * If FALSE, then the FLOATING_POINT task attribute is followed. */#define CPU_ALL_TASKS_ARE_FP FALSE/* * Should the IDLE task have a floating point context? * * If TRUE, then the IDLE task is created as a FLOATING_POINT task * and it has a floating point context which is switched in and out. * If FALSE, then the IDLE task does not have a floating point context. */#define CPU_IDLE_TASK_IS_FP FALSE/* * Should the saving of the floating point registers be deferred * until a context switch is made to another different floating point * task? * * If TRUE, then the floating point context will not be stored until * necessary. It will remain in the floating point registers and not * disturned until another floating point task is switched to. * * If FALSE, then the floating point context is saved when a floating * point task is switched out and restored when the next floating point * task is restored. The state of the floating point registers between * those two operations is not specified. */#define CPU_USE_DEFERRED_FP_SWITCH TRUE/* * Does this port provide a CPU dependent IDLE task implementation? * * If TRUE, then the routine _CPU_Thread_Idle_body * must be provided and is the default IDLE thread body instead of * _CPU_Thread_Idle_body. * * If FALSE, then use the generic IDLE thread body if the BSP does * not provide one. */#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE/* * Does the stack grow up (toward higher addresses) or down * (toward lower addresses)? * * If TRUE, then the grows upward. * If FALSE, then the grows toward smaller addresses. * * The stack grows to lower addresses on the SPARC. */#define CPU_STACK_GROWS_UP FALSE/* * The following is the variable attribute used to force alignment * of critical data structures. On some processors it may make * sense to have these aligned on tighter boundaries than * the minimum requirements of the compiler in order to have as * much of the critical data area as possible in a cache line. * * The SPARC does not appear to have particularly strict alignment * requirements. This value was chosen to take advantages of caches. */#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (16)))/* * Define what is required to specify how the network to host conversion * routines are handled. */#define CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE#define CPU_BIG_ENDIAN TRUE#define CPU_LITTLE_ENDIAN FALSE/* * The following defines the number of bits actually used in the * interrupt field of the task mode. How those bits map to the * CPU interrupt levels is defined by the routine _CPU_ISR_Set_level(). * * The SPARC has 16 interrupt levels in the PIL field of the PSR. */#define CPU_MODES_INTERRUPT_MASK 0x0000000F/* * This structure represents the organization of the minimum stack frame * for the SPARC. More framing information is required in certain situaions * such as when there are a large number of out parameters or when the callee * must save floating point registers. */#ifndef ASMtypedef struct { unsigned32 l0; unsigned32 l1; unsigned32 l2; unsigned32 l3; unsigned32 l4; unsigned32 l5; unsigned32 l6; unsigned32 l7; unsigned32 i0; unsigned32 i1; unsigned32 i2; unsigned32 i3; unsigned32 i4; unsigned32 i5; unsigned32 i6_fp; unsigned32 i7; void *structure_return_address; /* * The following are for the callee to save the register arguments in * should this be necessary. */ unsigned32 saved_arg0; unsigned32 saved_arg1; unsigned32 saved_arg2; unsigned32 saved_arg3; unsigned32 saved_arg4; unsigned32 saved_arg5; unsigned32 pad0;} CPU_Minimum_stack_frame;#endif /* ASM */#define CPU_STACK_FRAME_L0_OFFSET 0x00#define CPU_STACK_FRAME_L1_OFFSET 0x04#define CPU_STACK_FRAME_L2_OFFSET 0x08#define CPU_STACK_FRAME_L3_OFFSET 0x0c#define CPU_STACK_FRAME_L4_OFFSET 0x10#define CPU_STACK_FRAME_L5_OFFSET 0x14#define CPU_STACK_FRAME_L6_OFFSET 0x18#define CPU_STACK_FRAME_L7_OFFSET 0x1c#define CPU_STACK_FRAME_I0_OFFSET 0x20#define CPU_STACK_FRAME_I1_OFFSET 0x24#define CPU_STACK_FRAME_I2_OFFSET 0x28#define CPU_STACK_FRAME_I3_OFFSET 0x2c#define CPU_STACK_FRAME_I4_OFFSET 0x30#define CPU_STACK_FRAME_I5_OFFSET 0x34#define CPU_STACK_FRAME_I6_FP_OFFSET 0x38#define CPU_STACK_FRAME_I7_OFFSET 0x3c#define CPU_STRUCTURE_RETURN_ADDRESS_OFFSET 0x40#define CPU_STACK_FRAME_SAVED_ARG0_OFFSET 0x44#define CPU_STACK_FRAME_SAVED_ARG1_OFFSET 0x48#define CPU_STACK_FRAME_SAVED_ARG2_OFFSET 0x4c#define CPU_STACK_FRAME_SAVED_ARG3_OFFSET 0x50#define CPU_STACK_FRAME_SAVED_ARG4_OFFSET 0x54#define CPU_STACK_FRAME_SAVED_ARG5_OFFSET 0x58#define CPU_STACK_FRAME_PAD0_OFFSET 0x5c#define CPU_MINIMUM_STACK_FRAME_SIZE 0x60/* * Contexts * * Generally there are 2 types of context to save. * 1. Interrupt registers to save * 2. Task level registers to save * * This means we have the following 3 context items: * 1. task level context stuff:: Context_Control * 2. floating point task stuff:: Context_Control_fp * 3. special interrupt level context :: Context_Control_interrupt * * On the SPARC, we are relatively conservative in that we save most * of the CPU state in the context area. The ET (enable trap) bit and * the CWP (current window pointer) fields of the PSR are considered * system wide resources and are not maintained on a per-thread basis. */#ifndef ASMtypedef struct { /* * Using a double g0_g1 will put everything in this structure on a * double word boundary which allows us to use double word loads * and stores safely in the context switch. */ double g0_g1; unsigned32 g2; unsigned32 g3; unsigned32 g4; unsigned32 g5; unsigned32 g6; unsigned32 g7; unsigned32 l0; unsigned32 l1; unsigned32 l2; unsigned32 l3; unsigned32 l4; unsigned32 l5; unsigned32 l6; unsigned32 l7; unsigned32 i0; unsigned32 i1; unsigned32 i2; unsigned32 i3; unsigned32 i4; unsigned32 i5; unsigned32 i6_fp; unsigned32 i7; unsigned32 o0; unsigned32 o1; unsigned32 o2; unsigned32 o3; unsigned32 o4; unsigned32 o5; unsigned32 o6_sp; unsigned32 o7; unsigned32 psr;} Context_Control;#endif /* ASM *//* * Offsets of fields with Context_Control for assembly routines. */#define G0_OFFSET 0x00#define G1_OFFSET 0x04#define G2_OFFSET 0x08#define G3_OFFSET 0x0C#define G4_OFFSET 0x10#define G5_OFFSET 0x14#define G6_OFFSET 0x18#define G7_OFFSET 0x1C#define L0_OFFSET 0x20#define L1_OFFSET 0x24#define L2_OFFSET 0x28#define L3_OFFSET 0x2C#define L4_OFFSET 0x30#define L5_OFFSET 0x34#define L6_OFFSET 0x38#define L7_OFFSET 0x3C#define I0_OFFSET 0x40#define I1_OFFSET 0x44#define I2_OFFSET 0x48#define I3_OFFSET 0x4C#define I4_OFFSET 0x50#define I5_OFFSET 0x54#define I6_FP_OFFSET 0x58#define I7_OFFSET 0x5C#define O0_OFFSET 0x60#define O1_OFFSET 0x64#define O2_OFFSET 0x68#define O3_OFFSET 0x6C#define O4_OFFSET 0x70#define O5_OFFSET 0x74#define O6_SP_OFFSET 0x78#define O7_OFFSET 0x7C#define PSR_OFFSET 0x80#define CONTEXT_CONTROL_SIZE 0x84/* * The floating point context area. */#ifndef ASMtypedef struct { double f0_f1; double f2_f3; double f4_f5; double f6_f7; double f8_f9; double f10_f11; double f12_f13; double f14_f15; double f16_f17; double f18_f19; double f20_f21; double f22_f23; double f24_f25; double f26_f27; double f28_f29; double f30_f31; unsigned32 fsr;} Context_Control_fp;#endif /* ASM *//* * Offsets of fields with Context_Control_fp for assembly routines. */#define FO_F1_OFFSET 0x00#define F2_F3_OFFSET 0x08#define F4_F5_OFFSET 0x10#define F6_F7_OFFSET 0x18#define F8_F9_OFFSET 0x20#define F1O_F11_OFFSET 0x28#define F12_F13_OFFSET 0x30#define F14_F15_OFFSET 0x38#define F16_F17_OFFSET 0x40#define F18_F19_OFFSET 0x48#define F2O_F21_OFFSET 0x50#define F22_F23_OFFSET 0x58#define F24_F25_OFFSET 0x60#define F26_F27_OFFSET 0x68#define F28_F29_OFFSET 0x70#define F3O_F31_OFFSET 0x78#define FSR_OFFSET 0x80#define CONTEXT_CONTROL_FP_SIZE 0x84#ifndef ASM/* * Context saved on stack for an interrupt. * * NOTE: The PSR, PC, and NPC are only saved in this structure for the * benefit of the user's handler. */typedef struct { CPU_Minimum_stack_frame Stack_frame; unsigned32 psr; unsigned32 pc; unsigned32 npc; unsigned32 g1; unsigned32 g2; unsigned32 g3; unsigned32 g4; unsigned32 g5; unsigned32 g6; unsigned32 g7; unsigned32 i0; unsigned32 i1; unsigned32 i2; unsigned32 i3; unsigned32 i4; unsigned32 i5; unsigned32 i6_fp; unsigned32 i7; unsigned32 y; unsigned32 tpc;} CPU_Interrupt_frame;#endif /* ASM *//* * Offsets of fields with CPU_Interrupt_frame for assembly routines. */#define ISF_STACK_FRAME_OFFSET 0x00#define ISF_PSR_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x00#define ISF_PC_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x04#define ISF_NPC_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x08#define ISF_G1_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x0c#define ISF_G2_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x10#define ISF_G3_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x14#define ISF_G4_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x18#define ISF_G5_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x1c#define ISF_G6_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x20#define ISF_G7_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x24#define ISF_I0_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x28#define ISF_I1_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x2c#define ISF_I2_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x30#define ISF_I3_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x34#define ISF_I4_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x38#define ISF_I5_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x3c#define ISF_I6_FP_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x40#define ISF_I7_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x44#define ISF_Y_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x48#define ISF_TPC_OFFSET CPU_MINIMUM_STACK_FRAME_SIZE + 0x4c#define CONTEXT_CONTROL_INTERRUPT_FRAME_SIZE CPU_MINIMUM_STACK_FRAME_SIZE + 0x50 #ifndef ASM/* * The following table contains the information required to configure * the processor specific parameters. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -