reg.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:6k
源码类别:

VxWorks

开发平台:

C/C++

  1. /*      @(#)reg.h 1.1 86/07/07 SMI      */
  2. /* Copyright 1984-1992 Wind River Systems, Inc. */
  3. /*
  4.  * Copyright (c) 1986 by Sun Microsystems, Inc.
  5.  */
  6. /*
  7. modification history
  8. --------------------
  9. 02d,15mar00,dra  Added ColdFire support
  10. 02d,19oct01,dee  Merge from T2.1.0 release
  11. 02c,30jul93,jwt  added architecture-specific conditional for 68K register set.
  12. 02b,22sep92,rrr  added support for c++
  13. 02a,04jul92,jcf  cleaned up.
  14. 01c,26may92,rrr  the tree shuffle
  15. 01b,04oct91,rrr  passed through the ansification filter
  16.   -changed copyright notice
  17. 01a,05oct90,shl  added copyright notice.
  18. */
  19. #ifndef __INCregh
  20. #define __INCregh
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if (CPU_FAMILY == MC680X0) || (CPU_FAMILY == COLDFIRE)
  25. /*
  26.  * Location of the users' stored
  27.  * registers relative to R0.
  28.  * Usage is u.u_ar0[XX].
  29.  */
  30. #define R0 (0)
  31. #define R1 (1)
  32. #define R2 (2)
  33. #define R3 (3)
  34. #define R4 (4)
  35. #define R5 (5)
  36. #define R6 (6)
  37. #define R7 (7)
  38. #define AR0 (8)
  39. #define AR1 (9)
  40. #define AR2 (10)
  41. #define AR3 (11)
  42. #define AR4 (12)
  43. #define AR5 (13)
  44. #define AR6 (14)
  45. #define AR7 (15)
  46. #define SP (15)
  47. #define PS (16)
  48. #define PC (17)
  49. /*
  50.  * And now for something completely the same...
  51.  */
  52. #ifndef LOCORE
  53. struct regs {
  54. int r_dreg[8]; /* data registers */
  55. #define r_r0 r_dreg[0] /* r0 for portability */
  56. int r_areg[8]; /* address registers */
  57. #define r_sp r_areg[7] /* user stack pointer */
  58. int r_sr; /* status register (actually a short) */
  59. #define r_ps r_sr
  60. int r_pc; /* program counter */
  61. };
  62. struct stkfmt {
  63. int f_stkfmt : 4; /* stack format */
  64. int  : 2;
  65. int f_vector : 10; /* vector offset */
  66. short f_beibase; /* start of bus error info (if any) */
  67. };
  68. /*
  69.  * Struct for floating point registers and general state
  70.  * for the MC68881 (the sky fpp has no user visible state).
  71.  * If fps_flags == FPS_UNUSED, the other 68881 fields have no meaning.
  72.  * fps_code and fps_flags are software implemented fields.
  73.  * fps_flags is not used when set by user level programs,
  74.  * but changing fps_code has the side effect of changing u.u_code.
  75.  */
  76. typedef struct ext_fp {
  77. int fp[3];
  78. } ext_fp; /* extended 96-bit 68881 fp registers */
  79. struct fp_status {
  80. ext_fp fps_regs[8]; /* 68881 floating point regs */
  81. int fps_control; /* 68881 control reg */
  82. int fps_status; /* 68881 status reg */
  83. int fps_iaddr; /* 68881 instruction address reg */
  84. int fps_code; /* additional word for signals */
  85. int fps_flags; /* r/o - unused, idle or busy */
  86. };
  87. #endif /* !LOCORE */
  88. /*
  89.  * Values defined for `fps_flags'.
  90.  */
  91. #define FPS_UNUSED 0 /* 68881 never used yet */
  92. #define FPS_IDLE 1 /* 68881 instruction completed */
  93. #define FPS_BUSY 2 /* 68881 instruction interrupted */
  94. /*
  95.  * The EXT_FPS_FLAGS() macro is used to convert a pointer to an
  96.  * fp_istate into a value to be used for the user visible state
  97.  * found in fps_flags.  As a speed optimization, this convertion
  98.  * is only done is required (e.g.  the PTRACE_GETFPREGS ptrace
  99.  * call or when dumping core) instead of on each context switch.
  100.  * The tests that we base the state on are that a fpis_vers of
  101.  * FPIS_VERSNULL means NULL state, else a fpis_bufsiz of FPIS_IDLESZ
  102.  * means IDLE state, else we assume BUSY state.
  103.  */
  104. #define FPIS_VERSNULL 0x0
  105. #define FPIS_IDLESIZE 0x18
  106. #define EXT_FPS_FLAGS(istatep) 
  107. ((istatep)->fpis_vers == FPIS_VERSNULL ? FPS_UNUSED : 
  108.     (istatep)->fpis_bufsiz == FPIS_IDLESIZE ? FPS_IDLE : FPS_BUSY)
  109. #ifndef LOCORE
  110. /*
  111.  * Struct for the internal state of the MC68881
  112.  * Although the MC68881 can have a smaller maximum for
  113.  * internal state, we allow for more to allow for expansion.
  114.  */
  115. #define FPIS_BUFSIZ 0xc0
  116. struct fp_istate {
  117. unsigned char fpis_vers; /* version number */
  118. unsigned char fpis_bufsiz; /* size of info in fpis_buf */
  119. unsigned short fpis_reserved; /* reserved word */
  120. unsigned char fpis_buf[FPIS_BUFSIZ]; /* fpp internal state buffer */
  121. };
  122. /*
  123.  * Structures for the status and data registers are defined here.
  124.  * Struct fpa_status are included in the u area.
  125.  * Struct fpa_regs is included in struct core.
  126.  */
  127. /* struct fpa_status is saved/restored during context switch */
  128. struct fpa_status {
  129. unsigned int fpas_state; /* STATE, supervisor privileged reg */
  130. unsigned int fpas_imask; /* IMASK */
  131. unsigned int fpas_load_ptr; /* LOAD_PTR */
  132. unsigned int fpas_ierr; /* IERR */
  133. unsigned int fpas_act_instr; /* pipe active instruction halves */
  134. unsigned int fpas_nxt_instr; /* pipe next instruction halves */
  135. unsigned int fpas_act_d1half;/* pipe active data first half */
  136. unsigned int fpas_act_d2half;/* pipe active data second half */
  137. unsigned int fpas_nxt_d1half;/* pipe next data first half */
  138. unsigned int fpas_nxt_d2half;/* pipe next data second half */
  139. unsigned int fpas_mode3_0; /* FPA MODE3_0 register */
  140. unsigned int fpas_wstatus; /* FPA WSTATUS register */
  141. };
  142. /*
  143.  * Since there are 32 contexts supported by the FPA hardware,
  144.  * when we do context switch on the FPA, we don't save/restore
  145.  * the data registers between the FPA and the u area.
  146.  * If there are already 32 processes using the fpa concurrently,
  147.  * we give an error message to the 33rd process trying to use the fpa.
  148.  * (Hopefully there will not be this many processes using FPA concurrently.)
  149.  */
  150. #define FPA_NCONTEXTS 32
  151. #define FPA_NDATA_REGS 32
  152. typedef struct fpa_long {
  153. int     fpl_data[2];
  154. } fpa_long;  /* 64 bit double precision registers */
  155. /* Struct fpa_regs is included in struct core. */
  156. struct fpa_regs {
  157. unsigned int fpar_flags; /* if zero, other fields are meaningless */
  158.         struct fpa_status fpar_status;
  159.         fpa_long fpar_data[FPA_NDATA_REGS];
  160. };
  161. #endif /* CPU_FAMILY == MC680X0 || CPU_FAMILY == COLDFIRE */
  162. #endif /* !LOCORE */
  163. #ifdef __cplusplus
  164. }
  165. #endif
  166. #endif /* __INCregh */