-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests.extra/regress-double_ref_shared
- Loading branch information
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This exhibits one compartment with two compilatioon units that each reference a | ||
shared object with different permissions. Because of the differing permissions, | ||
two import entries should be created. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include <compartment-macros.h> | ||
|
||
struct Foo | ||
{ | ||
int bar; | ||
}; | ||
|
||
void top1(); | ||
void top2(); | ||
|
||
int __cheri_compartment("top") entry(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "common.h" | ||
|
||
void top1() | ||
{ | ||
auto ref1 = | ||
SHARED_OBJECT_WITH_PERMISSIONS(struct Foo, foo, true, true, false, false); | ||
|
||
ref1->bar = 1; | ||
} | ||
|
||
int entry() | ||
{ | ||
top1(); | ||
top2(); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "common.h" | ||
|
||
#include <debug.hh> | ||
|
||
using Debug = ConditionalDebug<true, "top2">; | ||
|
||
void top2() | ||
{ | ||
auto ref2 = SHARED_OBJECT_WITH_PERMISSIONS( | ||
struct Foo, foo, true, false, false, false); | ||
|
||
Debug::log("ref2: {}", ref2->bar); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
set_project("CHERIoT Scheduler IRQ Exception PoC") | ||
sdkdir = "../../sdk" | ||
includes(sdkdir) | ||
set_toolchains("cheriot-clang") | ||
|
||
option("board") | ||
set_default("sail") | ||
|
||
compartment("top") | ||
add_files("top1.cc") | ||
add_files("top2.cc") | ||
|
||
on_load(function(target) | ||
target:values_set("shared_objects", { foo = 4 }, {expand = false}) | ||
end) | ||
|
||
firmware("top_compartment") | ||
add_deps("freestanding", "debug") | ||
add_deps("top") | ||
on_load(function(target) | ||
target:values_set("board", "$(board)") | ||
target:values_set("threads", { | ||
{ | ||
compartment = "top", | ||
priority = 1, | ||
entry_point = "entry", | ||
stack_size = 0x200, | ||
trusted_stack_frames = 1 | ||
} | ||
}, {expand = false}) | ||
end) |