Skip to content

Commit 59027bd

Browse files
committed
fix(gens): add option to define data addr in config
Signed-off-by: Daniel Oliveira <[email protected]>
1 parent 361a305 commit 59027bd

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

scripts/config_defs_gen.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ int main() {
3636
printf("#define CONFIG_HYP_BASE_ADDR PLAT_BASE_ADDR\n");
3737
}
3838

39+
if(config.hyp.data_relocate) {
40+
printf("#define CONFIG_HYP_DATA_ADDR (0x%lx)\n", config.hyp.data_addr);
41+
} else {
42+
printf("#define CONFIG_HYP_DATA_ADDR PLAT_DATA_ADDR\n");
43+
}
44+
3945
printf("#define CONFIG_REMIO_DEV_NUM %ld\n", remio_dev_num());
4046

4147
return 0;

scripts/platform_defs_gen.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ int main() {
1919
{
2020
/*
2121
* Selects the first memory region with RWX (read, write, execute) permissions, and defines
22-
* it as PLAT_DATA_MEM. This region is considered the main data memory that Bao will use
22+
* it as PLAT_DATA_ADDR. This region is considered the main data memory that Bao will use
2323
* for its own purposes.
2424
*/
2525
if(platform.regions[i].perms == MEM_RWX)
2626
{
27-
printf("#define PLAT_DATA_MEM (0x%lx)\n", platform.regions[i].base);
27+
printf("#define PLAT_DATA_ADDR (0x%lx)\n", platform.regions[i].base);
2828
break;
2929
}
3030
}

src/core/inc/config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ extern struct config {
110110
bool relocate;
111111
paddr_t base_addr;
112112

113+
/**
114+
* Only meaningful for non-unified platforms. In such platforms, the hypervisor expects a
115+
* base address for data memory and will default to the first RWX region defined in the
116+
* target platform's description. If the user wishes to relocate it to another address,
117+
* they must set data_relocate to true and provide the new base address.
118+
*/
119+
bool data_relocate;
120+
paddr_t data_addr;
121+
113122
/* Hypervisor colors */
114123
colormap_t colors;
115124
} hyp;

src/linker.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SECTIONS
3434
_data_lma_start = .;
3535

3636
#ifdef MEM_NON_UNIFIED
37-
. = PLAT_DATA_MEM; /* Changed location counter to VMA address */
37+
. = CONFIG_HYP_DATA_ADDR; /* Changed location counter to VMA address */
3838
#endif
3939

4040
_data_vma_start = .;

0 commit comments

Comments
 (0)