reg.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* $OpenBSD: reg.h,v 1.3 2003/06/02 23:27:54 millert Exp $ */
  2. /* $NetBSD: reg.h,v 1.4 1994/11/20 20:53:28 deraadt Exp $ */
  3. /*
  4. * Copyright (c) 1992, 1993
  5. * The Regents of the University of California. All rights reserved.
  6. *
  7. * This software was developed by the Computer Systems Engineering group
  8. * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
  9. * contributed to Berkeley.
  10. *
  11. * All advertising materials mentioning features or use of this software
  12. * must display the following acknowledgement:
  13. * This product includes software developed by the University of
  14. * California, Lawrence Berkeley Laboratory.
  15. *
  16. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions
  18. * are met:
  19. * 1. Redistributions of source code must retain the above copyright
  20. * notice, this list of conditions and the following disclaimer.
  21. * 2. Redistributions in binary form must reproduce the above copyright
  22. * notice, this list of conditions and the following disclaimer in the
  23. * documentation and/or other materials provided with the distribution.
  24. * 3. Neither the name of the University nor the names of its contributors
  25. * may be used to endorse or promote products derived from this software
  26. * without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  29. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  32. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  37. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  38. * SUCH DAMAGE.
  39. *
  40. * @(#)reg.h 8.1 (Berkeley) 6/11/93
  41. */
  42. #ifndef _MACHINE_REG_H_
  43. #define _MACHINE_REG_H_
  44. /*
  45. * Registers passed to trap/syscall/etc.
  46. * This structure is known to occupy exactly 80 bytes (see locore.s).
  47. * Note, tf_global[0] is not actually written (since g0 is always 0).
  48. * (The slot tf_global[0] is used to send a copy of %wim to kernel gdb.
  49. * This is known as `cheating'.)
  50. */
  51. struct trapframe {
  52. int tf_psr; /* psr */
  53. int tf_pc; /* return pc */
  54. int tf_npc; /* return npc */
  55. int tf_y; /* %y register */
  56. int tf_global[8]; /* global registers in trap's caller */
  57. int tf_out[8]; /* output registers in trap's caller */
  58. };
  59. /*
  60. * Register windows. Each stack pointer (%o6 aka %sp) in each window
  61. * must ALWAYS point to some place at which it is safe to scribble on
  62. * 64 bytes. (If not, your process gets mangled.) Furthermore, each
  63. * stack pointer should be aligned on an 8-byte boundary (the kernel
  64. * as currently coded allows arbitrary alignment, but with a hefty
  65. * performance penalty).
  66. */
  67. struct rwindow {
  68. int rw_local[8]; /* %l0..%l7 */
  69. int rw_in[8]; /* %i0..%i7 */
  70. };
  71. /*
  72. * Clone trapframe for now; this seems to be the more useful
  73. * than the old struct reg above.
  74. */
  75. struct reg {
  76. int r_psr; /* psr */
  77. int r_pc; /* return pc */
  78. int r_npc; /* return npc */
  79. int r_y; /* %y register */
  80. int r_global[8]; /* global registers in trap's caller */
  81. int r_out[8]; /* output registers in trap's caller */
  82. };
  83. #include <machine/fsr.h>
  84. /*
  85. * FP coprocessor registers.
  86. *
  87. * FP_QSIZE is the maximum coprocessor instruction queue depth
  88. * of any implementation on which the kernel will run. David Hough:
  89. * ``I'd suggest allowing 16 ... allowing an indeterminate variable
  90. * size would be even better''. Of course, we cannot do that; we
  91. * need to malloc these.
  92. */
  93. #define FP_QSIZE 16
  94. struct fp_qentry {
  95. int *fq_addr; /* the instruction's address */
  96. int fq_instr; /* the instruction itself */
  97. };
  98. struct fpstate {
  99. u_int fs_regs[32]; /* our view is 32 32-bit registers */
  100. int fs_fsr; /* %fsr */
  101. int fs_qsize; /* actual queue depth */
  102. struct fp_qentry fs_queue[FP_QSIZE]; /* queue contents */
  103. };
  104. /*
  105. * Clone fpstate into an fpreg structure to satisfy <kern/sys_process.c>
  106. */
  107. struct fpreg {
  108. u_int fr_regs[32]; /* our view is 32 32-bit registers */
  109. int fr_fsr; /* %fsr */
  110. int fr_qsize; /* actual queue depth */
  111. struct fp_qentry fr_queue[FP_QSIZE]; /* queue contents */
  112. };
  113. #endif /* _MACHINE_REG_H_ */