feat added init function

This commit is contained in:
2021-08-13 21:07:40 +02:00
parent 8187265735
commit 6b0f6ddfb7
5 changed files with 59 additions and 0 deletions

18
kernel/util/init.c Normal file
View File

@@ -0,0 +1,18 @@
//
// Created by rick on 13-08-21.
//
#include <myke/util/init.h>
#include <stdio.h>
extern struct init __start_init[];
extern struct init __stop_init[];
#define NUM_DRIVERS ((size_t)(__stop_init - __start_init))
#define DRIVER(i) ((__start_init) + (i))
void init_execute_all() {
for (size_t i = 0; i < NUM_DRIVERS; ++i) {
printf("init %s\n", DRIVER(i)->name);
DRIVER(i)->init();
}
}