* [PATCH 0/2] target/i386: emulate: MMU fixes
@ 2026-03-24 23:00 Mohamed Mediouni
2026-03-24 23:00 ` [PATCH 1/2] target/i386: emulate: set PG_ERROR_W_MASK as expected Mohamed Mediouni
2026-03-24 23:00 ` [PATCH 2/2] target/i386: emulate: follow priv_check_exempt Mohamed Mediouni
0 siblings, 2 replies; 3+ messages in thread
From: Mohamed Mediouni @ 2026-03-24 23:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Roman Bolshakov, Wei Liu, Phil Dennis-Jordan, Mohamed Mediouni
Two small commits I had around...
Mohamed Mediouni (2):
target/i386: emulate: set PG_ERROR_W_MASK as expected
target/i386: emulate: follow priv_check_exempt
target/i386/emulate/x86_mmu.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] target/i386: emulate: set PG_ERROR_W_MASK as expected
2026-03-24 23:00 [PATCH 0/2] target/i386: emulate: MMU fixes Mohamed Mediouni
@ 2026-03-24 23:00 ` Mohamed Mediouni
2026-03-24 23:00 ` [PATCH 2/2] target/i386: emulate: follow priv_check_exempt Mohamed Mediouni
1 sibling, 0 replies; 3+ messages in thread
From: Mohamed Mediouni @ 2026-03-24 23:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Roman Bolshakov, Wei Liu, Phil Dennis-Jordan, Mohamed Mediouni
Make setting PG_ERROR_W_MASK no longer dependent on the access
being a priv violation.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
target/i386/emulate/x86_mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/emulate/x86_mmu.c b/target/i386/emulate/x86_mmu.c
index ba0ebe4268..1aa373f5b3 100644
--- a/target/i386/emulate/x86_mmu.c
+++ b/target/i386/emulate/x86_mmu.c
@@ -248,7 +248,7 @@ static int translate_res_to_error_code(MMUTranslateResult res, bool is_write, bo
if (!(res & MMU_TRANSLATE_PAGE_NOT_MAPPED)) {
error_code |= PG_ERROR_P_MASK;
}
- if (is_write && (res & MMU_TRANSLATE_PRIV_VIOLATION)) {
+ if (is_write) {
error_code |= PG_ERROR_W_MASK;
}
if (res & MMU_TRANSLATE_INVALID_PT_FLAGS) {
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] target/i386: emulate: follow priv_check_exempt
2026-03-24 23:00 [PATCH 0/2] target/i386: emulate: MMU fixes Mohamed Mediouni
2026-03-24 23:00 ` [PATCH 1/2] target/i386: emulate: set PG_ERROR_W_MASK as expected Mohamed Mediouni
@ 2026-03-24 23:00 ` Mohamed Mediouni
1 sibling, 0 replies; 3+ messages in thread
From: Mohamed Mediouni @ 2026-03-24 23:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Roman Bolshakov, Wei Liu, Phil Dennis-Jordan, Mohamed Mediouni
Follow priv_check_exempt flag argument for
x86_write_mem_priv/x86_read_mem_priv.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
target/i386/emulate/x86_mmu.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/target/i386/emulate/x86_mmu.c b/target/i386/emulate/x86_mmu.c
index 1aa373f5b3..c69ae96acb 100644
--- a/target/i386/emulate/x86_mmu.c
+++ b/target/i386/emulate/x86_mmu.c
@@ -263,14 +263,19 @@ static MMUTranslateResult x86_write_mem_ex(CPUState *cpu, void *data, target_ulo
CPUX86State *env = &x86_cpu->env;
MMUTranslateResult translate_res = MMU_TRANSLATE_SUCCESS;
+ MMUTranslateFlags translate_flags = MMU_TRANSLATE_VALIDATE_WRITE;
MemTxResult mem_tx_res;
uint64_t gpa;
+ if (priv_check_exempt) {
+ translate_flags |= MMU_TRANSLATE_PRIV_CHECKS_EXEMPT;
+ }
+
while (bytes > 0) {
/* copy page */
int copy = MIN(bytes, 0x1000 - (gva & 0xfff));
- translate_res = mmu_gva_to_gpa(cpu, gva, &gpa, MMU_TRANSLATE_VALIDATE_WRITE);
+ translate_res = mmu_gva_to_gpa(cpu, gva, &gpa, translate_flags);
if (translate_res) {
int error_code = translate_res_to_error_code(translate_res, true, is_user(cpu));
env->cr[2] = gva;
@@ -311,14 +316,19 @@ static MMUTranslateResult x86_read_mem_ex(CPUState *cpu, void *data, target_ulon
CPUX86State *env = &x86_cpu->env;
MMUTranslateResult translate_res = MMU_TRANSLATE_SUCCESS;
+ MMUTranslateFlags translate_flags = 0;
MemTxResult mem_tx_res;
uint64_t gpa;
+ if (priv_check_exempt) {
+ translate_flags |= MMU_TRANSLATE_PRIV_CHECKS_EXEMPT;
+ }
+
while (bytes > 0) {
/* copy page */
int copy = MIN(bytes, 0x1000 - (gva & 0xfff));
- translate_res = mmu_gva_to_gpa(cpu, gva, &gpa, 0);
+ translate_res = mmu_gva_to_gpa(cpu, gva, &gpa, translate_flags);
if (translate_res) {
int error_code = translate_res_to_error_code(translate_res, false, is_user(cpu));
env->cr[2] = gva;
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-24 23:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 23:00 [PATCH 0/2] target/i386: emulate: MMU fixes Mohamed Mediouni
2026-03-24 23:00 ` [PATCH 1/2] target/i386: emulate: set PG_ERROR_W_MASK as expected Mohamed Mediouni
2026-03-24 23:00 ` [PATCH 2/2] target/i386: emulate: follow priv_check_exempt Mohamed Mediouni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox