aicasm_insformat.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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#7 $
  41.  *
  42.  * $FreeBSD: src/sys/dev/aic7xxx/aicasm/aicasm_insformat.h,v 1.3 2000/09/22 22:19:54 gibbs Exp $
  43.  */
  44. struct ins_format1 {
  45. #if BYTE_ORDER == LITTLE_ENDIAN
  46. uint32_t immediate : 8,
  47. source : 9,
  48. destination : 9,
  49. ret : 1,
  50. opcode : 4,
  51. parity : 1;
  52. #else
  53. uint32_t parity : 1,
  54. opcode : 4,
  55. ret : 1,
  56. destination : 9,
  57. source : 9,
  58. immediate : 8;
  59. #endif
  60. };
  61. struct ins_format2 {
  62. #if BYTE_ORDER == LITTLE_ENDIAN
  63. uint32_t shift_control : 8,
  64. source : 9,
  65. destination : 9,
  66. ret : 1,
  67. opcode : 4,
  68. parity : 1;
  69. #else
  70. uint32_t parity : 1,
  71. opcode : 4,
  72. ret : 1,
  73. destination : 9,
  74. source : 9,
  75. shift_control : 8;
  76. #endif
  77. };
  78. struct ins_format3 {
  79. #if BYTE_ORDER == LITTLE_ENDIAN
  80. uint32_t immediate : 8,
  81. source : 9,
  82. address : 10,
  83. opcode : 4,
  84. parity : 1;
  85. #else
  86. uint32_t parity : 1,
  87. opcode : 4,
  88. address : 10,
  89. source : 9,
  90. immediate : 8;
  91. #endif
  92. };
  93. union ins_formats {
  94. struct ins_format1 format1;
  95. struct ins_format2 format2;
  96. struct ins_format3 format3;
  97. uint8_t    bytes[4];
  98. uint32_t    integer;
  99. };
  100. struct instruction {
  101. union ins_formats format;
  102. u_int srcline;
  103. struct symbol *patch_label;
  104. STAILQ_ENTRY(instruction) links;
  105. };
  106. #define AIC_OP_OR 0x0
  107. #define AIC_OP_AND 0x1
  108. #define AIC_OP_XOR 0x2
  109. #define AIC_OP_ADD 0x3
  110. #define AIC_OP_ADC 0x4
  111. #define AIC_OP_ROL 0x5
  112. #define AIC_OP_BMOV 0x6
  113. #define AIC_OP_JMP 0x8
  114. #define AIC_OP_JC 0x9
  115. #define AIC_OP_JNC 0xa
  116. #define AIC_OP_CALL 0xb
  117. #define AIC_OP_JNE 0xc
  118. #define AIC_OP_JNZ 0xd
  119. #define AIC_OP_JE 0xe
  120. #define AIC_OP_JZ 0xf
  121. /* Pseudo Ops */
  122. #define AIC_OP_SHL 0x10
  123. #define AIC_OP_SHR 0x20
  124. #define AIC_OP_ROR 0x30