aicasm_insformat.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * Instruction formats for the sequencer program downloaded to
  3. * Aic7xxx SCSI host adapters
  4. *
  5. * Copyright (c) 1997, 1998, 2000 Justin T. Gibbs.
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions, and the following disclaimer,
  13. * without modification.
  14. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  15. * substantially similar to the "NO WARRANTY" disclaimer below
  16. * ("Disclaimer") and any redistribution must be conditioned upon
  17. * including a substantially similar Disclaimer requirement for further
  18. * binary redistribution.
  19. * 3. Neither the names of the above-listed copyright holders nor the names
  20. * of any contributors may be used to endorse or promote products derived
  21. * from this software without specific prior written permission.
  22. *
  23. * Alternatively, this software may be distributed under the terms of the
  24. * GNU General Public License ("GPL") version 2 as published by the Free
  25. * Software Foundation.
  26. *
  27. * NO WARRANTY
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  31. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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,
  36. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  37. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. * POSSIBILITY OF SUCH DAMAGES.
  39. *
  40. * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_insformat.h#11 $
  41. *
  42. * $FreeBSD$
  43. */
  44. #include <asm/byteorder.h>
  45. struct ins_format1 {
  46. #ifdef __LITTLE_ENDIAN
  47. uint32_t immediate : 8,
  48. source : 9,
  49. destination : 9,
  50. ret : 1,
  51. opcode : 4,
  52. parity : 1;
  53. #else
  54. uint32_t parity : 1,
  55. opcode : 4,
  56. ret : 1,
  57. destination : 9,
  58. source : 9,
  59. immediate : 8;
  60. #endif
  61. };
  62. struct ins_format2 {
  63. #ifdef __LITTLE_ENDIAN
  64. uint32_t shift_control : 8,
  65. source : 9,
  66. destination : 9,
  67. ret : 1,
  68. opcode : 4,
  69. parity : 1;
  70. #else
  71. uint32_t parity : 1,
  72. opcode : 4,
  73. ret : 1,
  74. destination : 9,
  75. source : 9,
  76. shift_control : 8;
  77. #endif
  78. };
  79. struct ins_format3 {
  80. #ifdef __LITTLE_ENDIAN
  81. uint32_t immediate : 8,
  82. source : 9,
  83. address : 10,
  84. opcode : 4,
  85. parity : 1;
  86. #else
  87. uint32_t parity : 1,
  88. opcode : 4,
  89. address : 10,
  90. source : 9,
  91. immediate : 8;
  92. #endif
  93. };
  94. union ins_formats {
  95. struct ins_format1 format1;
  96. struct ins_format2 format2;
  97. struct ins_format3 format3;
  98. uint8_t bytes[4];
  99. uint32_t integer;
  100. };
  101. struct instruction {
  102. union ins_formats format;
  103. u_int srcline;
  104. struct symbol *patch_label;
  105. STAILQ_ENTRY(instruction) links;
  106. };
  107. #define AIC_OP_OR 0x0
  108. #define AIC_OP_AND 0x1
  109. #define AIC_OP_XOR 0x2
  110. #define AIC_OP_ADD 0x3
  111. #define AIC_OP_ADC 0x4
  112. #define AIC_OP_ROL 0x5
  113. #define AIC_OP_BMOV 0x6
  114. #define AIC_OP_JMP 0x8
  115. #define AIC_OP_JC 0x9
  116. #define AIC_OP_JNC 0xa
  117. #define AIC_OP_CALL 0xb
  118. #define AIC_OP_JNE 0xc
  119. #define AIC_OP_JNZ 0xd
  120. #define AIC_OP_JE 0xe
  121. #define AIC_OP_JZ 0xf
  122. /* Pseudo Ops */
  123. #define AIC_OP_SHL 0x10
  124. #define AIC_OP_SHR 0x20
  125. #define AIC_OP_ROR 0x30