/* ** Copyright (C) 2011 EADS France, Fabrice Desclaux ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License along ** with this program; if not, write to the Free Software Foundation, Inc., ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef CODENAT_H #define CODENAT_H #ifdef __APPLE__ #define __BYTE_ORDER __BYTE_ORDER__ #endif #if __BYTE_ORDER == __BIG_ENDIAN #define Endian16_Swap(value) \ ((((uint16_t)((value) & 0x00FF)) << 8) | \ (((uint16_t)((value) & 0xFF00)) >> 8)) #define Endian32_Swap(value) \ ((((uint32_t)((value) & 0x000000FF)) << 24) | \ (((uint32_t)((value) & 0x0000FF00)) << 8) | \ (((uint32_t)((value) & 0x00FF0000)) >> 8) | \ (((uint32_t)((value) & 0xFF000000)) >> 24)) #define Endian64_Swap(value) \ (((((uint64_t)value)<<56) & 0xFF00000000000000ULL) | \ ((((uint64_t)value)<<40) & 0x00FF000000000000ULL) | \ ((((uint64_t)value)<<24) & 0x0000FF0000000000ULL) | \ ((((uint64_t)value)<< 8) & 0x000000FF00000000ULL) | \ ((((uint64_t)value)>> 8) & 0x00000000FF000000ULL) | \ ((((uint64_t)value)>>24) & 0x0000000000FF0000ULL) | \ ((((uint64_t)value)>>40) & 0x000000000000FF00ULL) | \ ((((uint64_t)value)>>56) & 0x00000000000000FFULL)) #else #define Endian16_Swap(value) (value) #define Endian32_Swap(value) (value) #define Endian64_Swap(value) (value) #endif LIST_HEAD(memory_page_list_head, memory_page_node); LIST_HEAD(code_bloc_list_head, code_bloc_node); LIST_HEAD(memory_breakpoint_info_head, memory_breakpoint_info); #define BREAKPOINT_READ 1 #define BREAKPOINT_WRITE 2 #define BREAK_SIGALARM 1<<5 #define MAX_MEMORY_PAGE_POOL_TAB 0x100000 #define MEMORY_PAGE_POOL_MASK_BIT 12 #define PAGE_SIZE (1<> ((int)(b)&0x1f))&0xff) #define shift_right_arith_16(a, b)\ ((((short)(a)) >> ((int)(b)&0x1f))&0xffff) #define shift_right_arith_32(a, b)\ ((((int)(a)) >> ((int)(b)&0x1f))&0xffffffff) #define shift_right_logic_08(a, b)\ ((((unsigned char)(a)) >> ((unsigned int)(b)&0x1f))&0xff) #define shift_right_logic_16(a, b)\ ((((unsigned short)(a)) >> ((unsigned int)(b)&0x1f))&0xffff) #define shift_right_logic_32(a, b)\ ((((unsigned int)(a)) >> ((unsigned int)(b)&0x1f))&0xffffffff) #define shift_left_logic_08(a, b)\ (((a)<<((b)&0x1f))&0xff) #define shift_left_logic_16(a, b)\ (((a)<<((b)&0x1f))&0xffff) #define shift_left_logic_32(a, b)\ (((a)<<((b)&0x1f))&0xffffffff) #endif