accel/tcg: Restrict tlb_protect/unprotect_code() to TCG
Both tlb_protect() and tlb_unprotect_code() are only used within accel/tcg/. Avoid exposing them to the whole code base, declare them in a new "system-page-protection.h" local header (maintaining the previous LGPL-2.1-or-later license). Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Message-ID: <20260705215729.62196-4-philmd@oss.qualcomm.com>
Philippe Mathieu-Daudé committed
Jun 30, 2026 at 13:11 UTC
cadee08114719304e8c662fb54a88b6c3b01c304
4 files changed
+22
-7
accel/tcg/cputlb.c
+2
-1
@@ -1,5 +1,5 @@
1
/*
2
- * Common CPU TLB handling
2
+ * Common CPU TLB handling (system emulation)
3
*
4
* Copyright (c) 2003 Fabrice Bellard
5
*
@@ -47,6 +47,7 @@
47
#include "tb-hash.h"
48
#include "tlb-bounds.h"
49
#include "internal-common.h"
50
+#include "system-page-protection.h"
51
#ifdef CONFIG_PLUGIN
52
#include "qemu/plugin-memory.h"
53
#endif
accel/tcg/system-page-protection.h
new
+17
@@ -0,0 +1,17 @@
1
+/*
2
+ * QEMU page protection (system emulation)
3
+ *
4
+ * Copyright (c) 2003 Fabrice Bellard
5
+ *
6
+ * SPDX-License-Identifier: LGPL-2.1-or-later
7
+ */
8
+#ifndef SYSTEM_PAGE_PROTECTION_H
9
+#define SYSTEM_PAGE_PROTECTION_H
10
+
11
+#include "system/ram_addr.h"
12
+
13
+void tlb_protect_code(ram_addr_t ram_addr);
14
+void tlb_unprotect_code(ram_addr_t ram_addr);
15
+
16
+#endif
17
+
accel/tcg/tb-maint.c
+1
@@ -38,6 +38,7 @@
38
#include "user/page-protection.h"
39
#define runstate_is_running() true
40
#else
41
+#include "system-page-protection.h"
42
#include "system/runstate.h"
43
#endif
44
#include "trace.h"
include/exec/cputlb.h
+2
-6
@@ -24,14 +24,10 @@
24
#include "exec/hwaddr.h"
25
#include "exec/memattrs.h"
26
#include "exec/vaddr.h"
27
-#include "system/ram_addr.h"
28
-
29
-#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
30
-void tlb_protect_code(ram_addr_t ram_addr);
31
-void tlb_unprotect_code(ram_addr_t ram_addr);
32
-#endif
27
28
#ifndef CONFIG_USER_ONLY
29
+#include "system/ram_addr.h"
30
+
31
void tlb_reset_dirty(CPUState *cpu, uintptr_t start, uintptr_t length);
32
void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
33
#endif