/* ** 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__ #elif defined(__NetBSD__) #define __BYTE_ORDER _BYTE_ORDER #define __BIG_ENDIAN _BIG_ENDIAN #define __LITTLE_ENDIAN _LITTLE_ENDIAN #endif #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)) 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< ((size) - 1))? \ (((int ## size ## _t) (value)) < 0 ? -1 : 0) : \ (((int ## size ## _t) (value)) >> (shift)))) #define SHIFT_RIGHT_LOGIC(size, value, shift) \ ((uint ## size ## _t)((((uint64_t) (shift)) > ((size) - 1))? \ 0 : \ (((uint ## size ## _t) (value)) >> (shift)))) #define SHIFT_LEFT_LOGIC(size, value, shift) \ ((uint ## size ## _t)((((uint64_t) (shift)) > ((size) - 1))? \ 0 : \ (((uint ## size ## _t) (value)) << (shift)))) #endif