1 /* 2 * x86 segmentation related helpers macros 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library 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 GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef SEG_HELPER_H 21 #define SEG_HELPER_H 22 23 #include "cpu.h" 24 25 //#define DEBUG_PCALL 26 27 #ifdef DEBUG_PCALL 28 # define LOG_PCALL(...) qemu_log_mask(CPU_LOG_PCALL, ## __VA_ARGS__) 29 # define LOG_PCALL_STATE(cpu) \ 30 log_cpu_state_mask(CPU_LOG_PCALL, (cpu), CPU_DUMP_CCOP) 31 #else 32 # define LOG_PCALL(...) do { } while (0) 33 # define LOG_PCALL_STATE(cpu) do { } while (0) 34 #endif 35 36 int cpu_mmu_index_kernel(CPUX86State *env); 37 38 /* 39 * TODO: Convert callers to compute cpu_mmu_index_kernel once 40 * and use *_mmuidx_ra directly. 41 */ 42 #define cpu_lduw_kernel_ra(e, p, r) \ 43 cpu_lduw_mmuidx_ra(e, p, cpu_mmu_index_kernel(e), r) 44 #define cpu_ldl_kernel_ra(e, p, r) \ 45 cpu_ldl_mmuidx_ra(e, p, cpu_mmu_index_kernel(e), r) 46 #define cpu_ldq_kernel_ra(e, p, r) \ 47 cpu_ldq_mmuidx_ra(e, p, cpu_mmu_index_kernel(e), r) 48 49 #define cpu_stw_kernel_ra(e, p, v, r) \ 50 cpu_stw_mmuidx_ra(e, p, v, cpu_mmu_index_kernel(e), r) 51 #define cpu_stl_kernel_ra(e, p, v, r) \ 52 cpu_stl_mmuidx_ra(e, p, v, cpu_mmu_index_kernel(e), r) 53 #define cpu_stq_kernel_ra(e, p, v, r) \ 54 cpu_stq_mmuidx_ra(e, p, v, cpu_mmu_index_kernel(e), r) 55 56 #define cpu_lduw_kernel(e, p) cpu_lduw_kernel_ra(e, p, 0) 57 #define cpu_ldl_kernel(e, p) cpu_ldl_kernel_ra(e, p, 0) 58 #define cpu_ldq_kernel(e, p) cpu_ldq_kernel_ra(e, p, 0) 59 60 #define cpu_stw_kernel(e, p, v) cpu_stw_kernel_ra(e, p, v, 0) 61 #define cpu_stl_kernel(e, p, v) cpu_stl_kernel_ra(e, p, v, 0) 62 #define cpu_stq_kernel(e, p, v) cpu_stq_kernel_ra(e, p, v, 0) 63 64 #endif /* SEG_HELPER_H */ 65