Skip to content

Commit bc55459

Browse files
nwfresistor
authored andcommitted
[CHERIoT] ELF/Writer: fix import entry perm mask
The loader reserves 8, not 4, bits for permission flags; the linker should agree.
1 parent ca91dd7 commit bc55459

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lld/ELF/Writer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3280,7 +3280,13 @@ class CompartmentReportWriter {
32803280
imports.push_back(json::Object{
32813281
{"kind", "MMIO"},
32823282
{"start", entry.start},
3283-
{"length", entry.length & 0xfffffff},
3283+
/*
3284+
* Length and permissions are bit-stuffed into the same 32-bit
3285+
* word, with the top 8 bits reserved for permission flags and
3286+
* the bottom 24 for length. See CHERIoT-RTOS's
3287+
* sdk/core/loader/types.h ReservedPermissionsMask
3288+
*/
3289+
{"length", entry.length & 0x00ffffff},
32843290
{"permits_load", (entry.length & ImportPermitsLoad) != 0},
32853291
{"permits_store", (entry.length & ImportPermitsStore) != 0},
32863292
{"permits_load_store_capabilities",

0 commit comments

Comments
 (0)