From: Chen Gang <cheng...@emindsoft.com.cn> 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. Signed-off-by: Chen Gang <cheng...@emindsoft.com.cn> --- linux-user/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/main.c b/linux-user/main.c index 8ffc525195..cad261fc7b 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -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. */ -- 2.24.0.308.g228f53135a