1 /* 2 * TranslationBlock internal declarations (target specific) 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * 6 * SPDX-License-Identifier: LGPL-2.1-or-later 7 */ 8 9 #ifndef ACCEL_TCG_TB_INTERNAL_TARGET_H 10 #define ACCEL_TCG_TB_INTERNAL_TARGET_H 11 12 #include "exec/cpu-all.h" 13 #include "exec/exec-all.h" 14 #include "exec/translation-block.h" 15 16 #ifdef CONFIG_USER_ONLY 17 #include "user/page-protection.h" 18 /* 19 * For user-only, page_protect sets the page read-only. 20 * Since most execution is already on read-only pages, and we'd need to 21 * account for other TBs on the same page, defer undoing any page protection 22 * until we receive the write fault. 23 */ 24 static inline void tb_lock_page0(tb_page_addr_t p0) 25 { 26 page_protect(p0); 27 } 28 29 static inline void tb_lock_page1(tb_page_addr_t p0, tb_page_addr_t p1) 30 { 31 page_protect(p1); 32 } 33 34 static inline void tb_unlock_page1(tb_page_addr_t p0, tb_page_addr_t p1) { } 35 static inline void tb_unlock_pages(TranslationBlock *tb) { } 36 #else 37 void tb_lock_page0(tb_page_addr_t); 38 void tb_lock_page1(tb_page_addr_t, tb_page_addr_t); 39 void tb_unlock_page1(tb_page_addr_t, tb_page_addr_t); 40 void tb_unlock_pages(TranslationBlock *); 41 #endif 42 43 #ifdef CONFIG_SOFTMMU 44 void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, 45 unsigned size, 46 uintptr_t retaddr); 47 #endif /* CONFIG_SOFTMMU */ 48 49 bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc); 50 51 void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr); 52 53 #endif 54