-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef4c2ca
commit 062a03f
Showing
23 changed files
with
244 additions
and
71 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
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
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
This file was deleted.
Oops, something went wrong.
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
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,11 @@ | ||
#pragma once | ||
|
||
typedef enum { | ||
LOG_SEVERITY_INFO, | ||
} log_severity_t; | ||
|
||
void klogf(log_severity_t severity, const char *module_name, const char *fmt, | ||
...); | ||
|
||
#define log_info(fmt, ...) \ | ||
klogf(LOG_SEVERITY_INFO, _MODULE_NAME, fmt, ##__VA_ARGS__) |
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 @@ | ||
#pragma once | ||
|
||
#define MODULE_NAME(name) static const char *const _MODULE_NAME = name |
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,13 +1,40 @@ | ||
#include <init.h> | ||
|
||
extern i32 (*_init_start)(void), (*_init_end)(void); | ||
#include <log.h> | ||
#include <module.h> | ||
|
||
extern init_t _pre_init_start, _pre_init_end; | ||
extern init_t _init_start, _init_end; | ||
extern init_t _post_init_start, _post_init_end; | ||
|
||
MODULE_NAME("init"); | ||
|
||
i32 init_modules(void) { | ||
for (i32 (**init_ptr)(void) = &_init_start; init_ptr < &_init_end; | ||
log_info("entering the pre-initialization phase\n"); | ||
for (init_t *init_ptr = &_pre_init_start; init_ptr < &_pre_init_end; | ||
init_ptr++) { | ||
i32 res = init_ptr->init(); | ||
log_info("initialized %s\n", init_ptr->name); | ||
if (res < 0) | ||
return res; | ||
} | ||
|
||
log_info("entering the initialization phase\n"); | ||
for (init_t *init_ptr = &_init_start; init_ptr < &_init_end; init_ptr++) { | ||
i32 res = init_ptr->init(); | ||
log_info("initialized %s\n", init_ptr->name); | ||
if (res < 0) | ||
return res; | ||
} | ||
|
||
log_info("entering the post-initialization phase\n"); | ||
for (init_t *init_ptr = &_post_init_start; init_ptr < &_post_init_end; | ||
init_ptr++) { | ||
i32 res = (*init_ptr)(); | ||
i32 res = init_ptr->init(); | ||
log_info("initialized %s\n", init_ptr->name); | ||
if (res < 0) | ||
return res; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.