Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
0841d100
Unverified
Commit
0841d100
authored
Apr 10, 2018
by
Dimitris Papastamos
Committed by
GitHub
Apr 10, 2018
Browse files
Merge pull request #1341 from vwadekar/improve-mmap-efficiency
lib: xlat_tables_v2: reduce time required to add a mmap region
parents
bc2910c1
0ed32232
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/xlat_tables_v2/xlat_tables_internal.c
View file @
0841d100
...
@@ -735,7 +735,8 @@ static int mmap_add_region_check(xlat_ctx_t *ctx, const mmap_region_t *mm)
...
@@ -735,7 +735,8 @@ static int mmap_add_region_check(xlat_ctx_t *ctx, const mmap_region_t *mm)
void
mmap_add_region_ctx
(
xlat_ctx_t
*
ctx
,
const
mmap_region_t
*
mm
)
void
mmap_add_region_ctx
(
xlat_ctx_t
*
ctx
,
const
mmap_region_t
*
mm
)
{
{
mmap_region_t
*
mm_cursor
=
ctx
->
mmap
;
mmap_region_t
*
mm_cursor
=
ctx
->
mmap
;
mmap_region_t
*
mm_last
=
mm_cursor
+
ctx
->
mmap_num
;
const
mmap_region_t
*
mm_end
=
ctx
->
mmap
+
ctx
->
mmap_num
;
mmap_region_t
*
mm_last
;
unsigned
long
long
end_pa
=
mm
->
base_pa
+
mm
->
size
-
1
;
unsigned
long
long
end_pa
=
mm
->
base_pa
+
mm
->
size
-
1
;
uintptr_t
end_va
=
mm
->
base_va
+
mm
->
size
-
1
;
uintptr_t
end_va
=
mm
->
base_va
+
mm
->
size
-
1
;
int
ret
;
int
ret
;
...
@@ -786,6 +787,21 @@ void mmap_add_region_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm)
...
@@ -786,6 +787,21 @@ void mmap_add_region_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm)
&&
(
mm_cursor
->
size
<
mm
->
size
))
&&
(
mm_cursor
->
size
<
mm
->
size
))
++
mm_cursor
;
++
mm_cursor
;
/*
* Find the last entry marker in the mmap
*/
mm_last
=
ctx
->
mmap
;
while
((
mm_last
->
size
!=
0U
)
&&
(
mm_last
<
mm_end
))
{
++
mm_last
;
}
/*
* Check if we have enough space in the memory mapping table.
* This shouldn't happen as we have checked in mmap_add_region_check
* that there is free space.
*/
assert
(
mm_last
->
size
==
0U
);
/* Make room for new region by moving other regions up by one place */
/* Make room for new region by moving other regions up by one place */
memmove
(
mm_cursor
+
1
,
mm_cursor
,
memmove
(
mm_cursor
+
1
,
mm_cursor
,
(
uintptr_t
)
mm_last
-
(
uintptr_t
)
mm_cursor
);
(
uintptr_t
)
mm_last
-
(
uintptr_t
)
mm_cursor
);
...
@@ -795,7 +811,7 @@ void mmap_add_region_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm)
...
@@ -795,7 +811,7 @@ void mmap_add_region_ctx(xlat_ctx_t *ctx, const mmap_region_t *mm)
* This shouldn't happen as we have checked in mmap_add_region_check
* This shouldn't happen as we have checked in mmap_add_region_check
* that there is free space.
* that there is free space.
*/
*/
assert
(
mm_
last
->
size
==
0
);
assert
(
mm_
end
->
size
==
0
U
);
*
mm_cursor
=
*
mm
;
*
mm_cursor
=
*
mm
;
...
...
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