Skip to contentSkip to conversation

linux-user: main: Let each env have its own gdt table

PATCH New [email protected] 2 participants 2 messages Mar 31, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: main: Let each env have its own gdt table

From: Chen Gang <[email protected]>

It is a temporary fix for thread LTS which need switch the ldt related index in gdt table for stable-4.1 branch.

Welcome anyone providing the complete fix.

---
 linux-user/main.c | 5 +++++
 1 file changed, 5 insertions(+)
linux-user/main.c +5 -0
index 8ffc525195..cad261fc7b 100644
@@ -194,12 +194,17 @@ CPUArchState *cpu_copy(CPUArchState *env)
     CPUArchState *new_env = new_cpu->env_ptr;
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
+    int size = sizeof(uint64_t) * TARGET_GDT_ENTRIES;
 
     /* Reset non arch specific state */
     cpu_reset(new_cpu);
 
     memcpy(new_env, env, sizeof(CPUArchState));
 
+    new_env->gdt.base = target_mmap(0, size, PROT_READ | PROT_WRITE,
+                                     MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+    memcpy(g2h(new_env->gdt.base), g2h(env->gdt.base), size);
+
     /* Clone all break/watchpoints.
        Note: Once we support ptrace with hw-debug register access, make sure
        BP_CPU break/watchpoints are handled correctly on clone. */
Signature · 1 line
2.24.0.308.g228f53135a
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

GEN /var/tmp/patchew-tester-tmp-3vo4s26o/src/docker-src.2020-03-31-07.20.41.28179/qemu.tar
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
error: RPC failed; result=7, HTTP code = 0
fatal: The remote end hung up unexpectedly
Clone of 'https://git.qemu.org/git/dtc.git' into submodule path 'dtc' failed
failed to update submodule dtc
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) unregistered for path 'dtc' make[1]: *** [/var/tmp/patchew-tester-tmp-3vo4s26o/src/docker-src.2020-03-31-07.20.41.28179] Error 1 make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-3vo4s26o/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real 2m13.209s
user 0m2.324s

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]