Skip to content

Commit

Permalink
simple: Update cap skipping for SMC
Browse files Browse the repository at this point in the history
Need to update skipping caps since the SMC cap is only included
conditionally.

Signed-off-by: Robbie VanVossen <[email protected]>
  • Loading branch information
Furao authored and lsf37 committed Sep 13, 2023
1 parent b154d15 commit f8aabb6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions libsel4simple-default/src/libsel4simple-default.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ seL4_CPtr simple_default_nth_cap(void *data, int n)
if (true_return >= seL4_CapInitThreadSC) {
true_return++;
}
#endif
#ifndef CONFIG_ALLOW_SMC_CALLS
/* skip seL4_CapSMC if SMC Calls are not enabled */
if (true_return >= seL4_CapSMC) {
true_return++;
}
#endif
} else if (n < shared_frame_range) {
return bi->sharedFrames.start + (n - SIMPLE_NUM_INIT_CAPS);
Expand Down
8 changes: 7 additions & 1 deletion libsel4simple/arch_include/arm/simple/arch/simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@
#define SIMPLE_SKIP_SMMU_CAPS 2
#endif

#define SIMPLE_SKIPPED_INIT_CAPS (3 + SIMPLE_SKIP_THREADSC + SIMPLE_SKIP_SMMU_CAPS)
#ifdef CONFIG_ALLOW_SMC_CALLS
#define SIMPLE_SKIP_SMC 0
#else
#define SIMPLE_SKIP_SMC 1
#endif

#define SIMPLE_SKIPPED_INIT_CAPS (3 + SIMPLE_SKIP_THREADSC + SIMPLE_SKIP_SMMU_CAPS + SIMPLE_SKIP_SMC)

/* Request a cap to a specific IRQ number on the system
*
Expand Down
4 changes: 2 additions & 2 deletions libsel4simple/arch_include/x86/simple/arch/simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <vka/cspacepath_t.h>

/* Simple does not address initial null caps, including seL4_CapNull
* seL4_CapSMMUSIDControl, seL4_CapSMMUCBControl are null on x86 */
* seL4_CapSMMUSIDControl, seL4_CapSMMUCBControl, seL4_CapSMC are null on x86 */
#ifdef CONFIG_IOMMU
#define SIMPLE_SKIP_IOSPACE 0
#else
Expand All @@ -29,7 +29,7 @@
#define SIMPLE_SKIP_THREADSC 1
#endif

#define SIMPLE_SKIPPED_INIT_CAPS (3 + SIMPLE_SKIP_IOSPACE + SIMPLE_SKIP_THREADSC)
#define SIMPLE_SKIPPED_INIT_CAPS (4 + SIMPLE_SKIP_IOSPACE + SIMPLE_SKIP_THREADSC)

/**
* Request a cap to the IOPorts
Expand Down

0 comments on commit f8aabb6

Please sign in to comment.