Skip to content

Commit fa31b88

Browse files
committed
feat(mem): add perms to mem regions
Signed-off-by: Daniel Oliveira <[email protected]>
1 parent 3700de4 commit fa31b88

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

scripts/platform_defs_gen.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ int main() {
1414

1515
printf("#define PLAT_CPU_NUM (%ld)\n", platform.cpu_num);
1616
printf("#define PLAT_BASE_ADDR (0x%lx)\n", platform.regions[0].base);
17+
18+
for(size_t i = 1; i < platform.region_num; i++)
19+
{
20+
if(platform.regions[i].perms == RWX)
21+
{
22+
printf("#define PLAT_DATA_MEM (0x%lx)\n", platform.regions[i].base);
23+
break;
24+
}
25+
}
1726
if (platform.cpu_master_fixed) {
1827
printf("#define CPU_MASTER_FIXED (%ld)\n", platform.cpu_master);
1928
}

src/core/inc/mem.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
#ifndef __ASSEMBLER__
1717

18+
enum MEM_PERMISSIONS {
19+
RWX,
20+
RX,
21+
};
22+
1823
struct ppages {
1924
paddr_t base;
2025
size_t num_pages;
@@ -34,6 +39,7 @@ struct page_pool {
3439
struct mem_region {
3540
paddr_t base;
3641
size_t size;
42+
enum MEM_PERMISSIONS perms;
3743
struct page_pool page_pool;
3844
};
3945

0 commit comments

Comments
 (0)