Commit 39cadf5b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

pstree: Move thread_core allocation to generic routine

It's not arch dependent by any means, thus it looks
strange that we allocate it in arch/ but free in
pstree.c.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 085747fb
......@@ -154,7 +154,6 @@ int arch_alloc_thread_info(CoreEntry *core)
ThreadInfoArm *ti_arm;
UserArmRegsEntry *gpregs;
UserArmVfpstateEntry *fpstate;
ThreadCoreEntry *thread_core;
ti_arm = xmalloc(sizeof(*ti_arm));
if (!ti_arm)
......@@ -176,12 +175,6 @@ int arch_alloc_thread_info(CoreEntry *core)
if (!fpstate->vfp_regs)
goto err;
thread_core = xmalloc(sizeof(*thread_core));
if (!thread_core)
goto err;
thread_core_entry__init(thread_core);
core->thread_core = thread_core;
return 0;
err:
return -1;
......
......@@ -232,7 +232,6 @@ int arch_alloc_thread_info(CoreEntry *core)
ThreadInfoX86 *thread_info;
UserX86RegsEntry *gpregs;
UserX86FpregsEntry *fpregs;
ThreadCoreEntry *thread_core;
thread_info = xmalloc(sizeof(*thread_info));
if (!thread_info)
......@@ -240,12 +239,6 @@ int arch_alloc_thread_info(CoreEntry *core)
thread_info_x86__init(thread_info);
core->thread_info = thread_info;
thread_core = xmalloc(sizeof(*thread_core));
if (!thread_core)
goto err;
thread_core_entry__init(thread_core);
core->thread_core = thread_core;
gpregs = xmalloc(sizeof(*gpregs));
if (!gpregs)
goto err;
......
......@@ -39,8 +39,16 @@ CoreEntry *core_entry_alloc(int alloc_thread_info, int alloc_tc)
core->mtype = CORE_ENTRY__MARCH;
if (alloc_thread_info) {
ThreadCoreEntry *thread_core;
if (arch_alloc_thread_info(core))
goto err;
thread_core = xmalloc(sizeof(*thread_core));
if (!thread_core)
goto err;
thread_core_entry__init(thread_core);
core->thread_core = thread_core;
}
if (alloc_tc) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment