Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
147 changes: 147 additions & 0 deletions .clang-format
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
# SPDX-License-Identifier: GPL-2.0
#
# clang-format configuration file. Intended for clang-format >= 11.
# Based on the one found in the linux kernel
# https://github.com/torvalds/linux
#
# For more information, see:
#
# https://clang.llvm.org/docs/ClangFormat.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false

# Taken from:
# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' so3/include/ \
# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
# | LC_ALL=C sort -u
ForEachMacros:
- '__list_for_each'
- 'fdt_for_each_property_offset'
- 'fdt_for_each_subnode'
- 'hlist_for_each'
- 'hlist_for_each_entry'
- 'hlist_for_each_entry_continue'
- 'hlist_for_each_entry_from'
- 'hlist_for_each_entry_safe'
- 'hlist_for_each_safe'
- 'list_for_each'
- 'list_for_each_backwards_safe'
- 'list_for_each_entry'
- 'list_for_each_entry_continue'
- 'list_for_each_entry_from'
- 'list_for_each_entry_reverse'
- 'list_for_each_entry_safe'
- 'list_for_each_entry_safe_continue'
- 'list_for_each_entry_safe_from'
- 'list_for_each_entry_safe_reverse'
- 'list_for_each_prev'
- 'list_for_each_safe'

IncludeBlocks: Preserve
IncludeCategories:
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentGotoLabels: false
IndentPPDirectives: None
IndentWidth: 8
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true

# Taken from git's rules
PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60

PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatementsExceptForEachMacros
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
TabWidth: 8
UseTab: Always
...
1 change: 1 addition & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,6 +45,7 @@ agency/rootfs/target/**
!.gitignore #Don't ignore the ignore file ;-)
!.github
!*.tmpl #TaMPLate files for the man documentation
!.clang-format
!buildroot/**
!buildroot/docs/manual/*.mk
!agency/rootfs/*.mk
Expand Down
25 changes: 13 additions & 12 deletions so3/apps/refso3/callbacks.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,32 +40,35 @@ static LIST_HEAD(known_soo_list);

/* Reference to the shared content helpful during synergy with other MEs */
sh_refso3_t *sh_refso3;

/**
* PRE_SUSPEND
*
* This callback is executed right before suspending the state of frontend drivers, before migrating
*
*/
void cb_pre_suspend(soo_domcall_arg_t *args) {
void cb_pre_suspend(soo_domcall_arg_t *args)
{
DBG(">> ME %d: cb_pre_suspend...\n", ME_domID());
}

/**
* PRE_RESUME
*
* This callback is executed right before resuming the frontend drivers, right after ME activation
*
* Returns 0 if no propagation to the user space is required, 1 otherwise
*/
void cb_pre_resume(soo_domcall_arg_t *args) {
void cb_pre_resume(soo_domcall_arg_t *args)
{
DBG(">> ME %d: cb_pre_resume...\n", ME_domID());
}

/**
* POST_ACTIVATE callback (async)
*/
void cb_post_activate(soo_domcall_arg_t *args) {
void cb_post_activate(soo_domcall_arg_t *args)
{
#if 0
agency_ctl_args_t agency_ctl_args;
static uint32_t count = 0;
Expand All@@ -81,7 +84,8 @@ void cb_post_activate(soo_domcall_arg_t *args) {
*
*/

void cb_force_terminate(void) {
void cb_force_terminate(void)
{
DBG(">> ME %d: cb_force_terminate...\n", ME_domID());
DBG("ME state: %d\n", get_ME_state());

Expand All@@ -92,14 +96,11 @@ void cb_force_terminate(void) {
set_ME_state(ME_state_terminated);
}

void callbacks_init(void) {

void callbacks_init(void)
{
/* Allocate the shared page. */
sh_refso3 = (sh_refso3_t *)get_contig_free_vpages(1);
sh_refso3 = (sh_refso3_t *)get_contig_free_vpages(1);

/* Initialize the shared content page used to exchange information between other MEs */
memset(sh_refso3, 0, PAGE_SIZE);

}


8 changes: 3 additions & 5 deletions so3/apps/refso3/refso3.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,17 +51,15 @@
* small applications like a shell and the LVGL demo application.
*
*/
void *app_thread_main(void *args) {
void *app_thread_main(void *args)
{
sh_refso3->cur_letter = 'A';

while (1) {

msleep(500);

lprintk("(%d)", ME_domID());
lprintk("(%d)", ME_domID());
printk("%c ", sh_refso3->cur_letter);

}

return NULL;
Expand Down
16 changes: 8 additions & 8 deletions so3/apps/sample.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,18 +69,18 @@ void *app_thread_main(void *args)

spin_lock_init(&spinlock);

t1 = kernel_thread(thread_example, "fn1", (void *) 1, 0);
t2 = kernel_thread(thread_example, "fn2", (void *) 2, 0);
t3 = kernel_thread(thread_example, "fn2", (void *) 3, 0);
t4 = kernel_thread(thread_example, "fn2", (void *) 4, 0);

while (threads != 4) ;
t1 = kernel_thread(thread_example, "fn1", (void *)1, 0);
t2 = kernel_thread(thread_example, "fn2", (void *)2, 0);
t3 = kernel_thread(thread_example, "fn2", (void *)3, 0);
t4 = kernel_thread(thread_example, "fn2", (void *)4, 0);

while (threads != 4)
;

printk("### Total = %lld\n", count);

while(1);

while (1)
;

return NULL;
}
67 changes: 34 additions & 33 deletions so3/arch/arm32/asm-offsets.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,63 +33,64 @@

/* Use marker if you need to separate the values later */

#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
#define DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i"(val))

#define BLANK() asm volatile("\n->" : :)
#define BLANK() asm volatile("\n->" : :)

int main(void)
{
#ifdef CONFIG_AVZ

DEFINE(OFFSET_AVZ_SHARED, offsetof(struct domain, avz_shared));

DEFINE(OFFSET_EVTCHN_UPCALL_PENDING, offsetof(struct avz_shared, evtchn_upcall_pending));
DEFINE(OFFSET_EVTCHN_UPCALL_PENDING,
offsetof(struct avz_shared, evtchn_upcall_pending));

DEFINE(OFFSET_HYPERVISOR_CALLBACK, offsetof(struct avz_shared, vectors_vaddr));
DEFINE(OFFSET_DOMCALL_CALLBACK, offsetof(struct avz_shared, domcall_vaddr));
DEFINE(OFFSET_HYPERVISOR_CALLBACK,
offsetof(struct avz_shared, vectors_vaddr));
DEFINE(OFFSET_DOMCALL_CALLBACK,
offsetof(struct avz_shared, domcall_vaddr));

DEFINE(OFFSET_G_SP, offsetof(struct domain, g_sp));
DEFINE(OFFSET_G_SP, offsetof(struct domain, g_sp));

DEFINE(OFFSET_CPU_REGS,offsetof(struct domain, cpu_regs));
DEFINE(OFFSET_CPU_REGS,offsetof(struct domain, cpu_regs));
#endif

BLANK();

DEFINE(OFFSET_TCB_CPU_REGS, offsetof(tcb_t, cpu_regs));
DEFINE(OFFSET_TCB_CPU_REGS, offsetof(tcb_t, cpu_regs));

BLANK();

DEFINE(OFFSET_R0,offsetof(cpu_regs_t, r0));
DEFINE(OFFSET_R1,offsetof(cpu_regs_t, r1));
DEFINE(OFFSET_R2,offsetof(cpu_regs_t, r2));
DEFINE(OFFSET_R3,offsetof(cpu_regs_t, r3));
DEFINE(OFFSET_R4,offsetof(cpu_regs_t, r4));
DEFINE(OFFSET_R5,offsetof(cpu_regs_t, r5));
DEFINE(OFFSET_R6,offsetof(cpu_regs_t, r6));
DEFINE(OFFSET_R7,offsetof(cpu_regs_t, r7));
DEFINE(OFFSET_R8,offsetof(cpu_regs_t, r8));
DEFINE(OFFSET_R9,offsetof(cpu_regs_t, r9));
DEFINE(OFFSET_R10,offsetof(cpu_regs_t, r10));
DEFINE(OFFSET_FP,offsetof(cpu_regs_t, fp));
DEFINE(OFFSET_IP,offsetof(cpu_regs_t, ip));
DEFINE(OFFSET_SP,offsetof(cpu_regs_t, sp));
DEFINE(OFFSET_LR,offsetof(cpu_regs_t, lr));
DEFINE(OFFSET_PC,offsetof(cpu_regs_t, pc));
DEFINE(OFFSET_PSR,offsetof(cpu_regs_t, psr));
DEFINE(OFFSET_SP_USR,offsetof(cpu_regs_t, sp_usr));
DEFINE(OFFSET_LR_USR,offsetof(cpu_regs_t, lr_usr));
DEFINE(OFFSET_R0,offsetof(cpu_regs_t, r0));
DEFINE(OFFSET_R1,offsetof(cpu_regs_t, r1));
DEFINE(OFFSET_R2,offsetof(cpu_regs_t, r2));
DEFINE(OFFSET_R3,offsetof(cpu_regs_t, r3));
DEFINE(OFFSET_R4,offsetof(cpu_regs_t, r4));
DEFINE(OFFSET_R5,offsetof(cpu_regs_t, r5));
DEFINE(OFFSET_R6,offsetof(cpu_regs_t, r6));
DEFINE(OFFSET_R7,offsetof(cpu_regs_t, r7));
DEFINE(OFFSET_R8,offsetof(cpu_regs_t, r8));
DEFINE(OFFSET_R9,offsetof(cpu_regs_t, r9));
DEFINE(OFFSET_R10,offsetof(cpu_regs_t, r10));
DEFINE(OFFSET_FP,offsetof(cpu_regs_t, fp));
DEFINE(OFFSET_IP,offsetof(cpu_regs_t, ip));
DEFINE(OFFSET_SP,offsetof(cpu_regs_t, sp));
DEFINE(OFFSET_LR,offsetof(cpu_regs_t, lr));
DEFINE(OFFSET_PC,offsetof(cpu_regs_t, pc));
DEFINE(OFFSET_PSR,offsetof(cpu_regs_t, psr));
DEFINE(OFFSET_SP_USR,offsetof(cpu_regs_t, sp_usr));
DEFINE(OFFSET_LR_USR,offsetof(cpu_regs_t, lr_usr));

BLANK();

DEFINE(OFFSET_SYS_SIGNUM,offsetof(__sigaction_t, signum));
DEFINE(OFFSET_SYS_SA,offsetof(__sigaction_t, sa));
DEFINE(OFFSET_SYS_SIGNUM,offsetof(__sigaction_t, signum));
DEFINE(OFFSET_SYS_SA,offsetof(__sigaction_t, sa));

BLANK();

DEFINE(OFFSET_SA_HANDLER,offsetof(sigaction_t, sa_handler));
DEFINE(OFFSET_SA_RESTORER,offsetof(sigaction_t, sa_restorer));
DEFINE(OFFSET_SA_HANDLER,offsetof(sigaction_t, sa_handler));
DEFINE(OFFSET_SA_RESTORER,offsetof(sigaction_t, sa_restorer));

return 0;
}

Loading