Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsel4test: Add smc cap to test env #72

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions libsel4test/include/sel4test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ struct env {
seL4_CPtr asid_pool;
seL4_CPtr asid_ctrl;
seL4_CPtr sched_ctrl;
#ifdef CONFIG_ALLOW_SMC_CALLS
seL4_CPtr smc;
#endif /* CONFIG_ALLOW_SMC_CALLS */
#ifdef CONFIG_IOMMU
seL4_CPtr io_space;
#endif /* CONFIG_IOMMU */
Expand Down