qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] linux-user: fix bug about incorrect base addresss of gdt on


From: Richard Henderson
Subject: Re: [PATCH] linux-user: fix bug about incorrect base addresss of gdt on i386 and x86_64
Date: Tue, 7 Mar 2023 10:20:34 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 3/7/23 06:30, Laurent Vivier wrote:
Richard,

do you think it's correct?

It's correct enough, until target/i386 is fixed to not require the GDT/LDT to be incorrectly mapped in the (ring 3) user address space.

You may wish to fix a few nits when applying:

  }
+static void target_cpu_free(void *obj)

Missing line before function.

+#if defined(TARGET_I386) || defined(TARGET_X86_64)
+    new_env->gdt.base = target_mmap(0, sizeof(uint64_t) * TARGET_GDT_ENTRIES,
+                                    PROT_READ|PROT_WRITE,
+                                    MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+    memcpy((void*)g2h_untagged(new_env->gdt.base), (void*)g2h_untagged(env->gdt.base), sizeof(uint64_t) * TARGET_GDT_ENTRIES);

Unnecessary casts, overlong line.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]