mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
cpu: Move cpu_copy() into linux-user
It is only used there and is deemed very fragile if not incorrect in its current memcpy() form. Moving it into linux-user will allow to move parts into target_cpu.h headers and only copy what the ABI mandates. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
812586405c
commit
30ba0ee52d
2 changed files with 31 additions and 32 deletions
|
@ -3285,6 +3285,37 @@ void init_task_state(TaskState *ts)
|
|||
ts->sigqueue_table[i].next = NULL;
|
||||
}
|
||||
|
||||
CPUArchState *cpu_copy(CPUArchState *env)
|
||||
{
|
||||
CPUArchState *new_env = cpu_init(env->cpu_model_str);
|
||||
#if defined(TARGET_HAS_ICE)
|
||||
CPUBreakpoint *bp;
|
||||
CPUWatchpoint *wp;
|
||||
#endif
|
||||
|
||||
/* Reset non arch specific state */
|
||||
cpu_reset(ENV_GET_CPU(new_env));
|
||||
|
||||
memcpy(new_env, env, sizeof(CPUArchState));
|
||||
|
||||
/* 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. */
|
||||
QTAILQ_INIT(&env->breakpoints);
|
||||
QTAILQ_INIT(&env->watchpoints);
|
||||
#if defined(TARGET_HAS_ICE)
|
||||
QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
|
||||
cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
|
||||
}
|
||||
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
|
||||
cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
|
||||
wp->flags, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
return new_env;
|
||||
}
|
||||
|
||||
static void handle_arg_help(const char *arg)
|
||||
{
|
||||
usage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue