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
a25648e0
Commit
a25648e0
authored
Mar 11, 2016
by
danh-arm
Browse files
Merge pull request #542 from sandrine-bailleux-arm/km/pt-zero
Initialize all translation table entries
parents
a34f3bf2
2af926dd
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/aarch64/xlat_tables.c
View file @
a25648e0
...
@@ -52,7 +52,17 @@
...
@@ -52,7 +52,17 @@
#define debug_print(...) ((void)0)
#define debug_print(...) ((void)0)
#endif
#endif
CASSERT
(
ADDR_SPACE_SIZE
>
0
,
assert_valid_addr_space_size
);
#define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
/*
* The virtual address space size must be a power of two (as set in TCR.T0SZ).
* As we start the initial lookup at level 1, it must also be between 2 GB and
* 512 GB (with the virtual address size therefore 31 to 39 bits). See section
* D4.2.5 in the ARMv8-A Architecture Reference Manual (DDI 0487A.i) for more
* information.
*/
CASSERT
(
ADDR_SPACE_SIZE
>=
(
1ull
<<
31
)
&&
ADDR_SPACE_SIZE
<=
(
1ull
<<
39
)
&&
IS_POWER_OF_TWO
(
ADDR_SPACE_SIZE
),
assert_valid_addr_space_size
);
#define UNSET_DESC ~0ul
#define UNSET_DESC ~0ul
...
@@ -229,7 +239,10 @@ static mmap_region_t *init_xlation_table(mmap_region_t *mm,
...
@@ -229,7 +239,10 @@ static mmap_region_t *init_xlation_table(mmap_region_t *mm,
do
{
do
{
unsigned
long
desc
=
UNSET_DESC
;
unsigned
long
desc
=
UNSET_DESC
;
if
(
mm
->
base_va
+
mm
->
size
<=
base_va
)
{
if
(
!
mm
->
size
)
{
/* Done mapping regions; finish zeroing the table */
desc
=
INVALID_DESC
;
}
else
if
(
mm
->
base_va
+
mm
->
size
<=
base_va
)
{
/* Area now after the region so skip it */
/* Area now after the region so skip it */
++
mm
;
++
mm
;
continue
;
continue
;
...
@@ -267,7 +280,7 @@ static mmap_region_t *init_xlation_table(mmap_region_t *mm,
...
@@ -267,7 +280,7 @@ static mmap_region_t *init_xlation_table(mmap_region_t *mm,
*
table
++
=
desc
;
*
table
++
=
desc
;
base_va
+=
level_size
;
base_va
+=
level_size
;
}
while
(
mm
->
size
&&
(
base_va
&
level_index_mask
));
}
while
((
base_va
&
level_index_mask
)
&&
(
base_va
<
ADDR_SPACE_SIZE
)
);
return
mm
;
return
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