OSDN Git Service

update libMiMic
[mimic/MiMicSDK.git] / lib / src / mimicvm / NyLPC_cMiMicVM_protected.h
1 /*********************************************************************************\r
2  * PROJECT: MiMic\r
3  * --------------------------------------------------------------------------------\r
4  *\r
5  * This file is part of MiMic\r
6  * Copyright (C)2011 Ryo Iizuka\r
7  *\r
8  * MiMic is free software: you can redistribute it and/or modify\r
9  * it under the terms of the GNU Lesser General Public License as published\r
10  * by the Free Software Foundation, either version 3 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU Lesser General Public License\r
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
20  *\r
21  * For further information please contact.\r
22  *  http://nyatla.jp/\r
23  *  <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>\r
24  *\r
25  *********************************************************************************/\r
26 #ifndef NYLPC_CMIMICVM_PROTECTED_H_\r
27 #define NYLPC_CMIMICVM_PROTECTED_H_\r
28 #include "NyLPC_cMiMicVM.h"\r
29 \r
30 #ifdef __cplusplus\r
31 extern "C" {\r
32 #endif /* __cplusplus */\r
33 //----------------------------------------------------------------------\r
34 //MiMicOpCodeのタイプ値\r
35 //----------------------------------------------------------------------\r
36 \r
37 #define NyLPC_TcMiMicVM_OP_TYPE_AND    0x11\r
38 #define NyLPC_TcMiMicVM_OP_TYPE_OR     0x12\r
39 #define NyLPC_TcMiMicVM_OP_TYPE_XOR    0x13\r
40 #define NyLPC_TcMiMicVM_OP_TYPE_NOT    0x14\r
41 \r
42 #define NyLPC_TcMiMicVM_OP_TYPE_SHL    0x21\r
43 #define NyLPC_TcMiMicVM_OP_TYPE_SHR    0x22\r
44 \r
45 #define NyLPC_TcMiMicVM_OP_TYPE_ADD    0x31\r
46 #define NyLPC_TcMiMicVM_OP_TYPE_SUB    0x32\r
47 #define NyLPC_TcMiMicVM_OP_TYPE_MUL    0x33\r
48 \r
49 #define NyLPC_TcMiMicVM_OP_TYPE_MGET    0x41\r
50 #define NyLPC_TcMiMicVM_OP_TYPE_MPUT    0x42\r
51 \r
52 #define NyLPC_TcMiMicVM_OP_TYPE_SGET    0x51\r
53 #define NyLPC_TcMiMicVM_OP_TYPE_SPUT    0x52\r
54 \r
55 #define NyLPC_TcMiMicVM_OP_TYPE_NOP     0x61\r
56 #define NyLPC_TcMiMicVM_OP_TYPE_EXIT    0x62\r
57 #define NyLPC_TcMiMicVM_OP_TYPE_CALL    0x63\r
58 \r
59 #define NyLPC_TcMiMicVM_OP_TYPE_LD      0x71\r
60 \r
61 \r
62 #define NyLPC_TcMiMicVM_CP_TYPE_END    0x01\r
63 /*\r
64 #define NyLPC_TcMiMicVM_OP_TYPE_V_END  0x1001\r
65 #define NyLPC_TcMiMicVM_OP_TYPE_V_DB8  0x1011\r
66 #define NyLPC_TcMiMicVM_OP_TYPE_V_DB16 0x1012\r
67 #define NyLPC_TcMiMicVM_OP_TYPE_V_DB32 0x1013\r
68 */\r
69 \r
70 //----------------------------------------------------------------------\r
71 //MiMicOprandのタイプ値\r
72 //----------------------------------------------------------------------\r
73 \r
74 #define NyLPC_TcMiMicVM_OPR_TYPE_NONE    0x01\r
75 #define NyLPC_TcMiMicVM_OPR_TYPE_WM_WM   0x11\r
76 #define NyLPC_TcMiMicVM_OPR_TYPE_WM_H08  0x12\r
77 #define NyLPC_TcMiMicVM_OPR_TYPE_WM_H16  0x13\r
78 #define NyLPC_TcMiMicVM_OPR_TYPE_WM_H32  0x14\r
79 #define NyLPC_TcMiMicVM_OPR_TYPE_WM      0x21\r
80 #define NyLPC_TcMiMicVM_OPR_TYPE_H08     0x22\r
81 #define NyLPC_TcMiMicVM_OPR_TYPE_H16     0x23\r
82 #define NyLPC_TcMiMicVM_OPR_TYPE_H32     0x24\r
83 \r
84 \r
85 \r
86 \r
87 \r
88 /**\r
89  * インストラクションセットのバイナリデータ型。\r
90  * MiMicVMで実行するインストラクションをバッファから参照するために使います。\r
91  * キャスト元のバッファは、32bitのunsigned intを想定しています。境界は32bit単位です。\r
92  *\r
93  * 構造体は、\r
94  *\r
95  */\r
96 union NyLPC_TcMiMicVM_TInstruction{\r
97     /**\r
98      * オペコード情報のみを格納します\r
99      */\r
100     struct{\r
101         NyLPC_TcMiMicVM_OP_TYPE opc;\r
102         NyLPC_TUInt8 oprtype;\r
103     }op;\r
104     //32ビットコード\r
105 \r
106     /**\r
107      * WM[8],WM[8]オペランドの命令を格納します。\r
108      */\r
109     struct{\r
110         NyLPC_TcMiMicVM_OP_TYPE opc;\r
111         NyLPC_TUInt8 oprtype;\r
112         NyLPC_TUInt8 wm1;\r
113         NyLPC_TUInt8 wm2;\r
114     }wmwm_32;\r
115     struct{\r
116         NyLPC_TcMiMicVM_OP_TYPE opc;\r
117         NyLPC_TUInt8 oprtype;\r
118         NyLPC_TUInt8 wm;\r
119         NyLPC_TUInt8 h8;\r
120     }wmh08_32;\r
121     struct{\r
122         NyLPC_TcMiMicVM_OP_TYPE opc;\r
123         NyLPC_TUInt8 oprtype;\r
124         NyLPC_TUInt8  wm;\r
125     }wm_32;\r
126     struct{\r
127         NyLPC_TcMiMicVM_OP_TYPE opc;\r
128         NyLPC_TUInt8 oprtype;\r
129         NyLPC_TUInt8  h8;\r
130     }h8_32;\r
131     struct{\r
132         NyLPC_TcMiMicVM_OP_TYPE opc;\r
133         NyLPC_TUInt8 oprtype;\r
134         NyLPC_TUInt8  h16;\r
135     }h16_32;\r
136     //64bit命令\r
137     struct{\r
138         NyLPC_TcMiMicVM_OP_TYPE opc;\r
139         NyLPC_TUInt8 oprtype;\r
140         NyLPC_TUInt8  wm;\r
141         NyLPC_TUInt8  _padding;\r
142         NyLPC_TUInt16 h16;\r
143     }wmh16_64;\r
144     struct{\r
145         NyLPC_TcMiMicVM_OP_TYPE opc;\r
146         NyLPC_TUInt8 oprtype;\r
147         NyLPC_TUInt8  wm;\r
148         NyLPC_TUInt8  _padding;\r
149         NyLPC_TUInt32 h32;\r
150     }wmh32_64;\r
151     struct{\r
152         NyLPC_TcMiMicVM_OP_TYPE opc;\r
153         NyLPC_TUInt8 oprtype;\r
154         NyLPC_TUInt8  _padding[2];\r
155         NyLPC_TUInt32 h32;\r
156     }h32_64;\r
157 };\r
158 \r
159 #ifdef __cplusplus\r
160 }\r
161 #endif /* __cplusplus */\r
162 \r
163 #endif /* NYLPC_CMIMICVM_PROTECTED_H_ */\r