Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
f3b84d28
Commit
f3b84d28
authored
Mar 13, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: Allocate x76 core entry with single (almost) xmalloc
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
2616c87d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
40 deletions
+38
-40
crtools.c
arch/x86/crtools.c
+38
-40
No files found.
arch/x86/crtools.c
View file @
f3b84d28
...
@@ -227,28 +227,37 @@ err:
...
@@ -227,28 +227,37 @@ err:
int
arch_alloc_thread_info
(
CoreEntry
*
core
)
int
arch_alloc_thread_info
(
CoreEntry
*
core
)
{
{
ThreadInfoX86
*
thread_info
;
size_t
sz
;
UserX86RegsEntry
*
gpregs
;
bool
with_fpu
,
with_xsave
;
UserX86FpregsEntry
*
fpregs
;
void
*
m
;
ThreadInfoX86
*
ti
=
NULL
;
thread_info
=
xmalloc
(
sizeof
(
*
thread_info
));
if
(
!
thread_info
)
goto
err
;
with_fpu
=
cpu_has_feature
(
X86_FEATURE_FPU
);
thread_info_x86__init
(
thread_info
);
core
->
thread_info
=
thread_info
;
sz
=
sizeof
(
ThreadInfoX86
)
+
sizeof
(
UserX86RegsEntry
);
if
(
with_fpu
)
{
gpregs
=
xmalloc
(
sizeof
(
*
gpregs
));
sz
+=
sizeof
(
UserX86FpregsEntry
);
if
(
!
gpregs
)
with_xsave
=
cpu_has_feature
(
X86_FEATURE_XSAVE
);
goto
err
;
if
(
with_xsave
)
user_x86_regs_entry__init
(
gpregs
);
sz
+=
sizeof
(
UserX86XsaveEntry
);
thread_info
->
gpregs
=
gpregs
;
}
if
(
cpu_has_feature
(
X86_FEATURE_FPU
))
{
m
=
xmalloc
(
sz
);
fpregs
=
xmalloc
(
sizeof
(
*
fpregs
));
if
(
!
m
)
if
(
!
fpregs
)
return
-
1
;
goto
err
;
ti
=
core
->
thread_info
=
xptr_pull
(
&
m
,
ThreadInfoX86
);
thread_info_x86__init
(
ti
);
ti
->
gpregs
=
xptr_pull
(
&
m
,
UserX86RegsEntry
);
user_x86_regs_entry__init
(
ti
->
gpregs
);
if
(
with_fpu
)
{
UserX86FpregsEntry
*
fpregs
;
fpregs
=
ti
->
fpregs
=
xptr_pull
(
&
m
,
UserX86FpregsEntry
);
user_x86_fpregs_entry__init
(
fpregs
);
user_x86_fpregs_entry__init
(
fpregs
);
thread_info
->
fpregs
=
fpregs
;
/* These are numbers from kernel */
/* These are numbers from kernel */
fpregs
->
n_st_space
=
32
;
fpregs
->
n_st_space
=
32
;
fpregs
->
n_xmm_space
=
64
;
fpregs
->
n_xmm_space
=
64
;
...
@@ -259,13 +268,11 @@ int arch_alloc_thread_info(CoreEntry *core)
...
@@ -259,13 +268,11 @@ int arch_alloc_thread_info(CoreEntry *core)
if
(
!
fpregs
->
st_space
||
!
fpregs
->
xmm_space
)
if
(
!
fpregs
->
st_space
||
!
fpregs
->
xmm_space
)
goto
err
;
goto
err
;
if
(
cpu_has_feature
(
X86_FEATURE_XSAVE
)
)
{
if
(
with_xsave
)
{
UserX86XsaveEntry
*
xsave
;
UserX86XsaveEntry
*
xsave
;
xsave
=
xmalloc
(
sizeof
(
*
xsave
));
if
(
!
xsave
)
xsave
=
fpregs
->
xsave
=
xptr_pull
(
&
m
,
UserX86XsaveEntry
);
goto
err
;
user_x86_xsave_entry__init
(
xsave
);
user_x86_xsave_entry__init
(
xsave
);
thread_info
->
fpregs
->
xsave
=
xsave
;
xsave
->
n_ymmh_space
=
64
;
xsave
->
n_ymmh_space
=
64
;
xsave
->
ymmh_space
=
xzalloc
(
pb_repeated_size
(
xsave
,
ymmh_space
));
xsave
->
ymmh_space
=
xzalloc
(
pb_repeated_size
(
xsave
,
ymmh_space
));
...
@@ -281,20 +288,11 @@ err:
...
@@ -281,20 +288,11 @@ err:
void
arch_free_thread_info
(
CoreEntry
*
core
)
void
arch_free_thread_info
(
CoreEntry
*
core
)
{
{
if
(
core
->
thread_info
)
{
if
(
core
->
thread_info
->
fpregs
->
xsave
)
if
(
core
->
thread_info
->
fpregs
)
{
xfree
(
core
->
thread_info
->
fpregs
->
xsave
->
ymmh_space
);
if
(
core
->
thread_info
->
fpregs
->
xsave
)
xfree
(
core
->
thread_info
->
fpregs
->
st_space
);
xfree
(
core
->
thread_info
->
fpregs
->
xsave
->
ymmh_space
);
xfree
(
core
->
thread_info
->
fpregs
->
xmm_space
);
xfree
(
core
->
thread_info
->
fpregs
->
xsave
);
xfree
(
core
->
thread_info
);
xfree
(
core
->
thread_info
->
fpregs
->
st_space
);
xfree
(
core
->
thread_info
->
fpregs
->
xmm_space
);
xfree
(
core
->
thread_info
->
fpregs
->
padding
);
}
xfree
(
core
->
thread_info
->
gpregs
);
xfree
(
core
->
thread_info
->
fpregs
);
xfree
(
core
->
thread_info
);
core
->
thread_info
=
NULL
;
}
}
}
static
bool
valid_xsave_frame
(
CoreEntry
*
core
)
static
bool
valid_xsave_frame
(
CoreEntry
*
core
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment