Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FlightOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Luntzer
FlightOS
Commits
fd6f8e29
Commit
fd6f8e29
authored
8 years ago
by
Armin Luntzer
Browse files
Options
Downloads
Patches
Plain Diff
use same convention as in linux to define init calls
parent
9d3af19d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/kernel/init.h
+39
-5
39 additions, 5 deletions
include/kernel/init.h
include/kernel/module.h
+13
-3
13 additions, 3 deletions
include/kernel/module.h
with
52 additions
and
8 deletions
include/kernel/init.h
+
39
−
5
View file @
fd6f8e29
...
@@ -6,11 +6,45 @@
...
@@ -6,11 +6,45 @@
#define _KERNEL_INIT_H_
#define _KERNEL_INIT_H_
typedef
int
(
*
initcall_t
)(
void
);
typedef
int
(
*
initcall_t
)(
void
);
typedef
void
(
*
exitcall_t
)(
void
);
/**
*
* We piggy-back on the (linux-style) initcall sections that BCC and
* GCC for the MPPB already have specified in their default linker scripts
* until we add our own.
*
* Since _call_initcalls() is executed by the libgloss bootup-code, use
* the initcalls in init/main.c to set up our system. Conventions are the same
* as in linux.
*
* They don't have sections for exitcalls, but we don't really need those for
* now.
*/
#define __define_initcall(fn, id) \
static initcall_t __initcall_##fn __attribute((used)) \
__attribute__((__section__(".initcall" #id ".init"))) = fn;
#if 0
#define __exitcall(fn) \
static exitcall_t __exitcall_##fn __attribute((used)) \
__attribute__((__section__(".exitcall.exit"))) = fn;
#else
#define __exitcall(fn)
#endif
#define core_initcall(fn) __define_initcall(fn, 1)
#define postcore_initcall(fn) __define_initcall(fn, 2)
#define arch_initcall(fn) __define_initcall(fn, 3)
#define subsys_initcall(fn) __define_initcall(fn, 4)
#define fs_initcall(fn) __define_initcall(fn, 5)
#define device_initcall(fn) __define_initcall(fn, 6)
#define late_initcall(fn) __define_initcall(fn, 7)
/* TODO: initcalls on startup for compiled-in modules */
#define define_initcall(fn) \
static initcall_t _initcall_##fn __attribute__((used)) \
__attribute__((__section__(".initcall"))) = fn;
void
setup_arch
(
void
);
void
setup_arch
(
void
);
...
...
This diff is collapsed.
Click to expand it.
include/kernel/module.h
+
13
−
3
View file @
fd6f8e29
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include
<kernel/elf.h>
#include
<kernel/elf.h>
#ifdef MODULE
#define module_init(initfunc) \
#define module_init(initfunc) \
int _module_init(void) __attribute__((alias(#initfunc)));
int _module_init(void) __attribute__((alias(#initfunc)));
...
@@ -12,6 +13,15 @@
...
@@ -12,6 +13,15 @@
#define module_exit(exitfunc) \
#define module_exit(exitfunc) \
int _module_exit(void) __attribute__((alias(#exitfunc)));
int _module_exit(void) __attribute__((alias(#exitfunc)));
#else
/* MODULE */
#define module_init(initfunc) device_initcall(initfunc);
#define module_exit(exitfunc) __exitcall(exitfunc);
#endif
/* MODULE */
struct
module_section
{
struct
module_section
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment