tb-internal.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef ACCEL_TCG_TB_INTERNAL_TARGET_H
  9. #define ACCEL_TCG_TB_INTERNAL_TARGET_H
  10. #include "exec/cpu-all.h"
  11. #include "exec/exec-all.h"
  12. #include "exec/translation-block.h"
  13. #ifdef CONFIG_USER_ONLY
  14. #include "user/page-protection.h"
  15. /*
  16. * For user-only, page_protect sets the page read-only.
  17. * Since most execution is already on read-only pages, and we'd need to
  18. * account for other TBs on the same page, defer undoing any page protection
  19. * until we receive the write fault.
  20. */
  21. static inline void tb_lock_page0(tb_page_addr_t p0)
  22. {
  23. page_protect(p0);
  24. }
  25. static inline void tb_lock_page1(tb_page_addr_t p0, tb_page_addr_t p1)
  26. {
  27. page_protect(p1);
  28. }
  29. static inline void tb_unlock_page1(tb_page_addr_t p0, tb_page_addr_t p1) { }
  30. static inline void tb_unlock_pages(TranslationBlock *tb) { }
  31. #else
  32. void tb_lock_page0(tb_page_addr_t);
  33. void tb_lock_page1(tb_page_addr_t, tb_page_addr_t);
  34. void tb_unlock_page1(tb_page_addr_t, tb_page_addr_t);
  35. void tb_unlock_pages(TranslationBlock *);
  36. #endif
  37. #ifdef CONFIG_SOFTMMU
  38. void tb_invalidate_phys_range_fast(ram_addr_t ram_addr,
  39. unsigned size,
  40. uintptr_t retaddr);
  41. #endif /* CONFIG_SOFTMMU */
  42. bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc);
  43. void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);
  44. #endif