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
aadb1350
Commit
aadb1350
authored
Jul 15, 2016
by
danh-arm
Committed by
GitHub
Jul 15, 2016
Browse files
Merge pull request #662 from sandrine-bailleux-arm/sb/rodata-xn
Map read-only data as execute-never
parents
9306f135
91fad655
Changes
36
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
aadb1350
...
@@ -108,6 +108,10 @@ PL011_GENERIC_UART := 0
...
@@ -108,6 +108,10 @@ PL011_GENERIC_UART := 0
ENABLE_PMF
:=
0
ENABLE_PMF
:=
0
# Flag to enable PSCI STATs functionality
# Flag to enable PSCI STATs functionality
ENABLE_PSCI_STAT
:=
0
ENABLE_PSCI_STAT
:=
0
# Whether code and read-only data should be put on separate memory pages.
# The platform Makefile is free to override this value.
SEPARATE_CODE_AND_RODATA
:=
0
################################################################################
################################################################################
# Checkpatch script options
# Checkpatch script options
...
@@ -419,6 +423,7 @@ $(eval $(call assert_boolean,SPIN_ON_BL1_EXIT))
...
@@ -419,6 +423,7 @@ $(eval $(call assert_boolean,SPIN_ON_BL1_EXIT))
$(eval $(call assert_boolean,PL011_GENERIC_UART))
$(eval $(call assert_boolean,PL011_GENERIC_UART))
$(eval $(call assert_boolean,ENABLE_PMF))
$(eval $(call assert_boolean,ENABLE_PMF))
$(eval $(call assert_boolean,ENABLE_PSCI_STAT))
$(eval $(call assert_boolean,ENABLE_PSCI_STAT))
$(eval $(call assert_boolean,SEPARATE_CODE_AND_RODATA))
################################################################################
################################################################################
...
@@ -448,6 +453,7 @@ $(eval $(call add_define,SPIN_ON_BL1_EXIT))
...
@@ -448,6 +453,7 @@ $(eval $(call add_define,SPIN_ON_BL1_EXIT))
$(eval $(call add_define,PL011_GENERIC_UART))
$(eval $(call add_define,PL011_GENERIC_UART))
$(eval $(call add_define,ENABLE_PMF))
$(eval $(call add_define,ENABLE_PMF))
$(eval $(call add_define,ENABLE_PSCI_STAT))
$(eval $(call add_define,ENABLE_PSCI_STAT))
$(eval $(call add_define,SEPARATE_CODE_AND_RODATA))
# Define the EL3_PAYLOAD_BASE flag only if it is provided.
# Define the EL3_PAYLOAD_BASE flag only if it is provided.
ifdef EL3_PAYLOAD_BASE
ifdef EL3_PAYLOAD_BASE
$(eval $(call add_define,EL3_PAYLOAD_BASE))
$(eval $(call add_define,EL3_PAYLOAD_BASE))
...
...
bl1/bl1.ld.S
View file @
aadb1350
/*
/*
*
Copyright
(
c
)
2013
-
201
4
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2013
-
201
6
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
@@ -45,6 +45,43 @@ SECTIONS
...
@@ -45,6 +45,43 @@ SECTIONS
ASSERT
(.
==
ALIGN
(
4096
),
ASSERT
(.
==
ALIGN
(
4096
),
"
BL1_RO_BASE
address
is
not
aligned
on
a
page
boundary
.
")
"
BL1_RO_BASE
address
is
not
aligned
on
a
page
boundary
.
")
#if SEPARATE_CODE_AND_RODATA
.
text
.
:
{
__TEXT_START__
=
.
;
*
bl1_entrypoint
.
o
(.
text
*)
*(.
text
*)
*(.
vectors
)
.
=
NEXT
(
4096
)
;
__TEXT_END__
=
.
;
}
>
ROM
.
rodata
.
:
{
__RODATA_START__
=
.
;
*(.
rodata
*)
/
*
Ensure
8
-
byte
alignment
for
descriptors
and
ensure
inclusion
*/
.
=
ALIGN
(
8
)
;
__PARSER_LIB_DESCS_START__
=
.
;
KEEP
(*(.
img_parser_lib_descs
))
__PARSER_LIB_DESCS_END__
=
.
;
/
*
*
Ensure
8
-
byte
alignment
for
cpu_ops
so
that
its
fields
are
also
*
aligned
.
Also
ensure
cpu_ops
inclusion
.
*/
.
=
ALIGN
(
8
)
;
__CPU_OPS_START__
=
.
;
KEEP
(*(
cpu_ops
))
__CPU_OPS_END__
=
.
;
/
*
*
No
need
to
pad
out
the
.
rodata
section
to
a
page
boundary
.
Next
is
*
the
.
data
section
,
which
can
mapped
in
ROM
with
the
same
memory
*
attributes
as
the
.
rodata
section
.
*/
__RODATA_END__
=
.
;
}
>
ROM
#else
ro
.
:
{
ro
.
:
{
__RO_START__
=
.
;
__RO_START__
=
.
;
*
bl1_entrypoint
.
o
(.
text
*)
*
bl1_entrypoint
.
o
(.
text
*)
...
@@ -69,6 +106,7 @@ SECTIONS
...
@@ -69,6 +106,7 @@ SECTIONS
*(.
vectors
)
*(.
vectors
)
__RO_END__
=
.
;
__RO_END__
=
.
;
}
>
ROM
}
>
ROM
#endif
ASSERT
(
__CPU_OPS_END__
>
__CPU_OPS_START__
,
ASSERT
(
__CPU_OPS_END__
>
__CPU_OPS_START__
,
"
cpu_ops
not
defined
for
this
platform
.
")
"
cpu_ops
not
defined
for
this
platform
.
")
...
@@ -139,12 +177,14 @@ SECTIONS
...
@@ -139,12 +177,14 @@ SECTIONS
__DATA_ROM_START__
=
LOADADDR
(
.
data
)
;
__DATA_ROM_START__
=
LOADADDR
(
.
data
)
;
__DATA_SIZE__
=
SIZEOF
(
.
data
)
;
__DATA_SIZE__
=
SIZEOF
(
.
data
)
;
/
*
/
*
*
The
.
data
section
is
the
last
PROGBITS
section
so
its
end
marks
the
end
*
The
.
data
section
is
the
last
PROGBITS
section
so
its
end
marks
the
end
*
of
the
read
-
only
part
of
BL1
's binary
.
*
of
BL1
's actual content in Trusted ROM
.
*/
*/
ASSERT
(
__DATA_ROM_START__
+
__DATA_SIZE__
<=
BL1_RO_LIMIT
,
__BL1_ROM_END__
=
__DATA_ROM_START__
+
__DATA_SIZE__
;
"
BL1
'
s
RO
section
has
exceeded
its
limit
.
")
ASSERT
(
__BL1_ROM_END__
<=
BL1_RO_LIMIT
,
"
BL1
'
s
ROM
content
has
exceeded
its
limit
.
")
__BSS_SIZE__
=
SIZEOF
(
.
bss
)
;
__BSS_SIZE__
=
SIZEOF
(
.
bss
)
;
...
...
bl1/bl1_private.h
View file @
aadb1350
/*
/*
* Copyright (c) 2013-201
4
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-201
6
, ARM Limited and Contributors. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -35,8 +35,11 @@
...
@@ -35,8 +35,11 @@
/*******************************************************************************
/*******************************************************************************
* Declarations of linker defined symbols which will tell us where BL1 lives
* Declarations of linker defined symbols which will tell us where BL1 lives
* in Trusted RAM
* in Trusted
ROM and
RAM
******************************************************************************/
******************************************************************************/
extern
uint64_t
__BL1_ROM_END__
;
#define BL1_ROM_END (uint64_t)(&__BL1_ROM_END__)
extern
uint64_t
__BL1_RAM_START__
;
extern
uint64_t
__BL1_RAM_START__
;
extern
uint64_t
__BL1_RAM_END__
;
extern
uint64_t
__BL1_RAM_END__
;
#define BL1_RAM_BASE (uint64_t)(&__BL1_RAM_START__)
#define BL1_RAM_BASE (uint64_t)(&__BL1_RAM_START__)
...
...
bl2/bl2.ld.S
View file @
aadb1350
...
@@ -45,6 +45,30 @@ SECTIONS
...
@@ -45,6 +45,30 @@ SECTIONS
ASSERT
(.
==
ALIGN
(
4096
),
ASSERT
(.
==
ALIGN
(
4096
),
"
BL2_BASE
address
is
not
aligned
on
a
page
boundary
.
")
"
BL2_BASE
address
is
not
aligned
on
a
page
boundary
.
")
#if SEPARATE_CODE_AND_RODATA
.
text
.
:
{
__TEXT_START__
=
.
;
*
bl2_entrypoint
.
o
(.
text
*)
*(.
text
*)
*(.
vectors
)
.
=
NEXT
(
4096
)
;
__TEXT_END__
=
.
;
}
>
RAM
.
rodata
.
:
{
__RODATA_START__
=
.
;
*(.
rodata
*)
/
*
Ensure
8
-
byte
alignment
for
descriptors
and
ensure
inclusion
*/
.
=
ALIGN
(
8
)
;
__PARSER_LIB_DESCS_START__
=
.
;
KEEP
(*(.
img_parser_lib_descs
))
__PARSER_LIB_DESCS_END__
=
.
;
.
=
NEXT
(
4096
)
;
__RODATA_END__
=
.
;
}
>
RAM
#else
ro
.
:
{
ro
.
:
{
__RO_START__
=
.
;
__RO_START__
=
.
;
*
bl2_entrypoint
.
o
(.
text
*)
*
bl2_entrypoint
.
o
(.
text
*)
...
@@ -67,6 +91,7 @@ SECTIONS
...
@@ -67,6 +91,7 @@ SECTIONS
.
=
NEXT
(
4096
)
;
.
=
NEXT
(
4096
)
;
__RO_END__
=
.
;
__RO_END__
=
.
;
}
>
RAM
}
>
RAM
#endif
/
*
/
*
*
Define
a
linker
symbol
to
mark
start
of
the
RW
memory
area
for
this
*
Define
a
linker
symbol
to
mark
start
of
the
RW
memory
area
for
this
...
...
bl2u/bl2u.ld.S
View file @
aadb1350
...
@@ -45,6 +45,23 @@ SECTIONS
...
@@ -45,6 +45,23 @@ SECTIONS
ASSERT
(.
==
ALIGN
(
4096
),
ASSERT
(.
==
ALIGN
(
4096
),
"
BL2U_BASE
address
is
not
aligned
on
a
page
boundary
.
")
"
BL2U_BASE
address
is
not
aligned
on
a
page
boundary
.
")
#if SEPARATE_CODE_AND_RODATA
.
text
.
:
{
__TEXT_START__
=
.
;
*
bl2u_entrypoint
.
o
(.
text
*)
*(.
text
*)
*(.
vectors
)
.
=
NEXT
(
4096
)
;
__TEXT_END__
=
.
;
}
>
RAM
.
rodata
.
:
{
__RODATA_START__
=
.
;
*(.
rodata
*)
.
=
NEXT
(
4096
)
;
__RODATA_END__
=
.
;
}
>
RAM
#else
ro
.
:
{
ro
.
:
{
__RO_START__
=
.
;
__RO_START__
=
.
;
*
bl2u_entrypoint
.
o
(.
text
*)
*
bl2u_entrypoint
.
o
(.
text
*)
...
@@ -61,6 +78,7 @@ SECTIONS
...
@@ -61,6 +78,7 @@ SECTIONS
.
=
NEXT
(
4096
)
;
.
=
NEXT
(
4096
)
;
__RO_END__
=
.
;
__RO_END__
=
.
;
}
>
RAM
}
>
RAM
#endif
/
*
/
*
*
Define
a
linker
symbol
to
mark
start
of
the
RW
memory
area
for
this
*
Define
a
linker
symbol
to
mark
start
of
the
RW
memory
area
for
this
...
...
bl31/bl31.ld.S
View file @
aadb1350
...
@@ -46,6 +46,47 @@ SECTIONS
...
@@ -46,6 +46,47 @@ SECTIONS
ASSERT
(.
==
ALIGN
(
4096
),
ASSERT
(.
==
ALIGN
(
4096
),
"
BL31_BASE
address
is
not
aligned
on
a
page
boundary
.
")
"
BL31_BASE
address
is
not
aligned
on
a
page
boundary
.
")
#if SEPARATE_CODE_AND_RODATA
.
text
.
:
{
__TEXT_START__
=
.
;
*
bl31_entrypoint
.
o
(.
text
*)
*(.
text
*)
*(.
vectors
)
.
=
NEXT
(
4096
)
;
__TEXT_END__
=
.
;
}
>
RAM
.
rodata
.
:
{
__RODATA_START__
=
.
;
*(.
rodata
*)
/
*
Ensure
8
-
byte
alignment
for
descriptors
and
ensure
inclusion
*/
.
=
ALIGN
(
8
)
;
__RT_SVC_DESCS_START__
=
.
;
KEEP
(*(
rt_svc_descs
))
__RT_SVC_DESCS_END__
=
.
;
#if ENABLE_PMF
/
*
Ensure
8
-
byte
alignment
for
descriptors
and
ensure
inclusion
*/
.
=
ALIGN
(
8
)
;
__PMF_SVC_DESCS_START__
=
.
;
KEEP
(*(
pmf_svc_descs
))
__PMF_SVC_DESCS_END__
=
.
;
#endif /* ENABLE_PMF */
/
*
*
Ensure
8
-
byte
alignment
for
cpu_ops
so
that
its
fields
are
also
*
aligned
.
Also
ensure
cpu_ops
inclusion
.
*/
.
=
ALIGN
(
8
)
;
__CPU_OPS_START__
=
.
;
KEEP
(*(
cpu_ops
))
__CPU_OPS_END__
=
.
;
.
=
NEXT
(
4096
)
;
__RODATA_END__
=
.
;
}
>
RAM
#else
ro
.
:
{
ro
.
:
{
__RO_START__
=
.
;
__RO_START__
=
.
;
*
bl31_entrypoint
.
o
(.
text
*)
*
bl31_entrypoint
.
o
(.
text
*)
...
@@ -85,6 +126,7 @@ SECTIONS
...
@@ -85,6 +126,7 @@ SECTIONS
.
=
NEXT
(
4096
)
;
.
=
NEXT
(
4096
)
;
__RO_END__
=
.
;
__RO_END__
=
.
;
}
>
RAM
}
>
RAM
#endif
ASSERT
(
__CPU_OPS_END__
>
__CPU_OPS_START__
,
ASSERT
(
__CPU_OPS_END__
>
__CPU_OPS_START__
,
"
cpu_ops
not
defined
for
this
platform
.
")
"
cpu_ops
not
defined
for
this
platform
.
")
...
...
bl32/tsp/tsp.ld.S
View file @
aadb1350
...
@@ -46,6 +46,23 @@ SECTIONS
...
@@ -46,6 +46,23 @@ SECTIONS
ASSERT
(.
==
ALIGN
(
4096
),
ASSERT
(.
==
ALIGN
(
4096
),
"
BL32_BASE
address
is
not
aligned
on
a
page
boundary
.
")
"
BL32_BASE
address
is
not
aligned
on
a
page
boundary
.
")
#if SEPARATE_CODE_AND_RODATA
.
text
.
:
{
__TEXT_START__
=
.
;
*
tsp_entrypoint
.
o
(.
text
*)
*(.
text
*)
*(.
vectors
)
.
=
NEXT
(
4096
)
;
__TEXT_END__
=
.
;
}
>
RAM
.
rodata
.
:
{
__RODATA_START__
=
.
;
*(.
rodata
*)
.
=
NEXT
(
4096
)
;
__RODATA_END__
=
.
;
}
>
RAM
#else
ro
.
:
{
ro
.
:
{
__RO_START__
=
.
;
__RO_START__
=
.
;
*
tsp_entrypoint
.
o
(.
text
*)
*
tsp_entrypoint
.
o
(.
text
*)
...
@@ -61,6 +78,7 @@ SECTIONS
...
@@ -61,6 +78,7 @@ SECTIONS
.
=
NEXT
(
4096
)
;
.
=
NEXT
(
4096
)
;
__RO_END__
=
.
;
__RO_END__
=
.
;
}
>
RAM
}
>
RAM
#endif
/
*
/
*
*
Define
a
linker
symbol
to
mark
start
of
the
RW
memory
area
for
this
*
Define
a
linker
symbol
to
mark
start
of
the
RW
memory
area
for
this
...
...
bl32/tsp/tsp_main.c
View file @
aadb1350
...
@@ -56,12 +56,12 @@ static tsp_args_t tsp_smc_args[PLATFORM_CORE_COUNT];
...
@@ -56,12 +56,12 @@ static tsp_args_t tsp_smc_args[PLATFORM_CORE_COUNT];
work_statistics_t
tsp_stats
[
PLATFORM_CORE_COUNT
];
work_statistics_t
tsp_stats
[
PLATFORM_CORE_COUNT
];
/*******************************************************************************
/*******************************************************************************
* The BL32 memory footprint starts with an RO sections and ends
* The TSP memory footprint starts at address BL32_BASE and ends with the
* with the linker symbol __BL32_END__. Use it to find the memory size
* linker symbol __BL32_END__. Use these addresses to compute the TSP image
* size.
******************************************************************************/
******************************************************************************/
#define BL32_TOTAL_BASE (unsigned long)(&__RO_START__)
#define BL32_TOTAL_LIMIT (unsigned long)(&__BL32_END__)
#define BL32_TOTAL_LIMIT (unsigned long)(&__BL32_END__)
#define BL32_TOTAL_SIZE (BL32_TOTAL_LIMIT - (unsigned long) BL32_BASE)
static
tsp_args_t
*
set_smc_args
(
uint64_t
arg0
,
static
tsp_args_t
*
set_smc_args
(
uint64_t
arg0
,
uint64_t
arg1
,
uint64_t
arg1
,
...
@@ -102,9 +102,8 @@ uint64_t tsp_main(void)
...
@@ -102,9 +102,8 @@ uint64_t tsp_main(void)
{
{
NOTICE
(
"TSP: %s
\n
"
,
version_string
);
NOTICE
(
"TSP: %s
\n
"
,
version_string
);
NOTICE
(
"TSP: %s
\n
"
,
build_message
);
NOTICE
(
"TSP: %s
\n
"
,
build_message
);
INFO
(
"TSP: Total memory base : 0x%lx
\n
"
,
BL32_TOTAL_BASE
);
INFO
(
"TSP: Total memory base : 0x%lx
\n
"
,
(
unsigned
long
)
BL32_BASE
);
INFO
(
"TSP: Total memory size : 0x%lx bytes
\n
"
,
INFO
(
"TSP: Total memory size : 0x%lx bytes
\n
"
,
BL32_TOTAL_SIZE
);
BL32_TOTAL_LIMIT
-
BL32_TOTAL_BASE
);
uint32_t
linear_id
=
plat_my_core_pos
();
uint32_t
linear_id
=
plat_my_core_pos
();
...
...
docs/firmware-design.md
View file @
aadb1350
...
@@ -1052,10 +1052,10 @@ Each bootloader image can be divided in 2 parts:
...
@@ -1052,10 +1052,10 @@ Each bootloader image can be divided in 2 parts:
All PROGBITS sections are grouped together at the beginning of the image,
All PROGBITS sections are grouped together at the beginning of the image,
followed by all NOBITS sections. This is true for all Trusted Firmware images
followed by all NOBITS sections. This is true for all Trusted Firmware images
and it is governed by the linker scripts. This ensures that the raw binary
and it is governed by the linker scripts. This ensures that the raw binary
images are as small as possible. If a NOBITS section w
ould sneak
in between
images are as small as possible. If a NOBITS section w
as inserted
in between
PROGBITS sections then the resulting binary file would contain
a bunch of zero
PROGBITS sections then the resulting binary file would contain
zero bytes in
bytes at the location
of this NOBITS section, making the image unnecessarily
place
of this NOBITS section, making the image unnecessarily
bigger. Smaller
bigger. Smaller
images allow faster loading from the FIP to the main memory.
images allow faster loading from the FIP to the main memory.
### Linker scripts and symbols
### Linker scripts and symbols
...
@@ -1110,47 +1110,48 @@ layout as they are easy to spot in the link map files.
...
@@ -1110,47 +1110,48 @@ layout as they are easy to spot in the link map files.
#### Common linker symbols
#### Common linker symbols
Early setup code needs to know the extents of the BSS section to zero-initialise
All BL images share the following requirements:
it before executing any C code. The following linker symbols are defined for
this purpose:
*
The BSS section must be zero-initialised before executing any C code.
*
The coherent memory section (if enabled) must be zero-initialised as well.
*
`__BSS_START__`
This address must be aligned on a 16-byte boundary.
*
The MMU setup code needs to know the extents of the coherent and read-only
*
`__BSS_SIZE__`
memory regions to set the right memory attributes. When
`SEPARATE_CODE_AND_RODATA=1`
, it needs to know more specifically how the
Similarly, the coherent memory section (if enabled) must be zero-initialised.
read-only memory region is divided between code and data.
Also, the MMU setup code needs to know the extents of this section to set the
right memory attributes for it. The following linker symbols are defined for
The following linker symbols are defined for this purpose:
this purpose:
*
`__BSS_START__`
Must be aligned on a 16-byte boundary.
*
`__COHERENT_RAM_START__`
This address must be aligned on a page-size boundary.
*
`__BSS_SIZE__`
*
`__COHERENT_RAM_END__`
This address must be aligned on a page-size boundary.
*
`__COHERENT_RAM_START__`
Must be aligned on a page-size boundary.
*
`__COHERENT_RAM_UNALIGNED_SIZE__`
*
`__COHERENT_RAM_END__`
Must be aligned on a page-size boundary.
*
`__COHERENT_RAM_UNALIGNED_SIZE__`
*
`__RO_START__`
*
`__RO_END__`
*
`__TEXT_START__`
*
`__TEXT_END__`
*
`__RODATA_START__`
*
`__RODATA_END__`
#### BL1's linker symbols
#### BL1's linker symbols
BL1's early setup code needs to know the extents of the .data section to
BL1 being the ROM image, it has additional requirements. BL1 resides in ROM and
relocate it from ROM to RAM before executing any C code. The following linker
it is entirely executed in place but it needs some read-write memory for its
symbols are defined for this purpose:
mutable data. Its
`.data`
section (i.e. its allocated read-write data) must be
relocated from ROM to RAM before executing any C code.
*
`__DATA_ROM_START__`
This address must be aligned on a 16-byte boundary.
*
`__DATA_RAM_START__`
This address must be aligned on a 16-byte boundary.
*
`__DATA_SIZE__`
BL1's platform setup code needs to know the extents of its read-write data
region to figure out its memory layout. The following linker symbols are defined
for this purpose:
*
`__BL1_RAM_START__`
This is the start address of BL1 RW data.
*
`__BL1_RAM_END__`
This is the end address of BL1 RW data.
#### BL2's, BL31's and TSP's linker symbols
The following additional linker symbols are defined for BL1:
BL2, BL31 and TSP need to know the extents of their read-only section to set
*
`__BL1_ROM_END__`
End address of BL1's ROM contents, covering its code
the right memory attributes for this memory region in their MMU setup code. The
and
`.data`
section in ROM.
following linker symbols are defined for this purpose:
*
`__DATA_ROM_START__`
Start address of the
`.data`
section in ROM. Must be
aligned on a 16-byte boundary.
*
`__DATA_RAM_START__`
Address in RAM where the
`.data`
section should be
copied over. Must be aligned on a 16-byte boundary.
*
`__DATA_SIZE__`
Size of the
`.data`
section (in ROM or RAM).
*
`__BL1_RAM_START__`
Start address of BL1 read-write data.
*
`__BL1_RAM_END__`
End address of BL1 read-write data.
*
`__RO_START__`
*
`__RO_END__`
### How to choose the right base addresses for each bootloader stage image
### How to choose the right base addresses for each bootloader stage image
...
...
include/common/bl_common.h
View file @
aadb1350
...
@@ -137,15 +137,22 @@
...
@@ -137,15 +137,22 @@
#include <cassert.h>
#include <cassert.h>
#include <stdint.h>
#include <stdint.h>
#include <stddef.h>
#include <stddef.h>
#include <utils.h>
/* To retain compatibility */
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/*
/*
* Declarations of linker defined symbols to help determine memory layout of
* Declarations of linker defined symbols to help determine memory layout of
* BL images
* BL images
*/
*/
#if SEPARATE_CODE_AND_RODATA
extern
unsigned
long
__TEXT_START__
;
extern
unsigned
long
__TEXT_END__
;
extern
unsigned
long
__RODATA_START__
;
extern
unsigned
long
__RODATA_END__
;
#else
extern
unsigned
long
__RO_START__
;
extern
unsigned
long
__RO_START__
;
extern
unsigned
long
__RO_END__
;
extern
unsigned
long
__RO_END__
;
#endif
#if IMAGE_BL2
#if IMAGE_BL2
extern
unsigned
long
__BL2_END__
;
extern
unsigned
long
__BL2_END__
;
#elif IMAGE_BL2U
#elif IMAGE_BL2U
...
...
include/lib/utils.h
0 → 100644
View file @
aadb1350
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __UTILS_H__
#define __UTILS_H__
/* Compute the number of elements in the given array */
#define ARRAY_SIZE(a) \
(sizeof(a) / sizeof((a)[0]))
#define IS_POWER_OF_TWO(x) \
(((x) & ((x) - 1)) == 0)
/*
* The round_up() macro rounds up a value to the given boundary in a
* type-agnostic yet type-safe manner. The boundary must be a power of two.
* In other words, it computes the smallest multiple of boundary which is
* greater than or equal to value.
*
* round_down() is similar but rounds the value down instead.
*/
#define round_boundary(value, boundary) \
((__typeof__(value))((boundary) - 1))
#define round_up(value, boundary) \
((((value) - 1) | round_boundary(value, boundary)) + 1)
#define round_down(value, boundary) \
((value) & ~round_boundary(value, boundary))
#endif
/* __UTILS_H__ */
include/lib/xlat_tables.h
View file @
aadb1350
...
@@ -134,6 +134,8 @@
...
@@ -134,6 +134,8 @@
#define MT_PERM_SHIFT 3
#define MT_PERM_SHIFT 3
/* Security state (SECURE/NS) */
/* Security state (SECURE/NS) */
#define MT_SEC_SHIFT 4
#define MT_SEC_SHIFT 4
/* Access permissions for instruction execution (EXECUTE/EXECUTE_NEVER) */
#define MT_EXECUTE_SHIFT 5
/*
/*
* Memory mapping attributes
* Memory mapping attributes
...
@@ -155,8 +157,21 @@ typedef enum {
...
@@ -155,8 +157,21 @@ typedef enum {
MT_SECURE
=
0
<<
MT_SEC_SHIFT
,
MT_SECURE
=
0
<<
MT_SEC_SHIFT
,
MT_NS
=
1
<<
MT_SEC_SHIFT
,
MT_NS
=
1
<<
MT_SEC_SHIFT
,
/*
* Access permissions for instruction execution are only relevant for
* normal read-only memory, i.e. MT_MEMORY | MT_RO. They are ignored
* (and potentially overridden) otherwise:
* - Device memory is always marked as execute-never.
* - Read-write normal memory is always marked as execute-never.
*/
MT_EXECUTE
=
0
<<
MT_EXECUTE_SHIFT
,
MT_EXECUTE_NEVER
=
1
<<
MT_EXECUTE_SHIFT
,
}
mmap_attr_t
;
}
mmap_attr_t
;
#define MT_CODE (MT_MEMORY | MT_RO | MT_EXECUTE)
#define MT_RO_DATA (MT_MEMORY | MT_RO | MT_EXECUTE_NEVER)
/*
/*
* Structure for specifying a single region of memory.
* Structure for specifying a single region of memory.
*/
*/
...
...
include/plat/arm/board/common/v2m_def.h
View file @
aadb1350
/*
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015
-2016
, ARM Limited and Contributors. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -119,13 +119,26 @@
...
@@ -119,13 +119,26 @@
#define V2M_SP810_CTRL_TIM2_SEL (1 << 19)
#define V2M_SP810_CTRL_TIM2_SEL (1 << 19)
#define V2M_SP810_CTRL_TIM3_SEL (1 << 21)
#define V2M_SP810_CTRL_TIM3_SEL (1 << 21)
/*
* The flash can be mapped either as read-only or read-write.
*
* If it is read-write then it should also be mapped as device memory because
* NOR flash programming involves sending a fixed, ordered sequence of commands.
*
* If it is read-only then it should also be mapped as:
* - Normal memory, because reading from NOR flash is transparent, it is like
* reading from RAM.
* - Non-executable by default. If some parts of the flash need to be executable
* then platform code is responsible for re-mapping the appropriate portion
* of it as executable.
*/
#define V2M_MAP_FLASH0_RW MAP_REGION_FLAT(V2M_FLASH0_BASE,\
#define V2M_MAP_FLASH0_RW MAP_REGION_FLAT(V2M_FLASH0_BASE,\
V2M_FLASH0_SIZE, \
V2M_FLASH0_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
MT_DEVICE | MT_RW | MT_SECURE)
#define V2M_MAP_FLASH0_RO MAP_REGION_FLAT(V2M_FLASH0_BASE,\
#define V2M_MAP_FLASH0_RO MAP_REGION_FLAT(V2M_FLASH0_BASE,\
V2M_FLASH0_SIZE, \
V2M_FLASH0_SIZE, \
MT_
MEMORY | MT_RO
| MT_SECURE)
MT_
RO_DATA
| MT_SECURE)
#define V2M_MAP_IOFPGA MAP_REGION_FLAT(V2M_IOFPGA_BASE,\
#define V2M_MAP_IOFPGA MAP_REGION_FLAT(V2M_IOFPGA_BASE,\
V2M_IOFPGA_SIZE, \
V2M_IOFPGA_SIZE, \
...
...
include/plat/arm/common/plat_arm.h
View file @
aadb1350
...
@@ -31,10 +31,10 @@
...
@@ -31,10 +31,10 @@
#define __PLAT_ARM_H__
#define __PLAT_ARM_H__
#include <bakery_lock.h>
#include <bakery_lock.h>
#include <bl_common.h>
#include <cassert.h>
#include <cassert.h>
#include <cpu_data.h>
#include <cpu_data.h>
#include <stdint.h>
#include <stdint.h>
#include <utils.h>
#include <xlat_tables.h>
#include <xlat_tables.h>
#define ARM_CASSERT_MMAP \
#define ARM_CASSERT_MMAP \
...
@@ -45,20 +45,12 @@
...
@@ -45,20 +45,12 @@
/*
/*
* Utility functions common to ARM standard platforms
* Utility functions common to ARM standard platforms
*/
*/
void
arm_setup_page_tables
(
unsigned
long
total_base
,
void
arm_configure_mmu_el1
(
unsigned
long
total_base
,
unsigned
long
total_size
,
unsigned
long
ro_start
,
unsigned
long
ro_limit
#if USE_COHERENT_MEM
,
unsigned
long
coh_start
,
unsigned
long
coh_limit
#endif
);
void
arm_configure_mmu_el3
(
unsigned
long
total_base
,
unsigned
long
total_size
,
unsigned
long
total_size
,
unsigned
long
ro_start
,
unsigned
long
code_start
,
unsigned
long
ro_limit
unsigned
long
code_limit
,
unsigned
long
rodata_start
,
unsigned
long
rodata_limit
#if USE_COHERENT_MEM
#if USE_COHERENT_MEM
,
unsigned
long
coh_start
,
,
unsigned
long
coh_start
,
unsigned
long
coh_limit
unsigned
long
coh_limit
...
...
include/plat/common/common_def.h
View file @
aadb1350
...
@@ -80,5 +80,44 @@
...
@@ -80,5 +80,44 @@
.ep_info.pc = BL2_BASE, \
.ep_info.pc = BL2_BASE, \
}
}
#endif
/* __COMMON_DEF_H__ */
/*
* The following constants identify the extents of the code & read-only data
* regions. These addresses are used by the MMU setup code and therefore they
* must be page-aligned.
*
* When the code and read-only data are mapped as a single atomic section
* (i.e. when SEPARATE_CODE_AND_RODATA=0) then we treat the whole section as
* code by specifying the read-only data section as empty.
*
* BL1 is different than the other images in the sense that its read-write data
* originally lives in Trusted ROM and needs to be relocated in Trusted SRAM at
* run-time. Therefore, the read-write data in ROM can be mapped with the same
* memory attributes as the read-only data region. For this reason, BL1 uses
* different macros.
*
* Note that BL1_ROM_END is not necessarily aligned on a page boundary as it
* just points to the end of BL1's actual content in Trusted ROM. Therefore it
* needs to be rounded up to the next page size in order to map the whole last
* page of it with the right memory attributes.
*/
#if SEPARATE_CODE_AND_RODATA
#define BL_CODE_BASE (unsigned long)(&__TEXT_START__)
#define BL_CODE_LIMIT (unsigned long)(&__TEXT_END__)
#define BL_RO_DATA_BASE (unsigned long)(&__RODATA_START__)
#define BL_RO_DATA_LIMIT (unsigned long)(&__RODATA_END__)
#define BL1_CODE_LIMIT BL_CODE_LIMIT
#define BL1_RO_DATA_BASE (unsigned long)(&__RODATA_START__)
#define BL1_RO_DATA_LIMIT round_up(BL1_ROM_END, PAGE_SIZE)
#else
#define BL_CODE_BASE (unsigned long)(&__RO_START__)
#define BL_CODE_LIMIT (unsigned long)(&__RO_END__)
#define BL_RO_DATA_BASE 0
#define BL_RO_DATA_LIMIT 0
#define BL1_CODE_LIMIT round_up(BL1_ROM_END, PAGE_SIZE)
#define BL1_RO_DATA_BASE 0
#define BL1_RO_DATA_LIMIT 0
#endif
/* SEPARATE_CODE_AND_RODATA */
#endif
/* __COMMON_DEF_H__ */
lib/xlat_tables/aarch64/xlat_tables.c
View file @
aadb1350
...
@@ -33,11 +33,10 @@
...
@@ -33,11 +33,10 @@
#include <assert.h>
#include <assert.h>
#include <cassert.h>
#include <cassert.h>
#include <platform_def.h>
#include <platform_def.h>
#include <utils.h>
#include <xlat_tables.h>
#include <xlat_tables.h>
#include "../xlat_tables_private.h"
#include "../xlat_tables_private.h"
#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).
* 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
* As we start the initial lookup at level 1, it must also be between 2 GB and
...
...
lib/xlat_tables/xlat_tables_common.c
View file @
aadb1350
...
@@ -31,11 +31,11 @@
...
@@ -31,11 +31,11 @@
#include <arch.h>
#include <arch.h>
#include <arch_helpers.h>
#include <arch_helpers.h>
#include <assert.h>
#include <assert.h>
#include <bl_common.h>
#include <cassert.h>
#include <cassert.h>
#include <debug.h>
#include <debug.h>
#include <platform_def.h>
#include <platform_def.h>
#include <string.h>
#include <string.h>
#include <utils.h>
#include <xlat_tables.h>
#include <xlat_tables.h>
#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
...
@@ -194,37 +194,66 @@ void mmap_add(const mmap_region_t *mm)
...
@@ -194,37 +194,66 @@ void mmap_add(const mmap_region_t *mm)
static
uint64_t
mmap_desc
(
unsigned
attr
,
unsigned
long
long
addr_pa
,
static
uint64_t
mmap_desc
(
unsigned
attr
,
unsigned
long
long
addr_pa
,
int
level
)
int
level
)
{
{
uint64_t
desc
=
addr_pa
;
uint64_t
desc
;
int
mem_type
;
int
mem_type
;
desc
|=
level
==
3
?
TABLE_DESC
:
BLOCK_DESC
;
desc
=
addr_pa
;
desc
|=
(
level
==
3
)
?
TABLE_DESC
:
BLOCK_DESC
;
desc
|=
attr
&
MT_NS
?
LOWER_ATTRS
(
NS
)
:
0
;
desc
|=
(
attr
&
MT_NS
)
?
LOWER_ATTRS
(
NS
)
:
0
;
desc
|=
(
attr
&
MT_RW
)
?
LOWER_ATTRS
(
AP_RW
)
:
LOWER_ATTRS
(
AP_RO
);
desc
|=
attr
&
MT_RW
?
LOWER_ATTRS
(
AP_RW
)
:
LOWER_ATTRS
(
AP_RO
);
desc
|=
LOWER_ATTRS
(
ACCESS_FLAG
);
desc
|=
LOWER_ATTRS
(
ACCESS_FLAG
);
/*
* Deduce shareability domain and executability of the memory region
* from the memory type.
*
* Data accesses to device memory and non-cacheable normal memory are
* coherent for all observers in the system, and correspondingly are
* always treated as being Outer Shareable. Therefore, for these 2 types
* of memory, it is not strictly needed to set the shareability field
* in the translation tables.
*/
mem_type
=
MT_TYPE
(
attr
);
mem_type
=
MT_TYPE
(
attr
);
if
(
mem_type
==
MT_MEMORY
)
{
if
(
mem_type
==
MT_DEVICE
)
{
desc
|=
LOWER_ATTRS
(
ATTR_IWBWA_OWBWA_NTR_INDEX
|
ISH
);
if
(
attr
&
MT_RW
)
desc
|=
UPPER_ATTRS
(
XN
);
}
else
if
(
mem_type
==
MT_NON_CACHEABLE
)
{
desc
|=
LOWER_ATTRS
(
ATTR_NON_CACHEABLE_INDEX
|
OSH
);
if
(
attr
&
MT_RW
)
desc
|=
UPPER_ATTRS
(
XN
);
}
else
{
assert
(
mem_type
==
MT_DEVICE
);
desc
|=
LOWER_ATTRS
(
ATTR_DEVICE_INDEX
|
OSH
);
desc
|=
LOWER_ATTRS
(
ATTR_DEVICE_INDEX
|
OSH
);
/*
* Always map device memory as execute-never.
* This is to avoid the possibility of a speculative instruction
* fetch, which could be an issue if this memory region
* corresponds to a read-sensitive peripheral.
*/
desc
|=
UPPER_ATTRS
(
XN
);
desc
|=
UPPER_ATTRS
(
XN
);
}
else
{
/* Normal memory */
/*
* Always map read-write normal memory as execute-never.
* (Trusted Firmware doesn't self-modify its code, therefore
* R/W memory is reserved for data storage, which must not be
* executable.)
* Note that setting the XN bit here is for consistency only.
* The enable_mmu_elx() function sets the SCTLR_EL3.WXN bit,
* which makes any writable memory region to be treated as
* execute-never, regardless of the value of the XN bit in the
* translation table.
*
* For read-only memory, rely on the MT_EXECUTE/MT_EXECUTE_NEVER
* attribute to figure out the value of the XN bit.
*/
if
((
attr
&
MT_RW
)
||
(
attr
&
MT_EXECUTE_NEVER
))
desc
|=
UPPER_ATTRS
(
XN
);
if
(
mem_type
==
MT_MEMORY
)
{
desc
|=
LOWER_ATTRS
(
ATTR_IWBWA_OWBWA_NTR_INDEX
|
ISH
);
}
else
{
assert
(
mem_type
==
MT_NON_CACHEABLE
);
desc
|=
LOWER_ATTRS
(
ATTR_NON_CACHEABLE_INDEX
|
OSH
);
}
}
}
debug_print
((
mem_type
==
MT_MEMORY
)
?
"MEM"
:
debug_print
((
mem_type
==
MT_MEMORY
)
?
"MEM"
:
((
mem_type
==
MT_NON_CACHEABLE
)
?
"NC"
:
"DEV"
));
((
mem_type
==
MT_NON_CACHEABLE
)
?
"NC"
:
"DEV"
));
debug_print
(
attr
&
MT_RW
?
"-RW"
:
"-RO"
);
debug_print
(
attr
&
MT_RW
?
"-RW"
:
"-RO"
);
debug_print
(
attr
&
MT_NS
?
"-NS"
:
"-S"
);
debug_print
(
attr
&
MT_NS
?
"-NS"
:
"-S"
);
debug_print
(
attr
&
MT_EXECUTE_NEVER
?
"-XN"
:
"-EXEC"
);
return
desc
;
return
desc
;
}
}
...
...
plat/arm/board/common/board_css_common.c
View file @
aadb1350
/*
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015
-2016
, ARM Limited and Contributors. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -31,9 +31,9 @@
...
@@ -31,9 +31,9 @@
#include <plat_arm.h>
#include <plat_arm.h>
/*
/*
* Table of regions for different BL stages to map using the MMU.
* Table of
memory
regions for different BL stages to map using the MMU.
* This doesn't include Trusted RAM as
the 'mem_layout' argument passed to
* This doesn't include Trusted
S
RAM as
arm_setup_page_tables() already
*
arm_configure_mmu_elx() will give the available subset of that,
*
takes care of mapping it.
*/
*/
#if IMAGE_BL1
#if IMAGE_BL1
const
mmap_region_t
plat_arm_mmap
[]
=
{
const
mmap_region_t
plat_arm_mmap
[]
=
{
...
...
plat/arm/board/fvp/fvp_common.c
View file @
aadb1350
...
@@ -66,9 +66,12 @@ arm_config_t arm_config;
...
@@ -66,9 +66,12 @@ arm_config_t arm_config;
/*
/*
* Table of regions for various BL stages to map using the MMU.
* Table of memory regions for various BL stages to map using the MMU.
* This doesn't include TZRAM as the 'mem_layout' argument passed to
* This doesn't include Trusted SRAM as arm_setup_page_tables() already
* arm_configure_mmu_elx() will give the available subset of that,
* takes care of mapping it.
*
* The flash needs to be mapped as writable in order to erase the FIP's Table of
* Contents in case of unrecoverable error (see plat_error_handler()).
*/
*/
#if IMAGE_BL1
#if IMAGE_BL1
const
mmap_region_t
plat_arm_mmap
[]
=
{
const
mmap_region_t
plat_arm_mmap
[]
=
{
...
...
plat/arm/common/aarch64/arm_common.c
View file @
aadb1350
...
@@ -50,57 +50,67 @@ extern const mmap_region_t plat_arm_mmap[];
...
@@ -50,57 +50,67 @@ extern const mmap_region_t plat_arm_mmap[];
#pragma weak plat_get_syscnt_freq
#pragma weak plat_get_syscnt_freq
#endif
#endif
/*******************************************************************************
/*
* Macro generating the code for the function setting up the pagetables as per
* Set up the page tables for the generic and platform-specific memory regions.
* the platform memory map & initialize the mmu, for the given exception level
* The extents of the generic memory regions are specified by the function
******************************************************************************/
* arguments and consist of:
* - Trusted SRAM seen by the BL image;
* - Code section;
* - Read-only data section;
* - Coherent memory region, if applicable.
*/
void
arm_setup_page_tables
(
unsigned
long
total_base
,
unsigned
long
total_size
,
unsigned
long
code_start
,
unsigned
long
code_limit
,
unsigned
long
rodata_start
,
unsigned
long
rodata_limit
#if USE_COHERENT_MEM
#if USE_COHERENT_MEM
#define DEFINE_CONFIGURE_MMU_EL(_el) \
,
void arm_configure_mmu_el##_el(unsigned long total_base, \
unsigned
long
coh_start
,
unsigned long total_size, \
unsigned
long
coh_limit
unsigned long ro_start, \
#endif
unsigned long ro_limit, \
)
unsigned long coh_start, \
{
unsigned long coh_limit) \
/*
{ \
* Map the Trusted SRAM with appropriate memory attributes.
mmap_add_region(total_base, total_base, \
* Subsequent mappings will adjust the attributes for specific regions.
total_size, \
*/
MT_MEMORY | MT_RW | MT_SECURE); \
VERBOSE
(
"Trusted SRAM seen by this BL image: %p - %p
\n
"
,
mmap_add_region(ro_start, ro_start, \
(
void
*
)
total_base
,
(
void
*
)
(
total_base
+
total_size
));
ro_limit - ro_start, \
mmap_add_region
(
total_base
,
total_base
,
MT_MEMORY | MT_RO | MT_SECURE); \
total_size
,
mmap_add_region(coh_start, coh_start, \
MT_MEMORY
|
MT_RW
|
MT_SECURE
);
coh_limit - coh_start, \
MT_DEVICE | MT_RW | MT_SECURE); \
/* Re-map the code section */
mmap_add(plat_arm_get_mmap()); \
VERBOSE
(
"Code region: %p - %p
\n
"
,
init_xlat_tables(); \
(
void
*
)
code_start
,
(
void
*
)
code_limit
);
\
mmap_add_region
(
code_start
,
code_start
,
enable_mmu_el##_el(0); \
code_limit
-
code_start
,
}
MT_CODE
|
MT_SECURE
);
#else
#define DEFINE_CONFIGURE_MMU_EL(_el) \
/* Re-map the read-only data section */
void arm_configure_mmu_el##_el(unsigned long total_base, \
VERBOSE
(
"Read-only data region: %p - %p
\n
"
,
unsigned long total_size, \
(
void
*
)
rodata_start
,
(
void
*
)
rodata_limit
);
unsigned long ro_start, \
mmap_add_region
(
rodata_start
,
rodata_start
,
unsigned long ro_limit) \
rodata_limit
-
rodata_start
,
{ \
MT_RO_DATA
|
MT_SECURE
);
mmap_add_region(total_base, total_base, \
total_size, \
#if USE_COHERENT_MEM
MT_MEMORY | MT_RW | MT_SECURE); \
/* Re-map the coherent memory region */
mmap_add_region(ro_start, ro_start, \
VERBOSE
(
"Coherent region: %p - %p
\n
"
,
ro_limit - ro_start, \
(
void
*
)
coh_start
,
(
void
*
)
coh_limit
);
MT_MEMORY | MT_RO | MT_SECURE); \
mmap_add_region
(
coh_start
,
coh_start
,
mmap_add(plat_arm_get_mmap()); \
coh_limit
-
coh_start
,
init_xlat_tables(); \
MT_DEVICE
|
MT_RW
|
MT_SECURE
);
\
enable_mmu_el##_el(0); \
}
#endif
#endif
/* Define EL1 and EL3 variants of the function initialising the MMU */
/* Now (re-)map the platform-specific memory regions */
DEFINE_CONFIGURE_MMU_EL
(
1
)
mmap_add
(
plat_arm_get_mmap
());
DEFINE_CONFIGURE_MMU_EL
(
3
)
/* Create the page tables to reflect the above mappings */
init_xlat_tables
();
}
uintptr_t
plat_get_ns_image_entrypoint
(
void
)
uintptr_t
plat_get_ns_image_entrypoint
(
void
)
{
{
...
...
Prev
1
2
Next
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